stevenzwu commented on code in PR #6111: URL: https://github.com/apache/iceberg/pull/6111#discussion_r1016788395
########## flink/v1.14/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalogFactory.java: ########## @@ -145,8 +145,27 @@ protected Catalog createCatalog( baseNamespace = Namespace.of(properties.get(BASE_NAMESPACE).split("\\.")); } - boolean cacheEnabled = Boolean.parseBoolean(properties.getOrDefault(CACHE_ENABLED, "true")); - return new FlinkCatalog(name, defaultDatabase, baseNamespace, catalogLoader, cacheEnabled); + boolean cacheEnabled = CatalogProperties.CACHE_ENABLED_DEFAULT; + if (properties.containsKey(CatalogProperties.CACHE_ENABLED)) { + cacheEnabled = Boolean.parseBoolean(properties.get(CatalogProperties.CACHE_ENABLED)); + } + + long cacheExpirationIntervalMs = + PropertyUtil.propertyAsLong( + properties, + CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS, + CatalogProperties.CACHE_EXPIRATION_INTERVAL_MS_DEFAULT); + if (cacheExpirationIntervalMs == 0) { Review Comment: if we look at the code of `CachingCatalog`, it only check positive values. Hence don't understand why we need value zero to disable caching since we already have the boolean flag. `positive` refresh interval would be caching with expiration. otherwise, it is caching without expiration (until refreshed). ``` private Cache<TableIdentifier, Table> createTableCache(Ticker ticker) { Caffeine<Object, Object> cacheBuilder = Caffeine.newBuilder().softValues(); if (expirationIntervalMillis > 0) { return cacheBuilder .removalListener(new MetadataTableInvalidatingRemovalListener()) .executor(Runnable::run) // Makes the callbacks to removal listener synchronous .expireAfterAccess(Duration.ofMillis(expirationIntervalMillis)) .ticker(ticker) .build(); } return cacheBuilder.build(); } ``` -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org