Skip to content
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

Merged
merged 3 commits into from
Jul 16, 2020

Conversation

mehakmeet
Copy link
Contributor

@mehakmeet mehakmeet commented Jul 15, 2020

Storage Keys in ABFS should be validated after the keys have been loaded.

work:

  • Remove the previous validation of storage keys.
  • Validate at the correct place.

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.

Copy link
Contributor

@steveloughran steveloughran left a 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();
Copy link
Contributor

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.

Copy link
Contributor Author

@mehakmeet mehakmeet Jul 15, 2020

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@steveloughran steveloughran Jul 15, 2020

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

Copy link
Contributor Author

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.

@mehakmeet
Copy link
Contributor Author

Committed 10 mins ago, but can't see the commit here. Is this a known problem?

@steveloughran
Copy link
Contributor

you pushed it up?

@mehakmeet
Copy link
Contributor Author

Yes, I can see the commit on my branch, not sure why it's not showing here.

@mehakmeet
Copy link
Contributor Author

Just catch and throw. Why do you need to check again for key==null

Because only for the case where key == null we have to throw this specific Exception, else we can throw the other Exceptions.

@mehakmeet
Copy link
Contributor Author

mehakmeet commented Jul 15, 2020

It seems like the commit is visible now.

@mehakmeet
Copy link
Contributor Author

mehakmeet@c5ab869
3rd commit. Don't know why it's not visible here.

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 8s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 21m 21s trunk passed
+1 💚 compile 0m 33s trunk passed with JDK Ubuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04
+1 💚 compile 0m 29s trunk passed with JDK Private Build-1.8.0_252-8u252-b09-1~18.04-b09
+1 💚 checkstyle 0m 20s trunk passed
+1 💚 mvnsite 0m 32s trunk passed
+1 💚 shadedclient 16m 24s branch has no errors when building and testing our client artifacts.
-1 ❌ javadoc 0m 26s hadoop-azure in trunk failed with JDK Ubuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04.
+1 💚 javadoc 0m 24s trunk passed with JDK Private Build-1.8.0_252-8u252-b09-1~18.04-b09
+0 🆗 spotbugs 0m 58s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 0m 56s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 30s the patch passed
+1 💚 compile 0m 29s the patch passed with JDK Ubuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04
+1 💚 javac 0m 29s the patch passed
+1 💚 compile 0m 24s the patch passed with JDK Private Build-1.8.0_252-8u252-b09-1~18.04-b09
+1 💚 javac 0m 24s the patch passed
+1 💚 checkstyle 0m 15s the patch passed
+1 💚 mvnsite 0m 26s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 15m 19s patch has no errors when building and testing our client artifacts.
-1 ❌ javadoc 0m 22s hadoop-azure in the patch failed with JDK Ubuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04.
+1 💚 javadoc 0m 20s the patch passed with JDK Private Build-1.8.0_252-8u252-b09-1~18.04-b09
+1 💚 findbugs 0m 58s the patch passed
_ Other Tests _
+1 💚 unit 1m 26s hadoop-azure in the patch passed.
+1 💚 asflicense 0m 29s The patch does not generate ASF License warnings.
65m 29s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-2141/3/artifact/out/Dockerfile
GITHUB PR #2141
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux e8f2b962491e 4.15.0-101-generic #102-Ubuntu SMP Mon May 11 10:07:26 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 1f71c4a
Default Java Private Build-1.8.0_252-8u252-b09-1~18.04-b09
Multi-JDK versions /usr/lib/jvm/java-11-openjdk-amd64:Ubuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04 /usr/lib/jvm/java-8-openjdk-amd64:Private Build-1.8.0_252-8u252-b09-1~18.04-b09
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-2141/3/artifact/out/branch-javadoc-hadoop-tools_hadoop-azure-jdkUbuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04.txt
javadoc https://builds.apache.org/job/hadoop-multibranch/job/PR-2141/3/artifact/out/patch-javadoc-hadoop-tools_hadoop-azure-jdkUbuntu-11.0.7+10-post-Ubuntu-2ubuntu218.04.txt
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-2141/3/testReport/
Max. process+thread count 320 (vs. ulimit of 5500)
modules C: hadoop-tools/hadoop-azure U: hadoop-tools/hadoop-azure
Console output https://builds.apache.org/job/hadoop-multibranch/job/PR-2141/3/console
versions git=2.17.1 maven=3.6.0 findbugs=3.1.0-RC1
Powered by Apache Yetus 0.12.0 https://yetus.apache.org

This message was automatically generated.

@mukund-thakur
Copy link
Contributor

LGTM now.

@apache apache deleted a comment from hadoop-yetus Jul 16, 2020
@apache apache deleted a comment from hadoop-yetus Jul 16, 2020
@steveloughran
Copy link
Contributor

LGTM
+1: merging to trunk and 3.3

@steveloughran steveloughran merged commit 4083fd5 into apache:trunk Jul 16, 2020
asfgit pushed a commit that referenced this pull request Jul 16, 2020
Contributed by Mehakmeet Singh

Change-Id: I8016ee2f9ffbc86ea867f4a3d960b134e507d099
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants