Skip to content

[Feature] New retries codegen changes#3849

Open
kai-ion wants to merge 4 commits into
mainfrom
new-retry
Open

[Feature] New retries codegen changes#3849
kai-ion wants to merge 4 commits into
mainfrom
new-retry

Conversation

@kai-ion

@kai-ion kai-ion commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Issue #, if available:

Description of changes:
Implement Retry Behavior 2.1 core logic gated behind AWS_NEW_RETRIES_2026

Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Error-type-aware backoff: throttle=1s base, transient=50ms base
- Updated token costs: transient=14, throttle=5
- x-amz-retry-after header parsing with clamping
- DynamoDB/DynamoDB Streams tuning: 25ms transient base, 4 max attempts
- Long-polling backoff delay via IsLongPollingOperation() on request
- Default retry mode set to "standard" when gate active
- Service-specific tuning gated (maxAttempts/backoff only apply when gate on)
- Shared LongPollingRetryHelper to eliminate duplication between client paths
this->configFactories.retryStrategyCreateFn = []() -> std::shared_ptr<Client::RetryStrategy> {
return Client::InitRetryStrategy(4, "", 0.025);
};
#if defined(_MSC_VER)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

So this codegen is from a preexisting codegen template that funnily, I had added, PR. All we did in this PR was add dynamodbstreams to the codegen path.

if (Aws::Utils::StringUtils::ToLower(Aws::Environment::GetEnv("AWS_NEW_RETRIES_2026").c_str()) != "true")
{
// Gate is off: ignore service-specific tuning, use default behavior
return InitRetryStrategy(-1, retryMode);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why -1 ? why not call the constructor that just takes the retry mode?

const std::shared_ptr<RetryStrategy>& retryStrategy,
bool isLongPollingOperation)
{
if (!isLongPollingOperation) return 0;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit 4 if statements after one another is kind of weird, why not

if (!isLongPollingOperation &&
  !error.ShouldRetry() &&
  retries + 1 >= retryStrategy->GetMaxAttempts()) {
 return 0;
}


if (!retryWithCorrectRegion && !m_retryStrategy->ShouldRetry(outcome.GetError(), retries))
{
long lpSleepMs = Internal::ComputeLongPollingSleepMs(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

think we need to gate this with the env var too

return InitRetryStrategy(maxAttempts, retryMode);
}

long attempts = (maxAttempts < 0) ? 3 : static_cast<long>(maxAttempts);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lets just pass down max attempts, ifs negative we shouldnt check for the invariant this high in the call path

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.

2 participants