You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/09/19 13:50:29 UTC

[GitHub] [shardingsphere] azexcy opened a new pull request, #21071: Improve migration IT table name

azexcy opened a new pull request, #21071:
URL: https://github.com/apache/shardingsphere/pull/21071

   
   
   Changes proposed in this pull request:
     - Improve migration IT table name, adapted to more scenarios
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [x] I have self-reviewed the commit code.
   - [x] I have triggered maven check: `mvn clean install -B -T2C -DskipTests -Dmaven.javadoc.skip=true -e`.
   - [x] I have made corresponding changes to the documentation.
   - [x] I have added corresponding unit tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz merged pull request #21071: Improve migration IT table name

Posted by GitBox <gi...@apache.org>.
sandynz merged PR #21071:
URL: https://github.com/apache/shardingsphere/pull/21071


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #21071: Improve migration IT table name

Posted by GitBox <gi...@apache.org>.
sandynz commented on code in PR #21071:
URL: https://github.com/apache/shardingsphere/pull/21071#discussion_r975212226


##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/migration/general/MySQLMigrationGeneralIT.java:
##########
@@ -86,13 +91,13 @@ public void assertMigrationSuccess() throws SQLException, InterruptedException {
         JdbcTemplate jdbcTemplate = new JdbcTemplate(getSourceDataSource());
         Pair<List<Object[]>, List<Object[]>> dataPair = ScalingCaseHelper.generateFullInsertData(keyGenerateAlgorithm, parameterized.getDatabaseType(), 3000);
         log.info("init data begin: {}", LocalDateTime.now());
-        jdbcTemplate.batchUpdate(getExtraSQLCommand().getFullInsertOrder(), dataPair.getLeft());
+        jdbcTemplate.batchUpdate(String.format(getExtraSQLCommand().getFullInsertOrder(getSourceTableOrderName())), dataPair.getLeft());

Review Comment:
   Looks `getFullInsertOrder` does not need String.format any more



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/command/ExtraSQLCommand.java:
##########
@@ -33,11 +34,33 @@ public final class ExtraSQLCommand {
     private String createTableOrder;
     
     @XmlElement(name = "create-table-order-item")
+    @Getter
     private String createTableOrderItem;
     
     @XmlElement(name = "full-insert-order")
     private String fullInsertOrder;
     
     @XmlElement(name = "full-insert-order-item")
+    @Getter
     private String fullInsertOrderItem;
+    
+    /**
+     * Get migration single table DistSQL.
+     *
+     * @param orderTableName order table name
+     * @return migration single table DistSQL
+     */

Review Comment:
   Looks javadoc doesn't match getFullInsertOrder method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] sandynz commented on a diff in pull request #21071: Improve migration IT table name

Posted by GitBox <gi...@apache.org>.
sandynz commented on code in PR #21071:
URL: https://github.com/apache/shardingsphere/pull/21071#discussion_r974926593


##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/migration/general/MySQLMigrationGeneralIT.java:
##########
@@ -86,13 +86,13 @@ public void assertMigrationSuccess() throws SQLException, InterruptedException {
         JdbcTemplate jdbcTemplate = new JdbcTemplate(getSourceDataSource());
         Pair<List<Object[]>, List<Object[]>> dataPair = ScalingCaseHelper.generateFullInsertData(keyGenerateAlgorithm, parameterized.getDatabaseType(), 3000);
         log.info("init data begin: {}", LocalDateTime.now());
-        jdbcTemplate.batchUpdate(getExtraSQLCommand().getFullInsertOrder(), dataPair.getLeft());
+        jdbcTemplate.batchUpdate(String.format(getExtraSQLCommand().getFullInsertOrder(), SOURCE_TABLE_ORDER), dataPair.getLeft());

Review Comment:
   Could we add parameter for `getExtraSQLCommand().getFullInsertOrder()`, then IT case could just get whole SQL



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/base/BaseITCase.java:
##########
@@ -189,22 +189,6 @@ protected String getActualJdbcUrlTemplate(final String databaseName, final boole
         return DataSourceEnvironment.getURL(getDatabaseType(), "127.0.0.1", ENV.getActualDataSourceDefaultPort(databaseType), databaseName);
     }
     
-    protected void createSourceOrderTable() throws SQLException {
-        sourceExecuteWithLog(extraSQLCommand.getCreateTableOrder());
-    }
-    
-    protected void createSourceTableIndexList(final String schema) throws SQLException {
-        if (DatabaseTypeUtil.isPostgreSQL(getDatabaseType())) {
-            sourceExecuteWithLog(String.format("CREATE INDEX IF NOT EXISTS idx_user_id ON %s.t_order_copy ( user_id )", schema));
-        } else if (DatabaseTypeUtil.isOpenGauss(getDatabaseType())) {
-            sourceExecuteWithLog(String.format("CREATE INDEX idx_user_id ON %s.t_order_copy ( user_id )", schema));
-        }
-    }
-    
-    protected void createSourceCommentOnList(final String schema) throws SQLException {
-        sourceExecuteWithLog(String.format("COMMENT ON COLUMN %s.t_order_copy.user_id IS 'user id'", schema));
-    }
-    

Review Comment:
   Could we still keep these methods in BaseITCase for common usage?



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/migration/AbstractMigrationITCase.java:
##########
@@ -42,6 +43,11 @@
 @Slf4j
 public abstract class AbstractMigrationITCase extends BaseITCase {
     
+    protected static final String SOURCE_TABLE_ORDER = "t_order_copy";
+    
+    protected static final String SOURCE_TABLE_ORDER_ITEM = "t_order_item";

Review Comment:
   It's better to use protected method, then it could be overrided in sub-class



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org