Cosmos: Add gateway-driven disableCrossRegionalHedging handling (mirror .NET PR #5829)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先跟踪 AccountProperties 的反序列化以及 GlobalEndpointManager.perPartitionAutomaticFailoverConfigModifier 回调路径,然后对比所引用的 .NET PR。检查对应的 RequestInvokerHandler.AvailabilityStrategy 路径和 CosmosDiagnostics 处理。完成的标准是:parity tests 覆盖 gateway flag、null 状态转换、客户端 opt-out、按请求抑制,以及首次抑制的 diagnostics。
由索引模型根据 Issue 内容生成。
描述
Summary
Cross-SDK parity follow-up from .NET PR Azure/azure-cosmos-dotnet-v3#5829. The Java SDK does not currently honor the gateway-driven disableCrossRegionalHedging flag on AccountProperties (a server-side operator override for cross-region hedging). Without it, an operator flipping the gateway flag will see inconsistent client behavior across .NET vs Java on the same account, defeating the purpose of an operator-level kill-switch.
Filed at the request of @kushagraThapar in PR comment https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5829#pullrequestreview-4293878429 (section M4).
Background
The .NET PR adds a gateway-driven flag (AccountProperties.disableCrossRegionalHedging) that, when set to true, disables all cross-region hedging on every request — overriding both per-request and client-level AvailabilityStrategy configuration. The flag is read on the existing account-properties refresh path (GlobalEndpointManager) and propagated to the hedging strategy reconciler.
Java already has a related-but-distinct client-side JVM lever, COSMOS.IS_READ_AVAILABILITY_STRATEGY_ENABLED_WITH_PPAF, but no server-driven override.
Proposed implementation (high level)
Java has the right plumbing already — the GlobalEndpointManager.perPartitionAutomaticFailoverConfigModifier callback path is the natural seam:
AccountProperties(or equivalent) deserialization — add a nullabledisableCrossRegionalHedgingfield (Boolean, i.e., 3-valued:null/true/false).GlobalEndpointManagerchange-detection — mirror the .NET PR'sHasValueguard so an absent property is treated as "no signal" rather than implicitfalse. This is important: without it, a transient gateway response that drops the property will silently re-enable hedging during the exact window the operator most wants it disabled.- Reconcile path — extend
perPartitionAutomaticFailoverConfigModifier(or the analogous callback) to receive the disable-hedging signal, stash and restore any customer-configuredAvailabilityStrategy, and clear the active strategy while the flag is true. - Per-request guard — the equivalent of
RequestInvokerHandler.AvailabilityStrategy(...)should short-circuit tonullwhen the cached flag istrue, regardless of per-requestRequestOptionsstrategy. This is the absolute-precedence guarantee. - Diagnostics — surface the gateway-driven suppression in Java's
CosmosDiagnostics(one-shot per client / per flag-flip is fine).
Acceptance criteria
- Java SDK observes the gateway flag and disables cross-region hedging when
true. - Customer client-level opt-out (Java equivalent of
DisablePartitionLevelFailoverClientLevelOverride) bypasses the flag. - An absent property on a subsequent refresh does NOT silently re-enable hedging.
- Per-request
AvailabilityStrategyis suppressed when the flag istrue. - Diagnostics entry emitted on first suppression.
- Parity-test coverage of the four state transitions:
null → true,true → false,true → null,false → true.
Cross-references
- .NET PR: https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5829
- Originating reviewer comment: https://github.com/Azure/azure-cosmos-dotnet-v3/pull/5829#pullrequestreview-4293878429 (section M4)
- Python: explicitly out of scope (no SDK-default PPAF hedging in Python; the per-request override path that motivates the knob does not exist there).
- 主要语言
- Java
- 星标
- 2.6k
- 派生
- 2.2k
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 231
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Azure/azure-sdk-for-java 的其他 Issue
-
mgmt, in track 1 migration guide, call out that file-based authentication method is not recommended可能重新可做 关联的 PR 已关闭且未合并。 未关闭Azure.Identity
难度 1/5 1 小时以内 新手友好度 74/100
Azure/azure-sdk-for-java#48894 ·
维护者通常 1 天内回复
-
Azure.Core HttpClient
难度 4/5 3-5 天 新手友好度 52/100
Azure/azure-sdk-for-java#50961 · 1 个 reaction ·
维护者通常 1 天内回复
-
Azure.Core.V2 clientcore
难度 5/5 一周以上 新手友好度 35/100
Azure/azure-sdk-for-java#50936 · 1 个 reaction ·
维护者通常 1 天内回复
-
clientcore
难度 5/5 一周以上 新手友好度 25/100
Azure/azure-sdk-for-java#50935 · 1 个 reaction ·
维护者通常 1 天内回复
-
clientcore
难度 5/5 一周以上 新手友好度 35/100
Azure/azure-sdk-for-java#50934 · 1 个 reaction ·
维护者通常 1 天内回复
查看 Azure/azure-sdk-for-java 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
AllTheMods/AllTheModium#238 ·
-
难度 2/5 1-3 小时 新手友好度 82/100
apache/stormcrawler#2264 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
commons-app/apps-android-commons#7115 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
objectionary/lints#1596 ·
维护者通常 2 天内回复