grpc / grpc/grpc-java

Migrate to explicitly refresh name resolution by load balancer

オープン
#8,088 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
experimental API
主要言語
Java
スター
12.1k
フォーク
4k
平均マージ
2日 17時間
マージ済み PR(30日)
37

説明

Currently each subchannel [implicitly refreshes the name resolution](https://github.com/grpc/grpc-java/blob/5e9a7b6e2f4e5ae2789fb7efc597c6a80c8beabd/core/src/main/java/io/grpc/internal/ManagedChannelImpl.java#L1929) when its connection is broken. That is, this feature is built into subchannel's internal implementation. Although it eliminates the burden of having LoadBalancer implementations refresh the name resolution when connections to backends are broken, this is gives LoadBalancer no chance to disable or override this refresh.

We'd want to let LoadBalancer manage refreshes explicitly. The API has already been there for a long time: [`LoadBalancer.Helper.refreshNameResolution()`](https://github.com/grpc/grpc-java/blob/d4fa0ecc07495097453b0a2848765f076b9e714c/api/src/main/java/io/grpc/LoadBalancer.java#L1058). During the transition, SubchannelImpl will check if `Helper.refreshNameResolution()` is called when its connection is broken. If not, it will still refresh the resolution and log a warning. _This will be removed in the future and LoadBalancers are completely responsible for triggering the refresh._

As a side effect of this check, LoadBalancers that intentionally do not want the refresh (e.g., xDS) will cause the warning. So we are adding a temporary LoadBalancer.Helper API, `ignoreRefreshNameResolutionCheck()` to help the transition. It's been marked as deprecated, xDS should be the only LoadBalancer implementation that uses it.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ManagedChannelImpl と SubchannelImpl から始め、次に LoadBalancer.Helper.refreshNameResolution() と一時的な ignoreRefreshNameResolutionCheck() API を読みます。既存の接続切断時の refresh パスと、関係する LoadBalancer の実装を追跡します。refresh の所有権が記載された遷移動作に従い、警告と deprecated の opt-out が説明どおりに処理されれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
backend-api-design
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。