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/06/22 09:45:41 UTC

[GitHub] [shardingsphere] sandynz commented on a diff in pull request #18516: Improve scaling MySQLClient reconnect and add max retry times and support Interrupt.

sandynz commented on code in PR #18516:
URL: https://github.com/apache/shardingsphere/pull/18516#discussion_r903520789


##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/client/MySQLClient.java:
##########
@@ -70,6 +71,10 @@ public final class MySQLClient {
     
     private ServerInfo serverInfo;
     
+    private volatile boolean running = true;
+    
+    private int reconnectTimes;

Review Comment:
   Maybe `reconnectTimes` need volatile too



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java:
##########
@@ -72,6 +72,8 @@ public final class MySQLIncrementalDumper extends AbstractIncrementalDumper<Binl
     
     private final PipelineChannel channel;
     
+    private MySQLClient client;

Review Comment:
   client could be final, and also related fields.



##########
shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java:
##########
@@ -198,5 +200,8 @@ private void pushRecord(final Record record) {
     
     @Override
     protected void doStop() {
+        if (null != client) {
+            client.closeChannel();

Review Comment:
   It's better to catch exception for `closeChannel()`



##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/general/MySQLGeneralScalingIT.java:
##########
@@ -84,6 +87,11 @@ public void assertManualScalingSuccess() throws InterruptedException {
         addTargetResource();
         executeWithLog(getCommonSQLCommand().getAutoAlterOrderWithItemShardingTableRule());
         String jobId = getScalingJobId();
+        Executors.newFixedThreadPool(1).execute(() -> {
+            ThreadUtil.sleep(8, TimeUnit.SECONDS);
+            executeWithLog(String.format("STOP SCALING %s", jobId));
+            executeWithLog(String.format("START SCALING %s", jobId));
+        });

Review Comment:
   Could be added later, after blocking response for START/STOP SCALING is done.



-- 
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