REST: Send If-None-Match on table refresh - #18188
raunaqmorarka wants to merge 1 commit into
Conversation
9098d9d to
52e3d86
Compare
|
Isn't this solving the same as #17832? |
Different problem. #17832 restores the lazy snapshots supplier and the |
gaborkaszab
left a comment
There was a problem hiding this comment.
Hi @raunaqmorarka ,
I'm trying to refresh my memories since I was involved with this. Couple of questions:
- Isn't the ETag redundant now: There is one kept in the table cache and one in ops. Also, they can get out of sync, right?
- In terms of the table cache, this is an in-place operation, right? Executing ops.refresh() also refreshes the TableMetadata in the table cache through ops, right?
- I recall one complication might be that credentials and configs are also returned by the get request not just table metadata and ETag. Since these are incorporated into FileIO and RESTClient, they are not refreshed, right? Since the age of the table in the cache is not affected here, probably we are fine with this, just want to double check.
cc @nastra @danielcweeks Might be a useful addition. I always dragged this as a potential future addition to freshness-aware loading. Would you mind also taking a look?
Reuse the ETag from loadTable and commit responses so an unchanged table refreshes with a 304 instead of a full metadata body.
|
52e3d86 to
d230af1
Compare
RESTTableOperations.refresh()always issued an unconditionalGETand parsed the full metadata body, even though the same catalog already does freshness-aware loading forloadTablethroughRESTTableCache. Servers that honourIf-None-Match(for example Polaris) answer with304 Not Modified, so a refresh of an unchanged table only needs a header round trip.RESTTableOperationsnow takes theETagof the load response through its constructor, updates it from every successful refresh and commit response, sends it asIf-None-Matchonrefresh(), and returnscurrent()on a304without parsing a body. When the server sends noETag, refresh behaves as before. TheRESTTableCacheentry is left untouched, since the ETag there pairs with the metadata captured by the cached supplier.RESTSessionCatalog.newTableOpsgets a new overload with aneTagparameter; the existing one is deprecated and delegates withnull.Note:
commit()now uses theRESTClient.postoverload that returns response headers.BaseHTTPClientsupports it; a customRESTClientrelying 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 newETag, a commitETagbeing reused, servers that send noETag, and the304path over the Jetty-backed test server.