Skip to content

[Cosmos] Backport PPCB fixes to 4.81.1 - #50282

Merged
Abhijeet Mohanty (jeet1995) merged 16 commits into
Azure:hotfix/jeet1995/azure-cosmos_4.81.1-hotfixfrom
jeet1995:release_azure-cosmos-4.81.1-hotfix
Sep 4, 2026
Merged

[Cosmos] Backport PPCB fixes to 4.81.1#50282
Abhijeet Mohanty (jeet1995) merged 16 commits into
Azure:hotfix/jeet1995/azure-cosmos_4.81.1-hotfixfrom
jeet1995:release_azure-cosmos-4.81.1-hotfix

Conversation

@jeet1995

@jeet1995 Abhijeet Mohanty (jeet1995) commented Aug 28, 2026

Copy link
Copy Markdown
Member

Summary

Backports the required Per-Partition Circuit Breaker (PPCB) fixes to azure-cosmos 4.81.1 and adapts release validation for network-isolated hosted agents.

PR branches

  • Base: Azure:hotfix/jeet1995/azure-cosmos_4.81.1-hotfix
  • Base commit: 987c15b6ee19f2a51d054c795394331caf2119ca
  • Head: jeet1995:release_azure-cosmos-4.81.1-hotfix

Product changes

  • Backports #50182: PPCB failback recovery when gateway address refresh returns missing or stale partition addresses.
  • Backports #50158: PPCB diagnostics snapshots and failback observability.
  • Backports the product portion of #49734: publishes partitionLevelCircuitBreakerCfg in the diagnostics clientCfgs section.

Pipeline changes

  • Corrects release-specific dependency validation metadata.
  • Excludes only the generic Cosmos FromSource matrix job because the 4.81.0 baseline predates #49481, which later separated Docker-dependent Spring tests. Maven -amd otherwise reaches those tests and attempts blocked public image pulls; all normal NotFromSource Cosmos jobs remain enabled.

Test changes

Release metadata

  • Runs Prepare-Release.ps1 for com.azure:azure-cosmos.
  • Sets the package version to 4.81.1 (not 4.81.1-hotfix) and dates the changelog 2026-09-03.
  • Updates eng/versioning/version_client.txt and all dependent Cosmos module POM references, including the benchmark module.
  • Updates Azure SDK release tracking item 34188.

…ientCfgs

The partitionLevelCircuitBreakerCfg field disappeared from the clientCfgs
section of CosmosDiagnostics when a customer explicitly enabled Per-Partition
Circuit Breaker (PPCB) client-side.

Root cause: the diagnostics write was coupled to the Per-Partition Automatic
Failover (PPAF) initialization path, so the field was only populated when the
service mandated PPAF, not when PPCB was configured client-side.

Fix: move the diagnostics write into initializePerPartitionCircuitBreaker(),
which is invoked unconditionally at client init, so the field appears whenever
the circuit breaker is configured client-side.

Adds a CI-runnable regression test asserting all clientCfgs keys are present,
including partitionLevelCircuitBreakerCfg.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…roperty

Remove trailing comma before closing brace in the COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG
JSON so the value is strictly valid and clearer as a customer reference.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…kerE2ETests

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… keys

The partitionLevelCircuitBreakerCfg field now appears in clientCfgs for every
client regardless of PPCB configuration, so the E2E test no longer sets the
COSMOS.PARTITION_LEVEL_CIRCUIT_BREAKER_CONFIG system property. It just builds a
plain client and asserts all expected clientCfgs keys (including
partitionLevelCircuitBreakerCfg) are present in CosmosDiagnostics.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Remove PPCB System.setProperty/clearProperty and the value-specific
assertion; assert only that all clientCfgs keys are present, matching
the E2E test simplification.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* Fix PPCB failback with missing or stale addresses

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Improve PPCB failback diagnostics

* Validate PPCB state in diagnostics E2E tests

* Limit PPCB diagnostics assertion to data-plane requests

* Log PPCB failback backlog progress

* Add PPCB failback remaining meter

* Clarify PPCB failback meter name

* Reduce PPCB failback meter allocations

* Track PPCB pending recoveries by collection

* Correlate PPCB failback recovery diagnostics

* Harden PPCB failback recovery tests

* Fix PPCB all-region diagnostics assertion

* Optimize PPCB diagnostics snapshots

* Cache PPCB diagnostics snapshots

* Align PPCB failback flow with main

* Add benchmark fault injection support.

* Harden PPCB failback telemetry

Use a single injectable logger, prevent backlog telemetry failures from escaping the recovery flow, and align the pending failback metric name.

* Scope PR to PPCB diagnostics

Remove benchmark, fault-injection, metric, and recovery behavior changes. Retain immutable CosmosDiagnostics PPCB snapshots, lifecycle E2E assertions, and WARN logging for every failback failure.

* Reduce PPCB diagnostics overhead

Reuse immutable PPCB map references in response snapshots and shorten per-region diagnostic field names.

* Refactoring

* Simplify PPCB diagnostics snapshots

Represent holder state with one volatile immutable-map reference and align the compact timestamp serialization test.

* Ignore updates to empty PPCB diagnostics

Make updates to the shared uninitialized diagnostics sentinel a no-op and verify it remains null-serializing.

* Avoid copying PPCB diagnostics state

Retain the live PPCB diagnostics map reference to avoid per-publication map and wrapper allocations, accepting weak consistency.

* Log PPCB diagnostics lifecycle snapshots

Emit one full CosmosDiagnostics JSON payload for failed, post-failover, and post-failback E2E phases for PR evidence.

* Document PPCB diagnostics improvements

Add the unreleased changelog entry for per-region PPCB snapshots and failback WARN logging.

* Add PPCB failback outcome diagnostics

Track the latest background failback attempt time, outcome, and failure reason per partition-region; validate lifecycle state in E2E and focused recovery tests.

* Reset unavailable timestamp after PPCB failback

Use the available-state sentinel when recovery moves a region to HealthyTentative and cover it in the scheduled recovery test.

* Refine PPCB failback diagnostics

Keep failback attempt metadata partition-scoped, retain only the latest full failure message per region, and clear retained messages when recovery backlog drains.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 16ce0941-555c-4190-8c4d-96c705086350
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 16ce0941-555c-4190-8c4d-96c705086350
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
34 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jeet1995

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jeet1995
Abhijeet Mohanty (jeet1995) deleted the release_azure-cosmos-4.81.1-hotfix branch August 31, 2026 13:16
@jeet1995
Abhijeet Mohanty (jeet1995) restored the release_azure-cosmos-4.81.1-hotfix branch August 31, 2026 13:26
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
34 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@jeet1995
Abhijeet Mohanty (jeet1995) changed the base branch from ppcb-hotfix-baseline/azure-cosmos-4.81.0 to hotfix/jeet1995/4.81.1-hotfix August 31, 2026 13:28
@jeet1995
Abhijeet Mohanty (jeet1995) changed the base branch from hotfix/jeet1995/4.81.1-hotfix to hotfix/jeet1995/azure-cosmos_4.81.0 August 31, 2026 15:05
@jeet1995
Abhijeet Mohanty (jeet1995) changed the base branch from hotfix/jeet1995/azure-cosmos_4.81.0 to hotfix/jeet1995/azure-cosmos_4.81.1-hotfix August 31, 2026 15:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
32 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16ce0941-555c-4190-8c4d-96c705086350
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 16ce0941-555c-4190-8c4d-96c705086350
@jeet1995 Abhijeet Mohanty (jeet1995) changed the title [Cosmos] Backport PPCB fixes to 4.81.1-hotfix [Cosmos] Backport PPCB fixes to 4.81.1 Sep 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@jeet1995

Copy link
Copy Markdown
Member Author

/azp run java - cosmos - tests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@jeet1995
Abhijeet Mohanty (jeet1995) merged commit c9d65ef into Azure:hotfix/jeet1995/azure-cosmos_4.81.1-hotfix Sep 4, 2026
106 of 108 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants