Skip to content

REST: Send If-None-Match on table refresh - #18188

Open
raunaqmorarka wants to merge 1 commit into
apache:mainfrom
raunaqmorarka:rest-conditional-refresh
Open

raunaqmorarka wants to merge 1 commit into
apache:mainfrom
raunaqmorarka:rest-conditional-refresh

Conversation

@raunaqmorarka

Copy link
Copy Markdown
Contributor

RESTTableOperations.refresh() always issued an unconditional GET and parsed the full metadata body, even though the same catalog already does freshness-aware loading for loadTable through RESTTableCache. Servers that honour If-None-Match (for example Polaris) answer with 304 Not Modified, so a refresh of an unchanged table only needs a header round trip.

RESTTableOperations now keeps the ETag from the load response that created it and from every successful refresh and commit response, sends it as If-None-Match on refresh(), and returns current() on a 304 without parsing a body. When the server sends no ETag, refresh behaves as before. The RESTTableCache entry is left untouched, since the ETag there pairs with the metadata captured by the cached supplier.

Note: commit() now uses the RESTClient.post overload that returns response headers. BaseHTTPClient supports it; a custom RESTClient relying only on the interface default would need to implement it.

Tests cover a conditional refresh returning 304, a changed table still refreshing fully and adopting the new ETag, a commit ETag being reused, servers that send no ETag, and the 304 path over the Jetty-backed test server.

@github-actions github-actions Bot added the core label Sep 20, 2026
Reuse the ETag from loadTable and commit responses so an unchanged
table refreshes with a 304 instead of a full metadata body.
@raunaqmorarka
raunaqmorarka force-pushed the rest-conditional-refresh branch from 9098d9d to 52e3d86 Compare September 20, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant