Skip to content

feat(catalog-rest): enforce negotiated endpoints for exists checks#2794

Open
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:feat/rest-endpoint-enforcement
Open

feat(catalog-rest): enforce negotiated endpoints for exists checks#2794
huan233usc wants to merge 1 commit into
apache:mainfrom
huan233usc:feat/rest-endpoint-enforcement

Conversation

@huan233usc

@huan233usc huan233usc commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Follow-up to #2692.

What changes are included in this PR?

#2692 parsed the server-advertised endpoints from GET /v1/config but did not
yet use them. This PR wires the negotiated set into the catalog and starts
enforcing it:

  • DEFAULT_ENDPOINTS — the base set of namespace/table operations assumed
    when a server omits the endpoints field or sends an empty list (the two are
    treated alike), mirroring Java's RESTSessionCatalog.
  • RestContext stores the negotiated set (advertised list, or the default
    base set); RestCatalog::supports_endpoint queries it.
  • table_exists / namespace_exists now issue the cheap HEAD only when
    the server advertises the corresponding endpoint, and otherwise fall back to a
    GET load (treating not-found as false), so they keep working against
    servers that don't advertise the HEAD routes. This mirrors Java's
    RESTSessionCatalog.{tableExists,namespaceExists}.

supports_endpoint is intentionally pub(crate) — its only consumers so far are
the exists checks inside this crate, so there's no need to expose it publicly yet
(it can be made pub when a cross-crate consumer such as scan planning needs it).
As a result this PR makes no public-API change (no public-api.txt update).

Enforcing the negotiated set across the remaining operations (and named
per-route constants) can follow in subsequent PRs.

Are these changes tested?

Yes — unit tests for negotiation (advertised list, absent field, explicit empty
list) and for {table,namespace}_exists on both the HEAD and GET-fallback paths.

Follow-up to apache#2692, which parsed the server-advertised `endpoints` from
GET /v1/config but did not yet use them. This wires the negotiated set into the
catalog:

- `DEFAULT_ENDPOINTS`: the base set assumed when a server omits `endpoints` or
  sends an empty list (mirrors Java's `RESTSessionCatalog`).
- `RestContext` stores the negotiated set; `RestCatalog::supports_endpoint`
  (crate-internal) queries it.
- `table_exists` / `namespace_exists` now issue the cheap HEAD only when the
  server advertises it, falling back to a GET load (treating not-found as
  `false`) otherwise, so they still work against servers that don't advertise
  the HEAD routes. Mirrors Java's `RESTSessionCatalog.{tableExists,namespaceExists}`.

`supports_endpoint` is `pub(crate)` — it has no external consumer yet; it can be
made public when a cross-crate consumer (e.g. scan planning) needs it. The public
API is therefore unchanged.

Covered by unit tests: negotiation (advertised / absent / empty) and
`{table,namespace}_exists` on both the HEAD and GET-fallback paths.
@huan233usc huan233usc force-pushed the feat/rest-endpoint-enforcement branch from 01cbb8f to f6d61dd Compare July 10, 2026 20:28
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