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/06/07 08:35:46 UTC

[GitHub] [iotdb] neuyilan commented on a change in pull request #3364: Fix the session can not remove the broken cached leader connection.

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



##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -1257,13 +1283,15 @@ private void insertTabletsWithLeaderCache(Map<String, Tablet> tablets, boolean s
     EndPoint endPoint;
     SessionConnection connection;
     Map<SessionConnection, TSInsertTabletsReq> tabletGroup = new HashMap<>();
+    Map<SessionConnection, EndPoint> sessionConnectionEndPointMap = new HashMap<>();
     for (Entry<String, Tablet> entry : tablets.entrySet()) {
       endPoint = deviceIdToEndpoint.get(entry.getKey());
       if (endPoint != null) {
         connection = endPointToSessionConnection.get(endPoint);
       } else {
         connection = defaultSessionConnection;
       }
+      sessionConnectionEndPointMap.putIfAbsent(connection, endPoint);

Review comment:
       That's another solution. the original though is as the number of connections is raly small, so I think it ok add one map here and trade space for time.
   As you say, maybe `IoTDBConnectionException` is rarely thrown, so I agree with you.




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