grpc / grpc/grpc-java

Migrate to explicitly refresh name resolution by load balancer

Aperta
#8,088 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
experimental API
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start with ManagedChannelImpl and SubchannelImpl, then read LoadBalancer.Helper.refreshNameResolution() and the temporary ignoreRefreshNameResolutionCheck() API. Trace the existing connection-broken refresh path and the LoadBalancer implementations involved. Done means refresh ownership follows the stated transition behavior, with the warning and deprecated opt-out handled as described.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
backend-api-design
Tipo di issue
Refactoring
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.