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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]