Use backoff for 403 topology retries#4740
Draft
tvaron3 wants to merge 11 commits into
Draft
Conversation
Replace fixed one-second retries for multi-write 403/3 and all 403/1008 responses with exponential backoff and jitter while preserving the two-minute convergence budget. Track cumulative scheduled delay independently from generic failover retries and add coverage for growth, caps, exhaustion, and unchanged single-write 403/3 behavior. Fixes Azure#4620 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Resolve Cosmos driver conflicts while preserving RetryWith, hub-region discovery, and exponential topology backoff behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Reference the pull request implementing the topology retry policy change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Add pipeline tests for delayed hedge upgrades, future-deadline sleep capping, and dual-hedge 403/1008 fallback behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Member
Author
|
/azp run rust - cosmos - weekly |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Reduce plan_operation future sizes at client and native call sites so the workspace large-futures analysis passes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Apply the bounded exponential topology retry policy to single- and multi-write 403/3 and 403/1008 responses. Real single-write failover experiments showed the five-second budget absorbed the convergence window without surfacing application errors. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Serialize shared account refreshes safely across drivers, preserve recovery after failed or cancelled refreshes, and make hedged hub discovery deterministic across completion orders. Add strict persistent-fault, mixed-hedge, refresh-concurrency, and four-region hub-discovery regression coverage, and document routing exclusion exceptions and live experiment results. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Resolve the Cosmos driver changelog conflict while preserving the five-second topology retry policy and upstream release notes. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
Move the topology retry entry into the new unreleased driver version after the 0.6.0 release.\n\nDocument the feature-dependent account metadata cache accessor so the narrower docs-rs build remains warning-free. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: e70bf6a6-10c4-4281-bb8c-803c0847eff8
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.
Summary
403/3and all403/1008responses with exponential backoff and ±25% jitter403/3discovery path403/1008policy/status handling and deadline-bounded sleepsRetry policy
Real-account measurements
Data volume and partition count
A dedicated account was used to create fresh containers with measured physical partition counts and ~3.8 GB per partition. A real region was added and removed while the driver continuously issued point
ReadItemcalls against the region being removed. No fault injection was used.Remove-region time remained flat at ~11.2 minutes across 2–10 partitions and 8–38 GB. In all configurations the driver absorbed region removal transparently: the transition request completed successfully from the remaining region, with no topology error surfaced across 4,453 probe reads.
Reads across every physical partition
A separate single-write, two-region account used a 60K RU container with 10 measured physical ranges. Candidate logical partition keys were mapped by EPK into each range, one probe document was created per range, and the driver round-robin read all 10 probes while East US 2 was removed.
403/1008responses distributed across every partition (21–22 each)This confirms the result was not limited to repeatedly reading one logical partition.
Single-write
403/3failover A/BA dedicated single-write, two-region account was exercised with continuous
CreateItemoperations during real manual failovers.403/3403/3The service convergence window was ~4.8 seconds. The 5-second budget was the lowest tested value that still provided four total attempts (initial + three retries) and absorbed every observed failover error.
Persistent fault behavior
With persistent fault injection against every region, the final 5-second policy terminated predictably:
403/1008read403/1008surfaced403/3write403/3surfacedValidation
cargo test -p azure_data_cosmos_driver --all-features --lib(2,296 passed; 64 ignored)cargo test -p azure_data_cosmos_driver --features __internal_in_memory_emulator,fault_injection --test in_memory_emulator topology_refresh_on_substatus(15 passed)cargo test -p azure_data_cosmos_driver --features __internal_in_memory_emulator,fault_injection --test in_memory_emulator hedging(16 passed)cargo clippy -p azure_data_cosmos_driver --all-features --testscargo fmt -p azure_data_cosmos_driverFixes #4620