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

zhangliang 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 63bec322ad5 Add more todo comments on pipeline module (#32738)
63bec322ad5 is described below

commit 63bec322ad56cd5c197d1ba5938207278bae873a
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Aug 31 00:15:48 2024 +0800

    Add more todo comments on pipeline module (#32738)
    
    * Add more todo comments on pipeline module
    
    * Add more todo comments on pipeline module
---
 .../opengauss/sqlbuilder/OpenGaussPipelineSQLBuilder.java        | 2 +-
 .../postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java      | 9 +++++++--
 .../data/pipeline/scenario/migration/api/MigrationJobAPI.java    | 2 +-
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git 
a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilder.java
 
b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilder.java
index 0ee8e65ebf0..7e9f9eb5dd3 100644
--- 
a/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilder.java
+++ 
b/kernel/data-pipeline/dialect/opengauss/src/main/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilder.java
@@ -69,7 +69,7 @@ public final class OpenGaussPipelineSQLBuilder implements 
DialectPipelineSQLBuil
                 Statement statement = connection.createStatement();
                 ResultSet resultSet = 
statement.executeQuery(String.format("SELECT * FROM pg_get_tabledef('%s.%s')", 
schemaName, tableName))) {
             if (resultSet.next()) {
-                // TODO use ";" to split is not always correct
+                // TODO use ";" to split is not always correct if return 
value's comments contains ";"
                 return 
Arrays.asList(resultSet.getString("pg_get_tabledef").split(";"));
             }
         }
diff --git 
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
 
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
index 2991ee4377d..7192526c0b6 100644
--- 
a/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
+++ 
b/kernel/data-pipeline/dialect/postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
@@ -72,7 +72,12 @@ public final class PostgreSQLPipelineSQLBuilder implements 
DialectPipelineSQLBui
         return Optional.of(String.format("SELECT reltuples::integer FROM 
pg_class WHERE oid='%s'::regclass::oid;", qualifiedTableName));
     }
     
-    // TODO support partitions etc.
+    // TODO support partitions etc. If user use partition table, after 
sharding, the partition definition will not be needed. So we need to remove it 
after supported.
+    @Override
+    public Optional<String> buildCRC32SQL(final String qualifiedTableName, 
final String columnName) {
+        return Optional.of(String.format("SELECT 
pg_catalog.pg_checksum_table('%s', true)", qualifiedTableName));
+    }
+    
     @Override
     public Collection<String> buildCreateTableSQLs(final DataSource 
dataSource, final String schemaName, final String tableName) throws 
SQLException {
         try (Connection connection = dataSource.getConnection()) {
@@ -81,7 +86,7 @@ public final class PostgreSQLPipelineSQLBuilder implements 
DialectPipelineSQLBui
             Map<String, Object> materials = loadMaterials(tableName, 
schemaName, connection, majorVersion, minorVersion);
             String tableSQL = generateCreateTableSQL(majorVersion, 
minorVersion, materials);
             String indexSQL = generateCreateIndexSQL(connection, majorVersion, 
minorVersion, materials);
-            // TODO use ";" to split is not always correct
+            // TODO use ";" to split is not always correct if return value's 
comments contains ";"
             return Arrays.asList((tableSQL + System.lineSeparator() + 
indexSQL).trim().split(";"));
         }
     }
diff --git 
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
 
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
index 1b5daf02ed1..236381a9cca 100644
--- 
a/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
+++ 
b/kernel/data-pipeline/scenario/migration/src/main/java/org/apache/shardingsphere/data/pipeline/scenario/migration/api/MigrationJobAPI.java
@@ -285,7 +285,7 @@ public final class MigrationJobAPI implements 
TransmissionJobAPI {
     }
     
     private void refreshTableMetadata(final String jobId, final String 
databaseName) {
-        // TODO use origin database name now, wait reloadDatabaseMetaData fix 
case-sensitive problem
+        // TODO use origin database name for now. It can be reduce metadata 
refresh scope after reloadDatabaseMetaData case-sensitive problem fixed.
         ContextManager contextManager = 
PipelineContextManager.getContext(PipelineJobIdUtils.parseContextKey(jobId)).getContextManager();
         ShardingSphereDatabase database = 
contextManager.getMetaDataContexts().getMetaData().getDatabase(databaseName);
         
contextManager.getMetaDataContextManager().refreshTableMetaData(database);

Reply via email to