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-17053. ABFS: Fix Account-specific OAuth config setting parsing #2034

Merged
merged 4 commits into from
May 27, 2020

Conversation

snvijaya
Copy link
Contributor

When AuthType and Auth token provider configs are set for both generic (account-agnostic) and account-specific config, as below:
// account agnostic
fs.azure.account.auth.type=CUSTOM
fs.azure.account.oauth.provider.type=ClassExtendingCustomTokenProviderAdapter
// account specific
fs.azure.account.auth.type.account_name=OAuth
fs.azure.account.oauth.provider.type.account_name=ClassExtendingAccessTokenProvider

Effective token provider for 'account_name' is expected to be ClassExtendingAccessTokenProvider.

But currently, when the token provider class is being read from the config, account-agnostic config setting is read first in the assumption that it can serve as default if account-specific config setting is absent.
This logic leads to failure such as in above case where AuthType for account-specific and AuthType for account-agnostic are different. This is because the Interface implementing the token provider is different for various Auth Types (For Custom AuthType it is CustomTokenProviderAdapter and for OAuth it is AccessTokenProvider). This leads to a Runtime exception when trying to create the oAuth access token provider.

In this PR, getTokenProvider() is fixed to check for account-specific token provider configuration first. In its absence, account-agnostic token provider configuration is read only if account-specific and account-agnostic AuthType setting is same (otherwise expected token provider interface is different). The same logic applies while determining SAS Token provider too, hence that has been updated as well.

Testing is done with combinations of Custom and OAuth settings in account-specific and account-agnostic configs and determining which is in effect. Tested getSASTokenProvider which uses the same logic to find the effective token provider with SAS set for both account-specific and account-agnostic configs.

@snvijaya
Copy link
Contributor Author

Accounts are in East US2 region.
Non-HNS Account:
[INFO] Tests run: 65, Failures: 0, Errors: 0, Skipped: 0
[WARNING] Tests run: 436, Failures: 0, Errors: 0, Skipped: 248
[WARNING] Tests run: 206, Failures: 0, Errors: 0, Skipped: 140

HNS Account:
[INFO] Tests run: 65, Failures: 0, Errors: 0, Skipped: 0
[WARNING] Tests run: 436, Failures: 0, Errors: 0, Skipped: 74
[WARNING] Tests run: 206, Failures: 0, Errors: 0, Skipped: 140

@hadoop-yetus
Copy link

💔 -1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 0m 39s 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 19m 40s trunk passed
+1 💚 compile 0m 33s trunk passed
+1 💚 checkstyle 0m 24s trunk passed
+1 💚 mvnsite 0m 35s trunk passed
+1 💚 shadedclient 14m 46s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 28s trunk passed
+0 🆗 spotbugs 0m 51s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 0m 49s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 29s the patch passed
+1 💚 compile 0m 23s the patch passed
+1 💚 javac 0m 23s the patch passed
+1 💚 checkstyle 0m 16s the patch passed
+1 💚 mvnsite 0m 27s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 13m 37s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 24s the patch passed
-1 ❌ findbugs 0m 57s hadoop-tools/hadoop-azure generated 2 new + 0 unchanged - 0 fixed = 2 total (was 0)
_ Other Tests _
+1 💚 unit 1m 25s hadoop-azure in the patch passed.
+1 💚 asflicense 0m 31s The patch does not generate ASF License warnings.
58m 15s
Reason Tests
FindBugs module:hadoop-tools/hadoop-azure
Possible null pointer dereference of tokenProviderClass in org.apache.hadoop.fs.azurebfs.AbfsConfiguration.getTokenProviderClass(AuthType, String, Class, Class) Dereferenced at AbfsConfiguration.java:tokenProviderClass in org.apache.hadoop.fs.azurebfs.AbfsConfiguration.getTokenProviderClass(AuthType, String, Class, Class) Dereferenced at AbfsConfiguration.java:[line 353]
Redundant nullcheck of customTokenProviderClass, which is known to be non-null in org.apache.hadoop.fs.azurebfs.AbfsConfiguration.getTokenProvider() Redundant null check at AbfsConfiguration.java:is known to be non-null in org.apache.hadoop.fs.azurebfs.AbfsConfiguration.getTokenProvider() Redundant null check at AbfsConfiguration.java:[line 678]
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/1/artifact/out/Dockerfile
GITHUB PR #2034
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 87fad64479ad 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / 37b1b47
Default Java Private Build-1.8.0_252-8u252-b09-1~18.04-b09
findbugs https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/1/artifact/out/new-findbugs-hadoop-tools_hadoop-azure.html
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/1/testReport/
Max. process+thread count 475 (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-2034/1/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.

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 27m 46s 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 22m 5s trunk passed
+1 💚 compile 0m 29s trunk passed
+1 💚 checkstyle 0m 22s trunk passed
+1 💚 mvnsite 0m 32s trunk passed
+1 💚 shadedclient 16m 26s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 23s trunk passed
+0 🆗 spotbugs 0m 50s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 0m 48s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 26s the patch passed
+1 💚 compile 0m 24s the patch passed
+1 💚 javac 0m 24s the patch passed
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 mvnsite 0m 25s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 15m 21s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 22s the patch passed
+1 💚 findbugs 0m 55s the patch passed
_ Other Tests _
+1 💚 unit 1m 19s hadoop-azure in the patch passed.
+1 💚 asflicense 0m 29s The patch does not generate ASF License warnings.
90m 21s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/2/artifact/out/Dockerfile
GITHUB PR #2034
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 12ff492686ae 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / c30c23c
Default Java Private Build-1.8.0_252-8u252-b09-1~18.04-b09
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/2/testReport/
Max. process+thread count 308 (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-2034/2/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.

* @return Highest-precedence Class object that was found
*/
public <U> Class<? extends U> getClass(String name, Class<? extends U> defaultValue, Class<U> xface) {
public <U> Class<? extends U> getTokenProviderClass(AuthType authType,
Copy link
Contributor

@bilaharith bilaharith May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I could see it from the javadocs, still naming it something like authTypeForAccount could improve readability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method fetches TokenProviderClass instance based on the input AuthType. It is in sync with the naming followed by other methods that resolve account-specific config and in it's absence default to account-agnostic value. Will retain the naming.

Copy link
Contributor

@bilaharith bilaharith May 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant for the parameter currently named authType

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inputs AuthType, name of the relevant TokenProvider config key, xface (interface) are derived by the caller of getTokenProviderClass based on account-specific config settings. As it applies to all the inputs equally and is clear from the calling method's perspective, will retain the naming.

import org.apache.hadoop.conf.Configuration;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This new line can be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

Copy link
Contributor

@bilaharith bilaharith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hadoop-yetus
Copy link

🎊 +1 overall

Vote Subsystem Runtime Comment
+0 🆗 reexec 1m 9s 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 11s trunk passed
+1 💚 compile 0m 27s trunk passed
+1 💚 checkstyle 0m 22s trunk passed
+1 💚 mvnsite 0m 31s trunk passed
+1 💚 shadedclient 16m 14s branch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 23s trunk passed
+0 🆗 spotbugs 0m 51s Used deprecated FindBugs config; considering switching to SpotBugs.
+1 💚 findbugs 0m 49s trunk passed
_ Patch Compile Tests _
+1 💚 mvninstall 0m 27s the patch passed
+1 💚 compile 0m 22s the patch passed
+1 💚 javac 0m 22s the patch passed
+1 💚 checkstyle 0m 14s the patch passed
+1 💚 mvnsite 0m 24s the patch passed
+1 💚 whitespace 0m 0s The patch has no whitespace issues.
+1 💚 shadedclient 15m 25s patch has no errors when building and testing our client artifacts.
+1 💚 javadoc 0m 20s the patch passed
+1 💚 findbugs 0m 53s the patch passed
_ Other Tests _
+1 💚 unit 1m 18s hadoop-azure in the patch passed.
+1 💚 asflicense 0m 27s The patch does not generate ASF License warnings.
62m 28s
Subsystem Report/Notes
Docker ClientAPI=1.40 ServerAPI=1.40 base: https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/3/artifact/out/Dockerfile
GITHUB PR #2034
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient findbugs checkstyle
uname Linux 53fa973bce84 4.15.0-74-generic #84-Ubuntu SMP Thu Dec 19 08:06:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality personality/hadoop.sh
git revision trunk / c30c23c
Default Java Private Build-1.8.0_252-8u252-b09-1~18.04-b09
Test Results https://builds.apache.org/job/hadoop-multibranch/job/PR-2034/3/testReport/
Max. process+thread count 308 (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-2034/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.

Copy link
Contributor

@DadanielZ DadanielZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, +1

@DadanielZ DadanielZ merged commit 4c5cd75 into apache:trunk May 27, 2020
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