danielcweeks commented on code in PR #14398:
URL: https://github.com/apache/iceberg/pull/14398#discussion_r2683298562
##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -435,14 +546,34 @@ public Table loadTable(SessionContext context,
TableIdentifier identifier) {
// attempt to load a metadata table using the identifier's namespace
as the base table
TableIdentifier baseIdent =
TableIdentifier.of(identifier.namespace().levels());
try {
- response = loadInternal(context, baseIdent, snapshotMode);
+ responseHeaders.clear();
+ cachedTable =
+ tableCache.getIfPresent(SessionIdTableId.of(context.sessionId(),
baseIdent));
+
+ response =
+ loadInternal(
+ context,
+ baseIdent,
+ snapshotMode,
+ headersForLoadTable(cachedTable),
+ responseHeaders::putAll);
+
+ if (response == null) {
+ Preconditions.checkNotNull(cachedTable, "Invalid load table
response: null");
+
+ return MetadataTableUtils.createMetadataTableInstance(
+ cachedTable.tableSupplier().get(), metadataType);
+ }
+
loadedIdent = baseIdent;
} catch (NoSuchTableException ignored) {
// the base table does not exist
+ invalidateTable(context, baseIdent);
throw original;
}
} else {
// name is not a metadata table
+ invalidateTable(context, identifier);
Review Comment:
This feels redundant. We've already loaded this identifier and determined
it's not in the cache, right?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]