Migrate to explicitly refresh name resolution by load balancer
- Lenguaje dominante
- Java
- Estrellas
- 12.1k
- Forks
- 4k
- Merge medio
- 2 d 17 h
- PR fusionados (30 d)
- 37
Descripción
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.
Guía de contribución
Línea de trabajo
Comienza con ManagedChannelImpl y SubchannelImpl; después, lee LoadBalancer.Helper.refreshNameResolution() y la API temporal ignoreRefreshNameResolutionCheck(). Sigue la ruta de refresh existente cuando se interrumpe la conexión y las implementaciones de LoadBalancer implicadas. Se considera terminado cuando la responsabilidad del refresh sigue el comportamiento de transición indicado, y la advertencia y el opt-out obsoleto se gestionan como se describe.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- backend-api-design
- Tipo de issue
- Refactorización
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100