ahmedabu98 commented on code in PR #41248:
URL: https://github.com/apache/beam/pull/41248#discussion_r4747284814


##########
sdks/java/io/iceberg/src/main/java/org/apache/beam/sdk/io/iceberg/TableMetadataDriver.java:
##########
@@ -520,7 +520,9 @@ public void processElement(
       if (newSpec != null) {
         ReadableState<SerializableTableSpec> existingState = 
cacheState.get(tableId);
         SerializableTableSpec existingSpec = existingState != null ? 
existingState.read() : null;
-        if (existingSpec == null || isNewer(newSpec, existingSpec)) {
+        // Keep the cached spec only if it's newer. A poll of an unchanged 
table still brings the
+        // storage credentials the catalog just vended, and the cached ones 
may be about to expire.
+        if (existingSpec == null || !isNewer(existingSpec, newSpec)) {

Review Comment:
   Thanks, I added polledAtMillis.
   isNewer now uses it to pick the later poll when the metadata is the same. 
Added tests too



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

Reply via email to