Skip to content

fix: support leader lookup with Oxia 0.16.x - #373

Merged
mattisonchao merged 2 commits into
mainfrom
fix-leader-hint-016-compat
Sep 7, 2026
Merged

fix: support leader lookup with Oxia 0.16.x#373
mattisonchao merged 2 commits into
mainfrom
fix-leader-hint-016-compat

Conversation

@mattisonchao

@mattisonchao mattisonchao commented Sep 7, 2026

Copy link
Copy Markdown
Member

Motivation

The Java client supports shard-leader redirects from the google.rpc.ErrorInfo metadata used by Oxia 0.17.0 and newer. Oxia 0.16.x instead returns custom gRPC status code 106 with an io.oxia.proto.v1.LeaderHint protobuf detail.

gRPC Java normalizes code 106 to UNKNOWN and rejects the rich status because the normalized code no longer matches the status-details trailer. As a result, the client cannot see the leader hint and can keep retrying a stale cached leader after a failover.

Modifications

  • Add the legacy LeaderHint message with the same wire fields used by Oxia 0.16.x.
  • Introduce an ordered status-decoder strategy for the legacy 0.16.x and standard 0.17.x wire formats.
  • Decode custom code 106 and LeaderHint directly into an OxiaStatusException in LegacyLeaderHintStatusDecoder.
  • Keep validated gRPC status, ErrorInfo, standard-code, and message fallback handling in StandardGrpcStatusDecoder.
  • Return UNKNOWN when a decoder does not recognize the error so OxiaStatusException can continue to the next strategy without an intermediate result or Optional.

Testing

  • ./gradlew :client:spotlessCheck
  • ./gradlew :client:spotbugsMain
  • ./gradlew :client:test --tests "*Test"
  • ./gradlew :client:test --tests io.oxia.client.grpc.OxiaStatusExceptionTest --tests io.oxia.client.grpc.GrpcRpcProviderTest

@mattisonchao
mattisonchao force-pushed the fix-leader-hint-016-compat branch 2 times, most recently from 6d3fc40 to b6c7b7b Compare September 7, 2026 04:41
@mattisonchao mattisonchao self-assigned this Sep 7, 2026
@mattisonchao
mattisonchao force-pushed the fix-leader-hint-016-compat branch 3 times, most recently from 5d24c13 to 534bcca Compare September 7, 2026 08:03
Signed-off-by: mattisonchao <mattisonchao@gmail.com>
@mattisonchao
mattisonchao force-pushed the fix-leader-hint-016-compat branch from 534bcca to 3495506 Compare September 7, 2026 08:24
Signed-off-by: mattisonchao <mattisonchao@gmail.com>
@mattisonchao
mattisonchao merged commit ea99b00 into main Sep 7, 2026
7 checks passed
@mattisonchao
mattisonchao deleted the fix-leader-hint-016-compat branch September 7, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant