mxm commented on code in PR #14792:
URL: https://github.com/apache/iceberg/pull/14792#discussion_r2606082966


##########
flink/v2.0/flink/src/main/java/org/apache/iceberg/flink/sink/dynamic/TableMetadataCache.java:
##########
@@ -207,9 +207,26 @@ private Tuple2<Boolean, Exception> 
refreshTable(TableIdentifier identifier) {
   }
 
   private boolean needsRefresh(CacheItem cacheItem, boolean allowRefresh) {
-    return allowRefresh
-        && (cacheItem == null
-            || cacheRefreshClock.millis() - cacheItem.createdTimestampMillis > 
refreshMs);
+    if (!allowRefresh) {
+      return false;
+    }
+
+    if (cacheItem == null) {
+      return true;
+    }
+
+    long nowMillis = cacheRefreshClock.millis();
+    long timeElapsedMillis = nowMillis - cacheItem.createdTimestampMillis;
+    if (timeElapsedMillis > refreshMs) {
+      LOG.info(

Review Comment:
   That's a fair point, but the refresh interval is per-table. So if you have a 
lot of tables, you will initially see loads of catalog calls. Afterwards, it is 
probably fine. 
   
   I just realized you only added logging for cache misses when the cache is 
already populated, I think that may be fine. Cache misses should only occur on 
schema changes.



-- 
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]

Reply via email to