kbendick commented on a change in pull request #3801:
URL: https://github.com/apache/iceberg/pull/3801#discussion_r774846264
##########
File path: core/src/main/java/org/apache/iceberg/CachingCatalog.java
##########
@@ -105,14 +103,14 @@ public void delete(TableIdentifier tableIdentifier, Table
table, RemovalCause ca
}
private Cache<TableIdentifier, Table> createTableCache(Ticker ticker) {
+ boolean hasExpiration = expirationIntervalMillis > 0;
Caffeine<TableIdentifier, Table> cacheBuilder = Caffeine
.newBuilder()
.softValues()
- .removalListener(identLoggingRemovalListener);
+ .removalListener(hasExpiration ? new
MetadataTableInvalidatingRemovalListener() : identLoggingRemovalListener);
Review comment:
Nit: all of the stuff that gets added due to expiration should ideally
be inside of the `if (hasExpiration)` block or in the return statement after
that section if it's for non-expiring cache (i.e. the
`identLoggingRemovalListener` here).
Can you split this line into that block (and the block after it for the
`identLoggingRemovalListener`.
##########
File path: core/src/main/java/org/apache/iceberg/CachingCatalog.java
##########
@@ -86,16 +85,15 @@ protected CachingCatalog(Catalog catalog, boolean
caseSensitive, long expiration
}
/**
- * CacheWriter class for removing metadata tables when their associated data
table is expired
+ * RemovalListener class for removing metadata tables when their associated
data table is expired
* via cache expiration.
+ *
+ * @see com.github.benmanes.caffeine.cache.RemovalListener
Review comment:
Nit: This `@see` doesn't seem necessary to me given that we're directly
implementing `RemovalListener` on the next line.
--
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]