Add PPAF write-region bookmark to CosmosDiagnostics - #50356
Open
Abhijeet Mohanty (jeet1995) wants to merge 4 commits into
Open
Add PPAF write-region bookmark to CosmosDiagnostics#50356Abhijeet Mohanty (jeet1995) wants to merge 4 commits into
Abhijeet Mohanty (jeet1995) wants to merge 4 commits into
Conversation
|
Azure Pipelines: Successfully started running 2 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
Abhijeet Mohanty (jeet1995)
marked this pull request as ready for review
September 8, 2026 22:17
Abhijeet Mohanty (jeet1995)
requested review from
a team and
Kiran Kumar Kolli (kirankumarkolli)
as code owners
September 8, 2026 22:17
Copilot started reviewing on behalf of
Abhijeet Mohanty (jeet1995)
September 8, 2026 22:18
View session
|
Azure Pipelines: Successfully started running 2 pipeline(s). 33 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The PR is marked WIP and there is a small diagnostics serialization consistency issue to address before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates Azure Cosmos DB Java SDK diagnostics to emit a compact per-attempt Per-Partition Automatic Failover (PPAF) bookmark under the ppaf key, capturing the designated write region and the time it was designated, while ensuring historical diagnostics are immutable once recorded.
Changes:
- Replaced the previous verbose PPAF diagnostics shape with a compact
ppafobject (empty object when no override is active). - Introduced an immutable
PerPartitionAutomaticFailoverDiagnosticssnapshot that is captured and then attached to recorded response/gateway statistics. - Added/updated unit tests validating empty/populated PPAF diagnostics and record-time snapshot immutability.
File summaries
| File | Description |
|---|---|
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/perPartitionAutomaticFailover/PerPartitionAutomaticFailoverInfoHolder.java | Stores and serializes a compact immutable PPAF diagnostics snapshot (ppaf) as {} or { currWriteRegion, since }. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/perPartitionAutomaticFailover/PerPartitionAutomaticFailoverDiagnostics.java | New immutable snapshot type holding currWriteRegion and since for diagnostics serialization. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/perPartitionAutomaticFailover/PartitionLevelAutomaticFailoverInfo.java | Adds since tracking and snapshots region/timestamp into the new immutable diagnostics object. |
| sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/implementation/ClientSideRequestStatistics.java | Records PPAF snapshots at response/gateway record time and emits them under the ppaf field name. |
| sdk/cosmos/azure-cosmos/CHANGELOG.md | Documents the new compact ppaf diagnostics bookmark behavior. |
| sdk/cosmos/azure-cosmos-tests/src/test/java/com/azure/cosmos/GlobalPartitionEndpointManagerForPPAFUnitTests.java | Adds tests asserting {} for empty PPAF and stable region/timestamp snapshots across direct and gateway stats. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
…to users/abhmohanty/ppaf-cosmos-diagnostics
Member
Author
|
/azp run java - cosmos - tests |
|
Azure Pipelines: Successfully started running 1 pipeline(s). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a compact per-attempt
ppafbookmark toCosmosDiagnostics:When PPAF has no designated override, diagnostics emit
"ppaf": {}.The designated region and timestamp are captured in an immutable, package-private snapshot when response statistics are recorded. This prevents later failover transitions or manager cleanup from rewriting historical diagnostics and avoids retaining endpoint-manager or routing state.
The compact
ppafobject replaces the previous verbose PPAF diagnostics shape for both direct and gateway attempts.