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/02/07 01:23:48 UTC

[GitHub] [iotdb] neuyilan commented on a change in pull request #2635: [IOTDB-1148]fix the client leak of client pool&use remote schema cache when check timeseries exist or not

neuyilan commented on a change in pull request #2635:
URL: https://github.com/apache/iotdb/pull/2635#discussion_r571512990



##########
File path: cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -623,13 +648,16 @@ public void setCoordinator(Coordinator coordinator) {
           result = SyncClientAdaptor
               .getUnregisteredMeasurements(client, partitionGroup.getHeader(), seriesList);
         } else {
-          SyncDataClient syncDataClient =
-              metaGroupMember.getClientProvider().getSyncDataClient(node,
-                  RaftServer.getReadOperationTimeoutMS());
-          result = syncDataClient.getUnregisteredTimeseries(partitionGroup.getHeader(), seriesList);
-          ClientUtils.putBackSyncClient(syncDataClient);
+          SyncDataClient syncDataClient = null;
+          try {
+            syncDataClient = metaGroupMember.getClientProvider().getSyncDataClient(node,
+                RaftServer.getReadOperationTimeoutMS());
+            result = syncDataClient
+                .getUnregisteredTimeseries(partitionGroup.getHeader(), seriesList);
+          } finally {
+            ClientUtils.putBackSyncClient(syncDataClient);

Review comment:
       null client value can not be put back to the client pool, this is guaranteed in function putBackSyncClient in ClientUtils,
   if the client is null, the two if in the judgment condition is not tenable, so it will not be put back.




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

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