Skip to content

Conversation

@NaluTripician
Copy link
Contributor

Pull Request Template

Description

This pull request refactors the request handling and availability strategy implementation. The changes streamline method signatures, improve traceability, and enhance the extensibility of the availability strategy logic. Key updates include the introduction of a new SendInternalAsync method, modifications to the ExecuteAvailabilityStrategyAsync method, and updates to cross-region hedging logic.

Background

There is currently a bug in the SDK where hedging will not kick in if there is a delay for the metadata calls to the gateway that are made with every request. This is because hedging occurs after these requests are made. This PR refactors the behavior of hedging, so the metadata calls are included as part of the hedging flow. This PR also fixes a bug where cancellation tokens would not properly work for hedged write requests.

Type of change

Please delete options that are not relevant.

  • [] Bug fix (non-breaking change which fixes an issue)

Closing issues

To automatically close an issue: closes #5061

@NaluTripician NaluTripician added auto-merge Enables automation to merge PRs Hedging Any issue/feature request related to request hedging labels Apr 16, 2025
@NaluTripician NaluTripician self-assigned this Apr 16, 2025

//Send out hedged requests
for (int requestNumber = 0; requestNumber < hedgeRegions.Count; requestNumber++)
using (RequestMessage nonModifiedRequestClone = request.Clone(hedgingTrace, clonedBody))
Copy link
Member

Choose a reason for hiding this comment

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

Lets go over it together.

@dibahlfi
Copy link
Contributor

dibahlfi commented May 6, 2025

Is this a possibility?
Metadata (e.g., partition key ranges, container properties) may not be fully synchronized across regions due to eventual consistency in multi-region setups. A hedged request to a specific region might retrieve outdated or inconsistent metadata?
Hedged requests result in multiple metadata calls to different regions means more RUs cost for customer?

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

Labels

auto-merge Enables automation to merge PRs Hedging Any issue/feature request related to request hedging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Concurrent Hedging] - Write Requests Doesn't Hedge When Partition is in Quorum Loss and Cancellation Token is Provided

4 participants