Repository navigation
bugfix: DynamoDB retry defaults on the opt-in path - #3368
Merged
Merged
Conversation
Alan4506
force-pushed
the
retries-ddb-defaults
branch
from
October 8, 2026 05:57
a3df1be to
943a6fe
Compare
stobrien89
requested changes
Oct 8, 2026
stobrien89
approved these changes
Oct 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
The announcement says when
AWS_NEW_RETRIES_2026=trueis set, DynamoDB and DynamoDB Streams use 11 attempts in legacy mode and 4 in standard mode. However, whenmax_attemptsis not set explicitly, both clients get the wrong counts:AWS_NEW_RETRIES_2026=true, nomax_attemptsAWS_RETRY_MODE=legacyAWS_RETRY_MODE=standard/adaptive'retries' => ['mode' => 'standard'/'adaptive']AWS_RETRY_MODE=legacyAWS_RETRY_MODEunset or=standardThree causes, one fix each:
Mode from env / shared config. DynamoDbClient::_defaultRetries() reads the mode through ConfigurationProvider::env() and ini(). When
max_attemptsisn't set, those providers fill in the generic 3, and_defaultRetries()can't tell that 3 apart from a user-supplied 3, so it never applies the DynamoDB value.Fix: after the providers resolve,
_defaultRetries()checksAWS_MAX_ATTEMPTS/max_attemptsdirectly viaConfigurationResolver::resolve(). If neither is set, it replaces the attempt count with 11 (legacy) or 4 (standard / adaptive) for the resolved mode.Mode from the client
retriesarray. DynamoDbClient::_applyRetryConfig() gets its config from ConfigurationProvider::unwrap(), which fills in 3 for an array withoutmax_attempts. The legacy branch already corrects this to 11 in resolveLegacyModeMaxRetries(); the standard / adaptive branch didn't.Fix: a sibling
resolveStandardModeConfig()applies the same check (flag on, array config, nomax_attempts) and returns a config with 4.DynamoDB Streams ignores the flag. DynamoDbStreamsClient hardcodes
retries.default = 11with no opt-in check, so a Streams client with noretriesoption always builds the legacy middleware and never reads env / shared config.Fix:
DynamoDbStreamsClientnow picksretries.defaultthe same way DynamoDbClient does:DynamoDbClient::_defaultRetrieswhen the flag is on,11when it is off.Testing:
tests/Retry/V3/RoutingTest.php: 6 new cases fail without the source changes; 24/24 pass with them. Full unit test suite also passes.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.