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 06:42:31 UTC

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

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



##########
File path: session/src/main/java/org/apache/iotdb/session/Session.java
##########
@@ -1096,6 +1118,10 @@ private void insertRecordsWithLeaderCache(
         handleRedirection(entry.getKey(), e.getEndPoint());
       } catch (StatementExecutionException e) {
         errMsgBuilder.append(e.getMessage());
+      } catch (IoTDBConnectionException e) {

Review comment:
       Maybe we can optimize insertRecords interface to perfrom one request per sessionConnection rather than per deviceID, just like insertTablets.

##########
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:
       As `IoTDBConnectionException` is rarely thrown, I doubt whether this is worth recording even without errors, maybe we can traverse `endPointToSessionConnection` to delete expired sessionConnection when `IoTDBConnectionException` is thrown.




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