feat(catalog-rest): enforce negotiated endpoints for exists checks#2794
Open
huan233usc wants to merge 1 commit into
Open
feat(catalog-rest): enforce negotiated endpoints for exists checks#2794huan233usc wants to merge 1 commit into
huan233usc wants to merge 1 commit into
Conversation
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.
01cbb8f to
f6d61dd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Follow-up to #2692.
What changes are included in this PR?
#2692 parsed the server-advertised
endpointsfromGET /v1/configbut did notyet use them. This PR wires the negotiated set into the catalog and starts
enforcing it:
DEFAULT_ENDPOINTS— the base set of namespace/table operations assumedwhen a server omits the
endpointsfield or sends an empty list (the two aretreated alike), mirroring Java's
RESTSessionCatalog.RestContextstores the negotiated set (advertised list, or the defaultbase set);
RestCatalog::supports_endpointqueries it.table_exists/namespace_existsnow issue the cheapHEADonly whenthe server advertises the corresponding endpoint, and otherwise fall back to a
GETload (treating not-found asfalse), so they keep working againstservers that don't advertise the
HEADroutes. This mirrors Java'sRESTSessionCatalog.{tableExists,namespaceExists}.supports_endpointis intentionallypub(crate)— its only consumers so far arethe exists checks inside this crate, so there's no need to expose it publicly yet
(it can be made
pubwhen a cross-crate consumer such as scan planning needs it).As a result this PR makes no public-API change (no
public-api.txtupdate).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}_existson both the HEAD and GET-fallback paths.