You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[INTERNAL] SessionRetry: Adds support to yield immediately after the original attempt when READ_SESSION_NOT_AVAILABLE error is thrown (#5201)
Exposing MaxInRegionRetryCount variable internally so that if it has
value of 0 or less than 0 we will not do any retry/delay and yield
immediately for READ_SESSION_NOT_AVAILABLE error from the
SessionTokenMismtatchInternalRetry policy.
[SessionRetryEarlyYield.json](https://github.com/user-attachments/files/20229840/SessionRetryEarlyYield.json)
---------
Co-authored-by: Kiran Kumar Kolli <kirankk@microsoft.com>
Copy file name to clipboardExpand all lines: Microsoft.Azure.Cosmos/src/SessionRetryOptions.cs
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -25,13 +25,13 @@ public SessionRetryOptions()
25
25
/// The minimum value is 100ms - this minimum is enforced to provide a way for the local region to catch-up on replication lag. The default value is 500ms - as a recommendation ensure that this value is higher than the steady-state
26
26
/// replication latency between the regions you chose
/// Sets the maximum number of retries within each region for read and write operations. The minimum value is 1 - the backoff time for the last in-region retry will ensure that the total retry time within the
32
32
/// region is at least the min. in-region retry time.
33
33
/// </summary>
34
-
publicintMaxInRegionRetryCount{get;privateset;}
34
+
publicintMaxInRegionRetryCount{get;set;}
35
35
36
36
/// <summary>
37
37
/// hints which guide SDK-internal retry policies on how early to switch retries to a different region. If true, will retry all replicas once and add a minimum delay before switching to the next region.If false, it will
Copy file name to clipboardExpand all lines: Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SessionRetryOptionsTest.cs
+68Lines changed: 68 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,74 @@ public async Task TestInitAsync()
34
34
Assert.IsTrue(this.writeRegionMap.Count()>=2);
35
35
36
36
}
37
+
38
+
[TestMethod]
39
+
[DataRow(FaultInjectionOperationType.ReadItem,DisplayName="No retries for ReadItem when MaxInRegionRetryCount is 0 and EnableRemoteRegionPreferredForSessionRetry is true")]
40
+
[DataRow(FaultInjectionOperationType.QueryItem,DisplayName="No retries for QueryItem when MaxInRegionRetryCount is 0 and and EnableRemoteRegionPreferredForSessionRetry is true")]
// Assert that only the original attempt happened (no retries)
99
+
longhitCount=badSessionTokenRule.GetHitCount();
100
+
Assert.AreEqual(4,hitCount,$"There should be only one attempt (no retries) for {faultInjectionOperationType} when MaxInRegionRetryCount is 0 and RemotePreferredRegion is set to true.");
101
+
}
102
+
103
+
}
104
+
37
105
[TestMethod]
38
106
[DataRow(FaultInjectionOperationType.ReadItem,2,true,DisplayName="Validate Read Item operation with remote region preferred.")]
39
107
[DataRow(FaultInjectionOperationType.QueryItem,1,true,DisplayName="Validate Query Item operation with remote region preferred.")]
0 commit comments