-
Notifications
You must be signed in to change notification settings - Fork 537
[Internal] PPAF: Adds Partition Level Failover for Gateway Mode #5087
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kirankumarkolli
merged 10 commits into
master
from
users/kundadebdatta/4982_support_ppaf_for_gateway_mode
Apr 2, 2025
+361
−89
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7da5db9
Code changes to support gateway mode for PPAF.
kundadebdatta e3537ac
Code changes to check if resource is partitioned.
kundadebdatta 05d1578
Code changes to inject PPCB failback logic.
kundadebdatta 3289d7d
Merge branch 'master' into users/kundadebdatta/4982_support_ppaf_for_…
kundadebdatta 535d681
Code changes to fix test failures.
kundadebdatta cd2b2c3
Code changes to inject ppaf and ppcb flag into gateway store model.
kundadebdatta 7839eb3
Code changes to add integration tests for Gateway Mode.
kundadebdatta 56c50f8
Code changes to introduce a new aggressive timeout http policy for PPAF.
kundadebdatta b8c5696
Merge branch 'master' into users/kundadebdatta/4982_support_ppaf_for_…
kundadebdatta 14865e6
Merge branch 'master' into users/kundadebdatta/4982_support_ppaf_for_…
kundadebdatta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
52 changes: 52 additions & 0 deletions
52
Microsoft.Azure.Cosmos/src/HttpClient/HttpTimeoutPolicyForPartitionFailover.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| //------------------------------------------------------------ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| //------------------------------------------------------------ | ||
| namespace Microsoft.Azure.Cosmos | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Net.Http; | ||
|
|
||
| internal sealed class HttpTimeoutPolicyForPartitionFailover : HttpTimeoutPolicy | ||
| { | ||
| public static readonly HttpTimeoutPolicy Instance = new HttpTimeoutPolicyForPartitionFailover(false); | ||
| public static readonly HttpTimeoutPolicy InstanceShouldThrow503OnTimeout = new HttpTimeoutPolicyForPartitionFailover(true); | ||
| public bool shouldThrow503OnTimeout; | ||
| private static readonly string Name = nameof(HttpTimeoutPolicyDefault); | ||
|
|
||
| private HttpTimeoutPolicyForPartitionFailover(bool shouldThrow503OnTimeout) | ||
| { | ||
| this.shouldThrow503OnTimeout = shouldThrow503OnTimeout; | ||
| } | ||
|
|
||
| private readonly IReadOnlyList<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> TimeoutsAndDelays = new List<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)>() | ||
| { | ||
| (TimeSpan.FromSeconds(.5), TimeSpan.Zero), | ||
| (TimeSpan.FromSeconds(.5), TimeSpan.Zero), | ||
| (TimeSpan.FromSeconds(1), TimeSpan.Zero), | ||
| }; | ||
|
|
||
| public override string TimeoutPolicyName => HttpTimeoutPolicyForPartitionFailover.Name; | ||
|
|
||
| public override int TotalRetryCount => this.TimeoutsAndDelays.Count; | ||
|
|
||
| public override IEnumerator<(TimeSpan requestTimeout, TimeSpan delayForNextRequest)> GetTimeoutEnumerator() | ||
| { | ||
| return this.TimeoutsAndDelays.GetEnumerator(); | ||
| } | ||
|
|
||
| // Assume that it is not safe to retry unless it is a get method. | ||
| // Create and other operations could have succeeded even though a timeout occurred. | ||
| public override bool IsSafeToRetry(HttpMethod httpMethod) | ||
| { | ||
| return httpMethod == HttpMethod.Get; | ||
| } | ||
|
|
||
| public override bool ShouldRetryBasedOnResponse(HttpMethod requestHttpMethod, HttpResponseMessage responseMessage) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| public override bool ShouldThrow503OnTimeout => this.shouldThrow503OnTimeout; | ||
| } | ||
| } |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.