mvanhorn opened a new pull request, #10625:
URL: https://github.com/apache/paimon/pull/10625

   ### Purpose
   
   A tag created while snapshots are expiring can return success and then fail 
to read. Time travel through that tag hits a missing file, because manifest and 
data files it still references were deleted after the tag write. 
ExpireSnapshotsImpl records tagged snapshots once and reuses that fixed list 
for data-file and manifest cleanup, deleting snapshot metadata only afterward. 
TagManager.createTag writes the tag on its own, with no shared lock or later 
recheck, so a tag committed after that collection is left out of the skip set. 
A snapshot-existence check around the write still passes, because the snapshot 
file is removed only after those referenced files are already gone.
   
   Each table path and branch has one reentrant lock, stored in a static map 
and shared by every TagManager for that key. ExpireSnapshotsImpl holds it from 
collectTaggedSnapshots through snapshot deletion, and TagManager.createTag 
holds it across the existence check, ensureSnapshotRetained, and the tag 
metadata write. ensureSnapshotRetained allows the write when the snapshot still 
exists or an existing tag already retains that snapshot id; otherwise it throws 
SnapshotNotExistException and writes no tag. Both paths release the lock in a 
finally block, including when expiration or the tag write fails.
   
   Fixes #9220
   
   ### Tests
   
   mvn -B -ntp -pl paimon-core -am test -Dtest=ExpireSnapshotsTest 
-Dsurefire.failIfNoSpecifiedTests=false finished with ExpireSnapshotsTest at 41 
tests, 0 failures, 0 errors, and 0 skipped.
   The tests in 
`paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java`
 fail without the fix in the paimon ExpireSnapshotsImpl change (checked by 
reverting the source 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]

Reply via email to