adutra commented on code in PR #4934:
URL: https://github.com/apache/polaris/pull/4934#discussion_r3498062295
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalogHandler.java:
##########
@@ -1272,19 +1275,36 @@ public void commitTransaction(CommitTransactionRequest
commitTransactionRequest)
// Commit all accumulated changes for this table in a single atomic
operation
if (!currentMetadata.changes().isEmpty()) {
tableOps.commit(baseMetadata, currentMetadata);
+ tableFileIOs.put(tableIdentifier, tableOps.io());
}
tableMetadataObjs.add(currentMetadata);
});
- // Commit the collected updates in a single atomic operation
+ // Extract newly written metadata locations from the buffered entity
updates.
+ // We cannot use tableOps.current().metadataFileLocation() because
requestRefresh()
+ // causes doRefresh() to read from the store where the entity hasn't been
persisted yet.
+ // The pendingUpdates entities have the correct new location set by
doCommit().
List<EntityWithPath> pendingUpdates =
transactionMetaStoreManager.getPendingUpdates();
+ List<Map.Entry<FileIO, String>> writtenMetadataFiles =
Review Comment:
`List<Map.Entry<>>` is a bit awkward, maybe introduce a record? E.g.
```java
record FileToDelete(FileIO io, String location) {
void cleanup() {
try {
io.deleteFile(location);
} catch (Exception e) {
LOGGER.warn("Failed to clean up metadata file {} after transaction
failure", location, e);
}
}
}
```
--
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]