Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Cosmos: Add gateway-driven disableCrossRegionalHedging handling (mirror .NET PR #5829)

未关闭
#49,192 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
java
领域
api, backend, databases

调研方向

首先跟踪 AccountProperties 的反序列化以及 GlobalEndpointManager.perPartitionAutomaticFailoverConfigModifier 回调路径,然后对比所引用的 .NET PR。检查对应的 RequestInvokerHandler.AvailabilityStrategy 路径和 CosmosDiagnostics 处理。完成的标准是:parity tests 覆盖 gateway flag、null 状态转换、客户端 opt-out、按请求抑制,以及首次抑制的 diagnostics。

由索引模型根据 Issue 内容生成。

描述

Client Cosmos needs-team-attention Service Attention

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:

  1. AccountProperties (or equivalent) deserialization — add a nullable disableCrossRegionalHedging field (Boolean, i.e., 3-valued: null / true / false).
  2. GlobalEndpointManager change-detection — mirror the .NET PR's HasValue guard so an absent property is treated as "no signal" rather than implicit false. 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.
  3. Reconcile path — extend perPartitionAutomaticFailoverConfigModifier (or the analogous callback) to receive the disable-hedging signal, stash and restore any customer-configured AvailabilityStrategy, and clear the active strategy while the flag is true.
  4. Per-request guard — the equivalent of RequestInvokerHandler.AvailabilityStrategy(...) should short-circuit to null when the cached flag is true, regardless of per-request RequestOptions strategy. This is the absolute-precedence guarantee.
  5. 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 AvailabilityStrategy is suppressed when the flag is true.
  • Diagnostics entry emitted on first suppression.
  • Parity-test coverage of the four state transitions: null → true, true → false, true → null, false → true.

Cross-references

主要语言
Java
星标
2.6k
派生
2.2k
平均合并
1 天 18 小时
30 天内合并 PR
231

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/azure-sdk-for-java 的其他 Issue

查看 Azure/azure-sdk-for-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。