pranavsaxena-microsoft commented on code in PR #5299:
URL: https://github.com/apache/hadoop/pull/5299#discussion_r1070242650
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/RetryReason.java:
##########
@@ -0,0 +1,128 @@
+package org.apache.hadoop.fs.azurebfs.services;
+
+import java.io.IOException;
+import java.net.SocketException;
+import java.util.ArrayList;
+import java.util.List;
+
+public enum RetryReason {
+ CONNECTION_TIMEOUT(((exceptionCaptured, statusCode) -> {
+ return exceptionCaptured != null && "connect timed out".equalsIgnoreCase(
+ exceptionCaptured.getMessage());
+ }), 2, "CT"),
+ READ_TIMEOUT(((exceptionCaptured, statusCode) -> {
+ return exceptionCaptured != null && "Read timed out".equalsIgnoreCase(
+ exceptionCaptured.getMessage());
+ }), 2, "RT"),
+ UNKNOWN_HOST("UH"),
+ CONNECTION_RESET(((exceptionCaptured, statusCode) -> {
+ return exceptionCaptured != null && exceptionCaptured.getMessage() != null
+ && exceptionCaptured.getMessage().contains("Connection reset");
+ }), 2, "CR"),
+ STATUS_5XX(((exceptionCaptured, statusCode) -> {
+ return statusCode / 100 == 5;
+ }), 0, ((ex, statusCode, serverErrorMessage) -> {
+ if (statusCode == 503) {
+ //ref:
https://github.com/apache/hadoop/pull/4564/files#diff-75a2f54df6618d4015c63812e6a9916ddfb475d246850edfd2a6f57e36805e79
+ serverErrorMessage = serverErrorMessage.split(System.lineSeparator(),
+ 2)[0];
+ if ("Ingress is over the account limit.".equalsIgnoreCase(
+ serverErrorMessage)) {
+ return "ING";
+ }
+ if ("Egress is over the account limit.".equalsIgnoreCase(
+ serverErrorMessage)) {
+ return "EGR";
+ }
+ if ("Operations per second is over the account limit.".equalsIgnoreCase(
+ serverErrorMessage)) {
+ return "OPR";
+ }
+ return "503";
+ }
+ return statusCode + "";
+ })),
+ STATUS_4XX(((exceptionCaptured, statusCode) -> {
+ return statusCode / 100 == 4;
+ }), 0, ((ex, statusCode, serverErrorMessage) -> {
+ return statusCode + "";
+ })),
+ UNKNOWN_SOCKET_EXCEPTION(((exceptionCaptured, statusCode) -> {
+ return exceptionCaptured instanceof SocketException;
+ }), 1, "SE"),
+ UNKNOWN_IO_EXCEPTION(((exceptionCaptured, statusCode) -> {
+ return exceptionCaptured instanceof IOException;
+ }), 0, "IOE");
+
+ private RetryReasonCaptureMechanism mechanism = null;
Review Comment:
Have made this class simpler by having only one constructor and all enums
implementing only one interface.
##########
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/utils/TracingContext.java:
##########
@@ -174,6 +181,14 @@ public void constructHeader(AbfsHttpOperation
httpOperation) {
httpOperation.setRequestProperty(HttpHeaderConfigurations.X_MS_CLIENT_REQUEST_ID,
header);
}
+ private String addFailureReasons(final String header,
+ final String previousFailure) {
+ if(previousFailure == null) {
Review Comment:
Done.
--
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]