Skip to content

[rpc] version-gate historical partition lookup - #4417

Open
ss666 wants to merge 2 commits into
apache:mainfrom
ss666:fluss-historical-lookup-version-gate
Open

ss666 wants to merge 2 commits into
apache:mainfrom
ss666:fluss-historical-lookup-version-gate

Conversation

@ss666

@ss666 ss666 commented Sep 18, 2026

Copy link
Copy Markdown

Purpose

Linked issue: close #4416

Part of #3631, follow-up to #3632.

LOOKUP carries original_partition_name without a version bump, the capability is not detectable and cannot be gated: the field is sent to a server that predates it, and the un-echoed response fails the request on a null dereference.

Brief change log

  • Raise ApiKeys.LOOKUP to version 2, documenting that v2 carries original_partition_name in requests and responses.
  • Add HISTORICAL_LOOKUP_MIN_VERSION = 2 and a LOOKUP branch in ServerConnection#validateVersionCompatibility that rejects historical lookups with UnsupportedVersionException, mirroring the existing PUT_KV and PRODUCE_LOG branches.
  • Extend ServerConnectionTest with a server that advertises LOOKUP v1: a normal lookup still succeeds, a historical lookup is rejected.

Tests

  • ./mvnw verify -pl fluss-rpc -am
  • ./mvnw test -pl fluss-client -am -Dtest='LookupSenderTest,PrimaryKeyLookuperTest,ClientRpcMessageUtilsTest,LookupQueueTest'
  • ./mvnw test -pl fluss-server -am -Dtest='RpcServiceBaseTest,ServerRpcMessageUtilsTest'

API and Format

  • Bumps the LOOKUP RPC maximum version from 1 to 2. No proto or encoding change; v2 only declares the already-existing optional original_partition_name fields. No new public Java API and no new configuration option.
  • No server-side change: the server must keep accepting original_partition_name at v1, since clients from [lookup] Support historical partition lookup for lake tables #3630 onward already send it there.
  • release-1.0 advertises the same LOOKUP maximum as 0.9, so a bump that lands only on main would make the gate reject 1.0 servers that do support historical lookup — worth considering for release-1.0 as well.

Documentation

N/A. No user-facing option or behaviour change.

@luoyuxia
luoyuxia requested a lite review from Copilot September 18, 2026 07:03
@luoyuxia

Copy link
Copy Markdown
Contributor

@ss666 Thanks for the pr. One compatibility concern: please see #4416 (comment)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved cross-version compatibility and version-assertion issues remain.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR adds version negotiation for historical partition lookups.

Changes:

  • Bumps LOOKUP to protocol version 2.
  • Rejects historical lookups against servers below version 2.
  • Adds compatibility tests for normal and historical lookups.
File summaries
File Summary
fluss-rpc/src/test/java/org/apache/fluss/rpc/netty/client/ServerConnectionTest.java Tests compatibility with servers advertising LOOKUP v1.
fluss-rpc/src/main/java/org/apache/fluss/rpc/protocol/ApiKeys.java Advertises LOOKUP v2. Critical finding (2 votes): coordinate the matching release-1.0 advertisement. Moderate finding (1 vote): add an explicit v2 assertion to ApiKeysTest.
fluss-rpc/src/main/java/org/apache/fluss/rpc/netty/client/ServerConnection.java Adds version validation for historical lookups.
Review details

Suppressed comments (1)

fluss-rpc/src/main/java/org/apache/fluss/rpc/protocol/ApiKeys.java:62

  • Please add an explicit ApiKeys.LOOKUP.highestSupportedVersion == 2 assertion to ApiKeysTest. The new ServerConnectionTest would still pass if this enum accidentally remained at 1, because OldLookupGatewayService clamps a response that already starts from the same enum; in that case a new server would never negotiate v2 and every historical lookup would be rejected. The existing ApiKeysTest already covers analogous version bumps.
    LOOKUP(1017, 0, 2, PUBLIC),
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

// primary key, enabling prefix lookup support.
LOOKUP(1017, 0, 1, PUBLIC),
// Version 2: Supports original_partition_name in requests and responses for historical lookups.
LOOKUP(1017, 0, 2, PUBLIC),
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.

[FIP-28] Version-gate historical partition lookup: bump ApiKeys.LOOKUP and add the client-side gate

3 participants