DadanielZ commented on a change in pull request #1923: Hadoop 16857: Stop
CustomTokenProvider retry logic to depend on AbfsRestOp retry policy
URL: https://github.com/apache/hadoop/pull/1923#discussion_r405289808
##########
File path:
hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/oauth2/CustomTokenProviderAdapter.java
##########
@@ -46,16 +48,53 @@
*
* @param adaptee the custom token provider
*/
- public CustomTokenProviderAdapter(CustomTokenProviderAdaptee adaptee) {
+ public CustomTokenProviderAdapter(CustomTokenProviderAdaptee adaptee, int
customTokenFetchRetryCount) {
Preconditions.checkNotNull(adaptee, "adaptee");
this.adaptee = adaptee;
+ fetchTokenRetryCount = customTokenFetchRetryCount;
}
protected AzureADToken refreshToken() throws IOException {
LOG.debug("AADToken: refreshing custom based token");
AzureADToken azureADToken = new AzureADToken();
- azureADToken.setAccessToken(adaptee.getAccessToken());
+
+ String accessToken = null;
+
+ Exception ex;
+ boolean succeeded = false;
+ // Custom token providers should have their own retry policies,
+ // Providing a linear retry option for the the retry count
+ // mentioned in config "fs.azure.custom.token.fetch.retry.count"
+ int retryCount = fetchTokenRetryCount;
+ do {
+ ex = null;
+ try {
+ accessToken = adaptee.getAccessToken();
+ LOG.trace("CustomTokenProvider Access token fetch was successful with
retry count {}", retryCount);
Review comment:
Is it necessary to add trace log here? it affects the perf for all
rereshToken requests including those succeed without retry.
And the `retryCount` in the message is confusing, the total times of
retries that have been executed should be `fetchTokenRetryCount - retryCount`,
same for the msg in the `catch` block.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]