You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2020/08/31 07:38:24 UTC

[shardingsphere] branch master updated: Fix: fix the null table name issue

This is an automated email from the ASF dual-hosted git repository.

panjuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6e9c4c3  Fix: fix the null table name issue
     new 44aeed2  Merge pull request #7162 from taojintianxia/scaling-fix
6e9c4c3 is described below

commit 6e9c4c3a63cafce4af912a1fff48005a577de6f3
Author: sunnianjun <su...@huobi.com>
AuthorDate: Mon Aug 31 11:07:35 2020 +0800

    Fix: fix the null table name issue
---
 .../core/job/preparer/splitter/InventoryDataTaskSplitter.java        | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
index 3823eaf..8d5f98c 100644
--- a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
+++ b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/job/preparer/splitter/InventoryDataTaskSplitter.java
@@ -121,7 +121,8 @@ public final class InventoryDataTaskSplitter {
     private Collection<InventoryDumperConfiguration> splitByPrimaryKeyRange(final int concurrency, final InventoryDumperConfiguration inventoryDumperConfiguration,
                                                                    final MetaDataManager metaDataManager, final DataSource dataSource) {
         Collection<InventoryDumperConfiguration> result = new LinkedList<>();
-        String primaryKey = metaDataManager.getTableMetaData(inventoryDumperConfiguration.getTableName()).getPrimaryKeyColumns().get(0);
+        String tableName = inventoryDumperConfiguration.getTableName();
+        String primaryKey = metaDataManager.getTableMetaData(tableName).getPrimaryKeyColumns().get(0);
         inventoryDumperConfiguration.setPrimaryKey(primaryKey);
         try (Connection connection = dataSource.getConnection()) {
             PreparedStatement ps = connection.prepareStatement(String.format("SELECT MIN(%s),MAX(%s) FROM %s LIMIT 1", primaryKey, primaryKey, inventoryDumperConfiguration.getTableName()));
@@ -139,6 +140,8 @@ public final class InventoryDataTaskSplitter {
                     splitDumperConfig.setPositionManager(new InventoryPositionManager<>(new PrimaryKeyPosition(min, max)));
                 }
                 splitDumperConfig.setSpiltNum(i);
+                splitDumperConfig.setPrimaryKey(primaryKey);
+                splitDumperConfig.setTableName(tableName);
                 result.add(splitDumperConfig);
             }
         } catch (final SQLException ex) {