Skip to content

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

Description

@ss666

Search before asking

  • I searched in the issues and found nothing similar.

Description

Parent issue: #3631. Follow-up to #3632.

LOOKUP carries original_partition_name but, unlike PUT_KV and PRODUCE_LOG, has neither a version bump nor a gate: ApiKeys.LOOKUP is still (1017, 0, 1, PUBLIC), validateVersionCompatibility has no LOOKUP branch, so the field is sent whatever version was negotiated.

The bump is the prerequisite for making this capability detectable, as discussed in #4001. The discussion in #3630 on LOOKUP expected an old server to return null; what happens instead is an NPE: dispatch is keyed on the echoed name, so an un-echoed response matches no in-flight batch and is dereferenced unchecked, failing the whole request as an UnknownServerException. Reproduced on main with a gateway stub that answers normally but does not echo the field:

org.apache.fluss.exception.UnknownServerException: java.lang.NullPointerException
        at org.apache.fluss.client.lookup.LookupSender.handleLookupResponse(LookupSender.java:438)
        at org.apache.fluss.client.lookup.LookupSender.lambda$sendLookupRequestAndHandleResponse$10(LookupSender.java:349)
        ...

Proposed change

  1. Raise ApiKeys.LOOKUP to 2. The maximum is still 1 from [lake] Fix lake encoder causing prefix lookup to miss data when bucket key is a subset of primary key #2464, so 1 cannot be given that meaning retroactively; new/old then negotiates 1 and the gate fires. The only server-side LOOKUP version check, ReplicaManager#validateClientVersionForPkTable, is >= 1, so it is unaffected. The server must also keep accepting original_partition_name at v1, since clients from [lookup] Support historical partition lookup for lake tables #3630 onward already send it there.
  2. Add HISTORICAL_LOOKUP_MIN_VERSION = 2 and a LOOKUP branch in validateVersionCompatibility using hasHistoricalLookup, throwing UnsupportedVersionException.

Since release-1.0 advertises the same LOOKUP maximum as 0.9, a bump that lands only on main would make the gate reject 1.0 servers that do support historical lookup, so it may be worth considering for release-1.0.

Willingness to contribute

  • I'm willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions