Repository navigation
Core: Bound Idempotency-Key retries to the advertised key lifetime - #18070
Merged
Merged
Conversation
HotSushi
force-pushed
the
idempotency-key-expiry
branch
2 times, most recently
from
September 17, 2026 17:16
e29c318 to
ed0d254
Compare
HotSushi
marked this pull request as ready for review
September 17, 2026 17:29
huaxingao
reviewed
Sep 18, 2026
HotSushi
force-pushed
the
idempotency-key-expiry
branch
5 times, most recently
from
September 18, 2026 21:25
284acf2 to
602595b
Compare
huaxingao
reviewed
Sep 19, 2026
HotSushi
force-pushed
the
idempotency-key-expiry
branch
from
September 21, 2026 23:29
602595b to
66d4eab
Compare
huaxingao
reviewed
Sep 22, 2026
HotSushi
force-pushed
the
idempotency-key-expiry
branch
from
September 22, 2026 17:15
66d4eab to
3461331
Compare
Contributor
|
cc @flyrain |
Auto-retrying a keyed mutation could previously fire after the server's advertised Idempotency-Key lifetime elapsed, at which point the server no longer dedupes the key and could apply the mutation twice. This records when a request is first sent (in HTTPClient.execute) and, for requests carrying an Idempotency-Key, declines a retry once the elapsed time since the first attempt plus the next retry interval would reach the advertised lifetime. The lifetime from GET /v1/config is plumbed through the client properties into ExponentialHttpRequestRetryStrategy; a non-positive window declines all keyed retries, while an absent or unparseable one leaves the bound disabled. The check applies to the response and network-exception retry paths; non-keyed and idempotent requests are unaffected. Per Yufei's review, the check compares against the upper bound of the next retry interval (Retry-After verbatim, or exponential backoff plus its maximum jitter) rather than a freshly sampled value, so a retry the check permits cannot then sleep longer than checked and overshoot the window.
HotSushi
force-pushed
the
idempotency-key-expiry
branch
from
September 25, 2026 21:12
3461331 to
0509fd2
Compare
huaxingao
approved these changes
Sep 29, 2026
Contributor
|
Thanks @HotSushi for the PR! |
This was referenced Nov 5, 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.
What / Why
Follow-up to #17947 (client-side Idempotency-Key retries). #17947 auto-retries keyed POSTs on retriable errors but never honors the server-advertised key lifetime, so a slow retry can fire after the key has expired — when the server no longer dedupes — risking a duplicate mutation.
The REST spec obligation on the client:
Change
ExponentialHttpRequestRetryStrategynow accepts the advertised key lifetime and declines a retry for a keyed request once the elapsed time since the first attempt plus the next retry interval would reach the lifetime window. Enforced on both the response and network-exception retry paths; non-keyed / idempotent requests are unaffected.GET /v1/config(ISO-8601, e.g.PT30M) is plumbed to the HTTP client through the client properties and parsed once inHTTPClient; a malformed value is ignored (disables enforcement) rather than failing client construction.isRetrySafe(...)predicate to remove duplication between the two retry paths (addresses a review nit; also clarifies that "retry-safe" is not the same as strictly idempotent).Tests
Added unit tests in
TestExponentialHttpRequestRetryStrategy: keyed retry abandoned once the window is exceeded (both response and network-exception paths), keyed retry honored within the window and when no lifetime is advertised, and an idempotent GET unaffected by the key lifetime.:iceberg-corerest.*tests pass locally.Notes