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/10/24 02:53:38 UTC

[GitHub] [shardingsphere] azexcy opened a new pull request, #21712: Improve migration IT, remove comment

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

   
   
   Changes proposed in this pull request:
     - Improve check migration after stop
   
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `mvn clean install -B -T2C -DskipTests -Dmaven.javadoc.skip=true -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] 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 #21712: Improve migration IT, remove comment

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


-- 
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 #21712: Improve migration IT, remove comment

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


##########
test/integration-test/scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralIT.java:
##########
@@ -115,15 +118,21 @@ private void checkOrderMigration(final JdbcTemplate jdbcTemplate) throws SQLExce
         startIncrementTask(new PostgreSQLIncrementTask(jdbcTemplate, SCHEMA_NAME, getSourceTableOrderName(), 20));
         String jobId = getJobIdByTableName(getSourceTableOrderName());
         waitIncrementTaskFinished(String.format("SHOW MIGRATION STATUS '%s'", jobId));
-        /*
-         * TODO Compatible with restart job, before stopping job, incremental_idle_seconds=16, before checking migration, incremental_idle_seconds=23, it just pass 7 seconds, and it's not enough for
-         * PostgreSQL incremental task to sync data
-         */
-        // stopMigrationByJobId(jobId);
-        // sourceExecuteWithLog(String.format("INSERT INTO %s.%s (order_id,user_id,status) VALUES (%s, %s, '%s')", SCHEMA_NAME, getSourceTableOrderName(), KEY_GENERATE_ALGORITHM.generateKey(),
-        // 1, "afterStop"));
-        // startMigrationByJobId(jobId);
-        // waitIncrementTaskFinished(String.format("SHOW MIGRATION STATUS '%s'", jobId));
+        stopMigrationByJobId(jobId);
+        Comparable<?> recordId = KEY_GENERATE_ALGORITHM.generateKey();
+        sourceExecuteWithLog(String.format("INSERT INTO %s (order_id,user_id,status) VALUES (%s, %s, '%s')", String.join(".", SCHEMA_NAME, getSourceTableOrderName()), recordId, 1, "afterStop"));
+        startMigrationByJobId(jobId);
+        boolean recordExist = false;
+        // must refresh firstly, otherwise proxy can't get schema and table info 
+        proxyExecuteWithLog("REFRESH TABLE METADATA;", 2);
+        for (int i = 0; i < 5; i++) {
+            recordExist = checkProxyOrderRecordExist(recordId, String.join(".", SCHEMA_NAME, getTargetTableOrderName()));
+            if (recordExist) {
+                break;
+            }
+            ThreadUtil.sleep(2, TimeUnit.SECONDS);
+        }

Review Comment:
   Could we extract it to super 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