-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HADOOP-19393. ABFS: Returning FileAlreadyExists Exception for UnauthorizedBlobOverwrite Rename Errors #7312
base: trunk
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one comment on exception string. Please check.
@@ -613,6 +615,11 @@ public AbfsClientRenameResult renamePath( | |||
throw e; | |||
} | |||
|
|||
if(op.getResult().getStorageErrorCode() | |||
.equals(UNAUTHORIZED_BLOB_OVERWRITE.getErrorCode())){ | |||
throw new FileAlreadyExistsException("File already exists." ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error string should be "File already exists or request not authorized for blob overrides", as this can happen when destination already exists or if SAS is missing "m".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Taken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we're observing other 403 errors with mismatching SAS tokens/invalid permissions. We see UNAUTHORIZED_BLOB_OVERWRITE only with rename overwrites. Making changes accordingly.
💔 -1 overall
This message was automatically generated. |
Aggregated Test Results ============================================================
|
🎊 +1 overall
This message was automatically generated. |
e5d0c97
to
401052c
Compare
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments.
Did the test case replicate the problem before the fix was applied?
@@ -613,6 +615,11 @@ public AbfsClientRenameResult renamePath( | |||
throw e; | |||
} | |||
|
|||
if(op.getResult().getStorageErrorCode() | |||
.equals(UNAUTHORIZED_BLOB_OVERWRITE.getErrorCode())){ | |||
throw new FileAlreadyExistsException("File already exists."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment explaining why, e.g
Write permission checks can happen before probes for validity
of the operation -if there is a path at the destination
it may be rejected with a authorization failure.
Catch and translate. See HADOOP-19393.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the same.
touch(src); | ||
touch(dest); | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use LambdaTestUtils.intercept, e.g
intercept(FileAlreadyExistsException.class, () -> fs.rename(src, dest));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
@@ -58,7 +58,8 @@ public enum AzureServiceErrorCode { | |||
ACCOUNT_REQUIRES_HTTPS("AccountRequiresHttps", HttpURLConnection.HTTP_BAD_REQUEST, null), | |||
MD5_MISMATCH("Md5Mismatch", HttpURLConnection.HTTP_BAD_REQUEST, | |||
"The MD5 value specified in the request did not match with the MD5 value calculated by the server."), | |||
UNKNOWN(null, -1, null); | |||
UNKNOWN(null, -1, null), | |||
UNAUTHORIZED_BLOB_OVERWRITE("UnauthorizedBlobOverwrite", HttpURLConnection.HTTP_FORBIDDEN, "This request is not authorized to perform blob overwrites."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: split the line with the text on the line below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
@@ -58,7 +58,8 @@ public enum AzureServiceErrorCode { | |||
ACCOUNT_REQUIRES_HTTPS("AccountRequiresHttps", HttpURLConnection.HTTP_BAD_REQUEST, null), | |||
MD5_MISMATCH("Md5Mismatch", HttpURLConnection.HTTP_BAD_REQUEST, | |||
"The MD5 value specified in the request did not match with the MD5 value calculated by the server."), | |||
UNKNOWN(null, -1, null); | |||
UNKNOWN(null, -1, null), | |||
UNAUTHORIZED_BLOB_OVERWRITE("UnauthorizedBlobOverwrite", HttpURLConnection.HTTP_FORBIDDEN, "This request is not authorized to perform blob overwrites."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: It would be better to move it above Unknown or add with other 403 errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken
fs.rename(src, dest); | ||
Assertions.fail("Exception expected on rename overwrites."); | ||
} catch (FileAlreadyExistsException e) { | ||
Assertions.assertThat(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: add a description for assert failures here and anywhere else you are using Assertions. Something like this.
Assertions.assertThat(e).describedAs("FileAlreadyExistsException was expected").isInstaceOf();
e339293
to
001e137
Compare
Yes, the problem was reproduced before applying the fix. |
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
I should add, +1 pending those suggested changes and the (trivial) checkstyle fix. No problems with the actual code itself. |
🎊 +1 overall
This message was automatically generated. |
Description of PR
JIRA: https://issues.apache.org/jira/browse/HADOOP-19393
ABFS driver adheres to Hadoop's expectations which does not allow rename blob overwrites. Recently we came across the case where UnauthorizedBlobOverwrite error (HTTP 403- Access Denied Exception) is thrown for rename overwrites (with SAS authentication).
Remapping this error to FileAlreadyExists exception for better understanding.
Adding the test results in comments below.
The one test failure present is intermittent and has been brought up here: https://issues.apache.org/jira/browse/HADOOP-19213