mvanhorn commented on code in PR #10625:
URL: https://github.com/apache/paimon/pull/10625#discussion_r4385518594
##########
paimon-core/src/main/java/org/apache/paimon/utils/TagManager.java:
##########
@@ -181,6 +416,15 @@ private void createOrReplaceTag(
e);
}
+ if (rollbackIfSnapshotExpired) {
+ try {
+ ensureSnapshotRetained(snapshot, tagName, true);
+ } catch (RuntimeException e) {
+ fileIO.deleteQuietly(tagPath);
Review Comment:
Fixed in 2fb7c3a. `createTag` now publishes with `fileIO.tryToWriteAtomic`
(temp file plus a rename that won't overwrite) in place of `overwriteFileUtf8`.
Once one creator's publication of a name succeeds, a second creator can't
replace it. Its write returns false, it drops its own pending marker, and it
goes through the existing path: without `ignoreIfExists` it fails with "already
exists", and with it, it waits for the other creator to settle. A creator
therefore only rolls back a file it wrote itself. `replaceTag` and the other
overwrite callers still use `overwriteFileUtf8`.
Test: `testOverlappingCreatorsCannotOverwriteProvisionalTag` runs your
schedule. B is not acknowledged with a snapshot-4 tag that later disappears. It
fails on 7ba4304.
One limit: this relies on rename refusing to overwrite. That holds on HDFS
and local FS. On object stores it holds only under the same catalog lock that
snapshot commits already depend on. ExpireSnapshotsTest, TagManagerTest,
TagTest and TagAutoManagerTest pass on JDK 11 (74 tests), and spotless and
checkstyle pass on paimon-core.
<!-- r:cec9f7dcedc8.e063ebdb1cb5 -->
--
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]