fivetran-rahulprakash commented on code in PR #3113:
URL: https://github.com/apache/polaris/pull/3113#discussion_r2554767895


##########
polaris-core/src/main/java/org/apache/polaris/core/storage/azure/AzureCredentialsStorageIntegration.java:
##########
@@ -312,16 +314,83 @@ private void validateAccountAndContainer(
         });
   }
 
+  /**
+   * Fetches an Azure access token with timeout and retry logic to handle 
transient failures.
+   *
+   * <p>This method implements a defensive strategy against slow or failing 
token requests:
+   *
+   * <ul>
+   *   <li>15-second timeout per individual request attempt
+   *   <li>Exponential backoff retry (3 attempts: 2s, 4s, 8s) with 50% jitter
+   *   <li>90-second overall timeout as a safety net
+   * </ul>
+   *
+   * @param tenantId the Azure tenant ID
+   * @return the access token
+   * @throws RuntimeException if token fetch fails after all retries or times 
out
+   */
   private AccessToken getAccessToken(String tenantId) {
     String scope = "https://storage.azure.com/.default";;
     AccessToken accessToken =
         defaultAzureCredential
             .getToken(new 
TokenRequestContext().addScopes(scope).setTenantId(tenantId))
-            .blockOptional()
+            .timeout(Duration.ofSeconds(15)) // Per-attempt timeout

Review Comment:
   I've added four new configuration constants in FeatureConfiguration:
   `CLOUD_API_TIMEOUT_SECONDS` (default: 15) - Per-attempt timeout
   `CLOUD_API_RETRY_COUNT` (default: 3) - Number of retry attempts
   `CLOUD_API_RETRY_DELAY_SECONDS` (default: 2) - Initial delay for exponential 
backoff
   `CLOUD_API_RETRY_JITTER_MILLIS `(default: 500) - Maximum jitter to prevent 
thundering herd
   These use generic naming (CLOUD_API_*) rather than Azure-specific names, 
making them reusable for future  implementations.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to