Skip to content

[client] Thrown exception if Server type mismatch.#2606

Open
loserwang1024 wants to merge 1 commit intoapache:mainfrom
loserwang1024:fix-coordinator-wrong
Open

[client] Thrown exception if Server type mismatch.#2606
loserwang1024 wants to merge 1 commit intoapache:mainfrom
loserwang1024:fix-coordinator-wrong

Conversation

@loserwang1024
Copy link
Contributor

Purpose

Linked issue: close #2604

Brief change log

Tests

API and Format

Documentation

@loserwang1024 loserwang1024 force-pushed the fix-coordinator-wrong branch 2 times, most recently from 403c90f to b3d6ad6 Compare February 9, 2026 10:21
@loserwang1024 loserwang1024 requested a review from Copilot February 9, 2026 10:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses client-side “stuck” behavior when requests are routed to the wrong server type (e.g., coordinator vs tablet server after restarts/IP swaps) by adding a server-type check during API version negotiation and surfacing the mismatch as a metadata-related exception so clients can recover.

Changes:

  • Add server_type to ApiVersionsResponse and populate it on the server/test gateways.
  • Validate server type on the client during API_VERSIONS handshake and close the connection with an InvalidServerTypeException on mismatch.
  • Refresh physical-table metadata during writer-id initialization retries when the failure is an InvalidMetadataException.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
fluss-server/src/main/java/org/apache/fluss/server/RpcServiceBase.java Sets server_type in API_VERSIONS responses emitted by servers.
fluss-rpc/src/main/proto/FlussApi.proto Extends ApiVersionsResponse with optional int32 server_type.
fluss-rpc/src/main/java/org/apache/fluss/rpc/netty/client/ServerConnection.java Adds server-type validation on API_VERSIONS response and closes with InvalidServerTypeException on mismatch.
fluss-common/src/main/java/org/apache/fluss/exception/InvalidServerTypeException.java Introduces a new exception type (extends InvalidMetadataException) to trigger metadata refresh/retry behavior.
fluss-common/src/main/java/org/apache/fluss/cluster/ServerType.java Adds ServerType.forId(int) to decode server_type.
fluss-rpc/src/test/java/org/apache/fluss/rpc/netty/client/ServerConnectionTest.java Adds coverage for wrong-server-type connection behavior.
fluss-rpc/src/test/java/org/apache/fluss/rpc/netty/authenticate/AuthenticationTest.java Updates test ServerNode types to match new server-type handshake behavior.
fluss-rpc/src/test/java/org/apache/fluss/rpc/TestingTabletGatewayService.java Makes test tablet gateway report TABLET_SERVER provider type.
fluss-rpc/src/test/java/org/apache/fluss/rpc/TestingGatewayService.java Adds server_type to API_VERSIONS responses for test gateway service.
fluss-client/src/main/java/org/apache/fluss/client/write/WriterClient.java Wires MetadataUpdater into IdempotenceManager construction.
fluss-client/src/main/java/org/apache/fluss/client/write/IdempotenceManager.java Refreshes metadata on InvalidMetadataException during writer-id init retries.
fluss-client/src/test/java/org/apache/fluss/client/write/SenderTest.java Updates IdempotenceManager construction to include MetadataUpdater.
fluss-client/src/test/java/org/apache/fluss/client/write/RecordAccumulatorTest.java Updates IdempotenceManager construction for new signature (passes null updater).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@loserwang1024
Copy link
Contributor Author

@wuchong @swuferhong , CC

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.

Read or Write won't recover when write/read/lookup request is sent to coordinator server.

1 participant