Skip to content

Conversation

@NaluTripician
Copy link
Contributor

@NaluTripician NaluTripician commented Sep 30, 2025

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

kundadebdatta
kundadebdatta previously approved these changes Oct 1, 2025
Copy link
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM

@kundadebdatta kundadebdatta changed the title PPAD: Fixes issue where setting RequestTimeout to 0 seconds will cause PPAF dynamic enablement to break PPAF: Fixes issue where setting RequestTimeout to 0 second will cause PPAF dynamic enablement to break Oct 1, 2025
kundadebdatta
kundadebdatta previously approved these changes Oct 1, 2025
Copy link
Member

@kundadebdatta kundadebdatta left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@FabianMeiswinkel FabianMeiswinkel left a comment

Choose a reason for hiding this comment

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

LGTM-Thx

@microsoft-github-policy-service microsoft-github-policy-service bot merged commit 895697d into master Oct 1, 2025
27 checks passed
@microsoft-github-policy-service microsoft-github-policy-service bot deleted the users/nalutripician/ppaf_with_0s_requestTimeout-fix branch October 1, 2025 22:46
NaluTripician added a commit that referenced this pull request Oct 7, 2025
…ause PPAF dynamic enablement to break (#5427)

# 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]>
NaluTripician added a commit that referenced this pull request Oct 7, 2025
…ause PPAF dynamic enablement to break (#5427)

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.

Please delete options that are not relevant.

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

To automatically close an issue: closes #5430

---------

Co-authored-by: Debdatta Kunda <[email protected]>
NaluTripician added a commit that referenced this pull request Oct 7, 2025
…ause PPAF dynamic enablement to break (#5427)

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.

Please delete options that are not relevant.

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

To automatically close an issue: closes #5430

---------

Co-authored-by: Debdatta Kunda <[email protected]>
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 PerPartitionAutomaticFailover

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Per Partition Automatic Failover] Fix Gap on Dynamic Enablement with Request Timeout Value as 0

4 participants