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 20:02:08 UTC

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

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



##########
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:
       For the `refreshConnection` rpc, It's just a simple implementation of application layer heartbeat preservation mechanism for long TCP connections.  For the detailed reason, you can refer to [jira1487](https://issues.apache.org/jira/browse/IOTDB-1487).
   
   For the Camel Command Format, It's my fault and I will fix this. thanks for your reminding!

##########
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:
       fixed




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