-
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-17129. Validating storage keys in ABFS correctly #2141
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.
core good; but we need to report that error all the way up
try { | ||
validateStorageAccountKey(key); | ||
} catch (InvalidConfigurationValueException e) { | ||
e.printStackTrace(); |
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.
Throw it; we want to fail fast rather than wait for auth failures talking to the far end.
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.
Will it be fine to surround the throw new InvalidConfigurationValueException()
with one more try-catch block? Since adding an exception to the method would break a test already present.
Also, inside validateStorageAccountKey() we are throwing an InvalidConfigurationValueException() in the validate() method.
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.
Just throw KeyProviderException like it is done in line 49. Or better to call validateStorageAccountKey() just after L48 only so that you don't have to try and catch separately.
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.
I tried to place at L48 as well in the beginning but a test was getting broken, I found at that it expects a certain exception, it passes a null key, which makes the validate() method throw a different error. I think by adding a condition in the catch to throw that particular error if the key is null might solve this. So, I'll be changing it in the next commit.
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.
don't worry about breaking the test, we've moved the vaildation and should expect it. Instead the test will need to handle the way invalid configurations are raised.
Or go with mukund -just make sure that the wrapping exception uses the message of the caught exception and adds it as the cause
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.
Yes, I think the test is fine, I just needed to throw this specific exception when the config value is null which this test is trying to achieve, so I'll throw the exception when it is null else, it'll be like it always has been.
...ols/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/SimpleKeyProvider.java
Show resolved
Hide resolved
Committed 10 mins ago, but can't see the commit here. Is this a known problem? |
you pushed it up? |
Yes, I can see the commit on my branch, not sure why it's not showing here. |
Because only for the case where key == null we have to throw this specific Exception, else we can throw the other Exceptions. |
It seems like the commit is visible now. |
mehakmeet@c5ab869 |
💔 -1 overall
This message was automatically generated. |
LGTM now. |
LGTM |
Contributed by Mehakmeet Singh Change-Id: I8016ee2f9ffbc86ea867f4a3d960b134e507d099
Storage Keys in ABFS should be validated after the keys have been loaded.
work:
Tested by: mvn -T 1C -Dparallel-tests=abfs clean verify
Region: East US, West US.
No tests are required as there are tests already present to validate the patch.