huaxingao commented on code in PR #3205:
URL: https://github.com/apache/polaris/pull/3205#discussion_r2665797135


##########
persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/idempotency/PostgresIdempotencyStore.java:
##########
@@ -143,7 +144,23 @@ public boolean updateHeartbeat(
                       realmId,
                       idempotencyKey,
                       executorId)));
-      return rows > 0;
+      if (rows > 0) {
+        return HeartbeatResult.UPDATED;
+      }
+
+      // No rows updated: determine why by loading the current record, if any.
+      Optional<IdempotencyRecord> existing = load(realmId, idempotencyKey);

Review Comment:
   Good idea! For now I kept the simple UPDATE + load pattern, but I added a 
`TODO` noting a potential future optimization using `UPDATE ... RETURNING` or a 
transactional read so we can make this fully atomic if needed later.



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