flyrain commented on code in PR #10337:
URL: https://github.com/apache/iceberg/pull/10337#discussion_r1601860137


##########
core/src/main/java/org/apache/iceberg/ClientPoolImpl.java:
##########
@@ -70,37 +71,29 @@ public <R> R run(Action<R, C, E> action, boolean retry) 
throws E, InterruptedExc
     try {
       return action.run(client);
     } catch (Exception exc) {
-      if (!retry || !isConnectionException(exc)) {
-        throw exc;
+      if (retry && isConnectionException(exc)) {
+        int retryAttempts = 0;
+        while (retryAttempts < maxRetries) {
+          try {
+            client = reconnect(client);
+            return action.run(client);
+          } catch (Exception e) {
+            if (isConnectionException(e)) {
+              retryAttempts++;
+              Thread.sleep(connectionRetryWaitPeriodMs);
+            } else {
+              throw reconnectExc.cast(exc);
+            }
+          }
+        }
       }
 
-      return retryAction(action, exc, client);
-
+      throw exc;
     } finally {
       release(client);

Review Comment:
   This adds the client back to the pool. We should avoid adding a closed 
client back to the pool.



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to