openinx commented on code in PR #14440:
URL: https://github.com/apache/iceberg/pull/14440#discussion_r4542100503
##########
core/src/main/java/org/apache/iceberg/CachingCatalog.java:
##########
@@ -67,23 +108,61 @@ public static Catalog wrap(
@SuppressWarnings("checkstyle:VisibilityModifier")
protected final long expirationIntervalMillis;
+ @SuppressWarnings("checkstyle:VisibilityModifier")
+ protected long expireAfterWriteIntervalMillis;
+
@SuppressWarnings("checkstyle:VisibilityModifier")
protected final Cache<TableIdentifier, Table> tableCache;
- private CachingCatalog(Catalog catalog, boolean caseSensitive, long
expirationIntervalMillis) {
- this(catalog, caseSensitive, expirationIntervalMillis,
Ticker.systemTicker());
+ private CachingCatalog(
+ Catalog catalog,
+ boolean caseSensitive,
+ long expirationIntervalMillis,
+ long expireAfterWriteIntervalMillis) {
+ this(
+ catalog,
+ caseSensitive,
+ expirationIntervalMillis,
+ expireAfterWriteIntervalMillis,
+ Ticker.systemTicker());
}
+ /**
+ * Caching Catalog
+ *
+ * @deprecated since 1.11.1, will be removed in 1.12.0; use {@link
#CachingCatalog(Catalog,
+ * boolean, long, long, Ticker)} instead.
+ */
+ @Deprecated
+ @VisibleForTesting
@SuppressWarnings("checkstyle:VisibilityModifier")
protected CachingCatalog(
Catalog catalog, boolean caseSensitive, long expirationIntervalMillis,
Ticker ticker) {
+ this(
+ catalog,
+ caseSensitive,
+ expirationIntervalMillis,
+ CatalogProperties.CACHE_EXPIRATION_AFTER_WRITE_INTERVAL_MS_DEFAULT,
+ ticker);
+ }
+
+ @VisibleForTesting
+ CachingCatalog(
+ Catalog catalog,
+ boolean caseSensitive,
+ long expirationIntervalMillis,
+ long expireAfterWriteIntervalMillis,
+ Ticker ticker) {
Preconditions.checkArgument(
- expirationIntervalMillis != 0,
- "When %s is set to 0, the catalog cache should be disabled. This
indicates a bug.",
- CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS);
+ expirationIntervalMillis != 0 && expireAfterWriteIntervalMillis != 0,
Review Comment:
nit : are those configs allowed to be negative ? otherwise I'd prefer to add
precondition to check the positiveness
--
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]