Commit 0411701
PPAF: Fixes issue where setting
# Pull Request Template
## Description
This pull request improves the handling of invalid request timeout
values in the Cosmos client and adds a new integration test to verify
the behavior. The main focus is ensuring that when a request timeout of
0ms is set, the client falls back to a safe default for hedging
thresholds, preventing potential issues with failover strategies.
**Partition-level failover and hedging logic improvements:**
* Updated `InitializePartitionLevelFailoverWithDefaultHedging` in
`DocumentClient.cs` to check if `RequestTimeout` is set to 0ms, and if
so, fallback to `DefaultHedgingThresholdInMilliseconds` and log a
warning. This prevents invalid timeout values from causing issues with
availability strategies.
**Testing and validation:**
* Added a new test method `ClinetOverrides0msRequestTimeoutValueForPPAF`
in `CosmosItemIntegrationTests.cs` to verify that when the client is
configured with a 0ms request timeout, the hedging threshold is not set
to 0, ensuring the fallback logic works as intended. The test also
intercepts gateway responses to simulate specific conditions.
## 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 #5430
---------
Co-authored-by: Debdatta Kunda <[email protected]>RequestTimeout to 0 second will cause PPAF dynamic enablement to break (#5427)1 parent ce446d2 commit 0411701
File tree
2 files changed
+78
-3
lines changed- Microsoft.Azure.Cosmos
- src
- tests/Microsoft.Azure.Cosmos.EmulatorTests
2 files changed
+78
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6863 | 6863 | | |
6864 | 6864 | | |
6865 | 6865 | | |
6866 | | - | |
6867 | | - | |
6868 | | - | |
| 6866 | + | |
| 6867 | + | |
| 6868 | + | |
| 6869 | + | |
| 6870 | + | |
| 6871 | + | |
| 6872 | + | |
| 6873 | + | |
| 6874 | + | |
| 6875 | + | |
| 6876 | + | |
| 6877 | + | |
| 6878 | + | |
| 6879 | + | |
6869 | 6880 | | |
6870 | 6881 | | |
6871 | 6882 | | |
| |||
Lines changed: 64 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2195 | 2195 | | |
2196 | 2196 | | |
2197 | 2197 | | |
| 2198 | + | |
| 2199 | + | |
| 2200 | + | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
2198 | 2262 | | |
2199 | 2263 | | |
2200 | 2264 | | |
| |||
0 commit comments