You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/07/12 19:59:30 UTC

[GitHub] [iotdb] wangchao316 commented on a change in pull request #3538: [To rel/0.12][IOTDB-1488] Fix metaMember's forwarding clientPool timeout in cluster module

wangchao316 commented on a change in pull request #3538:
URL: https://github.com/apache/iotdb/pull/3538#discussion_r667840027



##########
File path: thrift-cluster/src/main/thrift/cluster.thrift
##########
@@ -336,7 +338,9 @@ service RaftService {
   * When a follower finds that it already has a file in a snapshot locally, it calls this
   * interface to notify the leader to remove the associated hardlink.
   **/
-  void removeHardLink(1: string hardLinkPath)
+  void removeHardLink(1:string hardLinkPath)
+
+  void RefreshConnection(1:RefreshReuqest request)

Review comment:
       hi , I have a little question,  what does  RefreshConnection() do?    which is an empty implementation in MetaClusterServer and DataClusterServer.   if have a use, we can use refreshConnection. generate, Method Name Camel Command Format. 

##########
File path: thrift-cluster/src/main/thrift/cluster.thrift
##########
@@ -336,7 +338,9 @@ service RaftService {
   * When a follower finds that it already has a file in a snapshot locally, it calls this
   * interface to notify the leader to remove the associated hardlink.
   **/
-  void removeHardLink(1: string hardLinkPath)
+  void removeHardLink(1:string hardLinkPath)
+
+  void RefreshConnection(1:RefreshReuqest request)

Review comment:
       Thanks. I get it.

##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/server/member/MetaGroupMember.java
##########
@@ -460,6 +481,57 @@ private void threadTaskInit() {
         CLEAN_HARDLINK_INTERVAL_SEC,
         CLEAN_HARDLINK_INTERVAL_SEC,
         TimeUnit.SECONDS);
+    dataClientRefresher.scheduleAtFixedRate(
+        this::RefreshClientOnce, REFRESH_CLIENT_SEC, REFRESH_CLIENT_SEC, TimeUnit.SECONDS);
+  }
+
+  private void RefreshClientOnce() {
+    for (Node receiver : allNodes) {
+      if (!receiver.equals(thisNode)) {
+        if (ClusterDescriptor.getInstance().getConfig().isUseAsyncServer()) {
+          RefreshClientOnceAsync(receiver);
+        } else {
+          RefreshClientOnceSync(receiver);
+        }
+      }
+    }
+  }
+
+  private void RefreshClientOnceSync(Node receiver) {
+    RaftService.Client client;
+    try {
+      client =
+          getClientProvider()
+              .getSyncDataClientForRefresh(receiver, RaftServer.getWriteOperationTimeoutMS());
+    } catch (TException e) {
+      return;
+    }
+    try {
+      RefreshReuqest req = new RefreshReuqest();
+      client.refreshConnection(req);
+    } catch (TException e) {
+      logger.warn("encounter refreshing client timeout, throw broken connection", e);
+      // the connection may be broken, close it to avoid it being reused
+      client.getInputProtocol().getTransport().close();
+    } finally {
+      ClientUtils.putBackSyncClient(client);
+    }
+  }
+
+  private void RefreshClientOnceAsync(Node receiver) {

Review comment:
       the same..




-- 
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: reviews-unsubscribe@iotdb.apache.org

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