Skip to content

[Cosmos] Backport PPCB fixes to 4.79.1-hotfix - #50281

Draft
Abhijeet Mohanty (jeet1995) wants to merge 14 commits into
Azure:ppcb-hotfix-baseline/azure-cosmos-4.79.0from
jeet1995:release_azure-cosmos-4.79.1-hotfix
Draft

[Cosmos] Backport PPCB fixes to 4.79.1-hotfix#50281
Abhijeet Mohanty (jeet1995) wants to merge 14 commits into
Azure:ppcb-hotfix-baseline/azure-cosmos-4.79.0from
jeet1995:release_azure-cosmos-4.79.1-hotfix

Conversation

@jeet1995

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

Copy link
Copy Markdown
Member

Summary

Backports the required PPCB fixes to azure-cosmos 4.79.1-hotfix.

Comparison baseline

  • Base: ppcb-hotfix-baseline/azure-cosmos-4.79.0
  • Base commit: 896d7f94f1ea82d8da16f26fa69100a6e82f17f9
  • Head: jeet1995:release_azure-cosmos-4.79.1-hotfix

Backport inventory

Source Hotfix commit(s) What was backported
#50182 d70208a69af0 Release-compatible backport of failback recovery when partition addresses are missing or stale, including focused coverage.
#50158 0b8961feb2f4 Release-compatible backport of PPCB diagnostics and failback observability.
#49734 f6ac73ffb54c, 310ed771c401, 572af904642e, a440ab76c29a, a796cc58d04c, f3f4b708437d, 76f73b7fd78a Non-merge source series for diagnostics config publication, changelog, and focused unit/E2E coverage.
#49568 c2598b9e7517 Release-adapted customer-workflow test coverage.

Release integration commits

  • 7cfe6ec04436 - prepare 4.79.1-hotfix versions and release metadata.
  • 53a49a71915c - adapt PPCB tests to the 4.79 release surface.
  • a49d8e5c09f0 - restore PPCB regression coverage removed during release adaptation.
  • dd091bc2ddbc - complete authenticated Azure Artifacts Maven resolution for network-isolated pipelines.

Validation

…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).

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

Copilot-Session: 16ce0941-555c-4190-8c4d-96c705086350
Complete the existing pipeline authentication flow with mirror settings so network-isolated agents resolve Maven dependencies through the Azure SDK feed.
@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).

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.

2 participants