Ngone51 commented on code in PR #46805:
URL: https://github.com/apache/spark/pull/46805#discussion_r1644071589


##########
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/BlockStoreClient.java:
##########
@@ -190,6 +217,52 @@ public void onFailure(Throwable t) {
     }
   }
 
+  private <T> void retry(
+      final int retryCountValue,
+      final int saslRetryCountValue,
+      final int maxRetries,
+      final boolean enableSaslRetries,
+      int delayMs,
+      Supplier<CompletableFuture<T>> action,
+      CompletableFuture<T> future) {
+    action.get()
+            .thenAccept(future::complete)
+            .exceptionally(e -> {
+              int retryCount = retryCountValue;
+              int saslRetryCount = saslRetryCountValue;
+              boolean isIOException = e instanceof IOException
+                      || (e.getCause() != null && e.getCause() instanceof 
IOException);
+              boolean isSaslTimeout = enableSaslRetries && e instanceof 
SaslTimeoutException;
+              if (!isSaslTimeout && saslRetryCount > 0) {
+                Preconditions.checkState(retryCount >= saslRetryCount,
+                        "retryCount must be greater than or equal to 
saslRetryCount");
+                retryCount -= saslRetryCount;

Review Comment:
   Could you add comment to explain the relationship between `retryCount ` and 
`saslRetryCount`? I don't quite get it.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to