Caideyipi commented on code in PR #14324:
URL: https://github.com/apache/iotdb/pull/14324#discussion_r1872553350


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/thrift/async/IoTDBDataRegionAsyncConnector.java:
##########
@@ -543,12 +549,24 @@ public synchronized void close() {
     isClosed.set(true);
 
     retryConnector.close();
-    clearRetryEventsReferenceCount();
 
     if (tabletBatchBuilder != null) {
       tabletBatchBuilder.close();
     }
 
+    // ensure all on-the-fly requests have been handled
+    while (hasPendingRequests()) {
+      try {
+        Thread.sleep(50);

Review Comment:
   We think we could clear the events anyway if the events are on-the-fly, 
since in that way the resources are not readed. In that way we may also check 
the "isClosed" and return after the messages are sent. More brutally saying, we 
could clear the resources here anyway, and make the handler's "onError" print 
nothing or an "info" if the connector is "closed"... 



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/connector/protocol/thrift/async/IoTDBDataRegionAsyncConnector.java:
##########
@@ -543,12 +549,24 @@ public synchronized void close() {
     isClosed.set(true);
 
     retryConnector.close();
-    clearRetryEventsReferenceCount();
 
     if (tabletBatchBuilder != null) {
       tabletBatchBuilder.close();
     }
 
+    // ensure all on-the-fly requests have been handled
+    while (hasPendingRequests()) {
+      try {
+        Thread.sleep(50);

Review Comment:
   What will happen if the network is weak and the timeout is large? Will we 
wait here till all the messages have timed out? This could last for 15 minutes 
or longer for seal large tsFiles....



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to