fix: parse legacy LeaderHint from Oxia 0.16.x servers - #368
Closed
mattisonchao wants to merge 1 commit into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
The Java client only reads the shard-leader redirect from
google.rpc.ErrorInfometadata, which Oxia servers publish from 0.17.0. Servers on the 0.16.x line (including 0.16.8) attach the redirect as aproto.LeaderHintstatus detail instead. With a 0.8.0+ client against a 0.16.x server, the redirect is invisible to the client: retries keep targeting the client's cached (stale) shard leader andnode is not leader for shard Nerrors persist until the client process restarts and re-fetches shard assignments. This was observed in production for ~6.5 hours after an Oxia pod replacement.Modifications
LeaderHintmessage to the client proto, mirroring the 0.16.x server definition (shard,leader_address).LeaderHintgRPC status detail inOxiaStatusExceptionand surface it through the existingshard/leadermetadata, sogetLeaderHint()works against 0.16.x servers and retries follow the server-provided leader.type.googleapis.com/io.oxia.proto.v1.LeaderHint).Testing
./gradlew :client:test --tests io.oxia.client.grpc.OxiaStatusExceptionTest --tests io.oxia.client.grpc.GrpcRpcProviderTestpasses.:client:spotlessJavaCheckpasses for the changed files.