Skip to content

HDDS-17316. Cap the wait between retries when loading the initial secret key from SCM - #11696

Draft
smengcl wants to merge 2 commits into
apache:masterfrom
smengcl:HDDS-17316
Draft

smengcl wants to merge 2 commits into
apache:masterfrom
smengcl:HDDS-17316

Conversation

@smengcl

@smengcl smengcl commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Generated-by: Claude Code (Opus 5.5)

What changes were proposed in this pull request?

At startup, OM and datanode load the current secret key from SCM in DefaultSecretKeySignerClient.loadInitialSecretKey. While SCM has not initialized secret keys yet, it makes up to 100 attempts with exponential backoff that restarts every 10 retries. The base wait goes 4s, 8s, ..., 1024s, then 2s, randomized by +/-50%, so a single wait can be up to about 25 minutes (about 5.7 hours in total). So after SCM initializes its keys, an OM or datanode can stay stuck for many more minutes before it tries again.

This change keeps the exponential backoff but caps the base wait at 16s (4s, 8s, 16s, 16s, ...). A single wait is at most 23s, and the total for 100 attempts is around 26 minutes. The retry policy moves to a package-private method so it can be tested, and the code comment now matches the actual wait times.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-17316

How was this patch tested?

Added TestDefaultSecretKeyClient#initialSecretKeyRetryWaitIsCapped, which checks that every wait grows as expected and stays within 23s, and that other errors and the attempt after the last retry fail. It fails without the fix.

🤖 Generated with Claude Code

…ret key from SCM

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings October 22, 2026 10:47
@smengcl smengcl added the AI-gen label Oct 22, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adoroszlai
adoroszlai requested a review from ChenSammi October 24, 2026 14:12

@adoroszlai adoroszlai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @smengcl for the patch.

import static org.apache.hadoop.io.retry.RetryPolicy.RetryAction.FAIL;
import static org.apache.hadoop.io_.retry.RetryPolicies.exponentialBackoffRetry;

import com.google.common.annotations.VisibleForTesting;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: please don't add new @VisibleForTesting annotations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants