This is an automated email from the ASF dual-hosted git repository.
xuba pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new 05ff059df [Improvement] Move snapshot ID capture in expireFiles() to
after delete commit (#4169)
05ff059df is described below
commit 05ff059df3be0e8769691cbcb57c0338e508b74e
Author: Jiwon Park <[email protected]>
AuthorDate: Tue Apr 7 11:42:10 2026 +0900
[Improvement] Move snapshot ID capture in expireFiles() to after delete
commit (#4169)
Move snapshot ID capture in expireFiles() to after delete commit
The snapshot ID passed to RewriteFiles.validateFromSnapshot() was
captured before DeleteFiles.commit(), making it stale for the
subsequent RewriteFiles operation. Although the current validation
path is benign (replacedDataFiles is empty so conflict detection is
skipped), passing a pre-commit snapshot ID is semantically incorrect
and fragile against future Iceberg validation changes.
Move the capture to after delete.commit() so that
validateFromSnapshot() always receives the up-to-date snapshot.
Signed-off-by: Jiwon Park <[email protected]>
---
.../apache/amoro/formats/iceberg/maintainer/IcebergTableMaintainer.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/maintainer/IcebergTableMaintainer.java
b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/maintainer/IcebergTableMaintainer.java
index 2a96a0e9a..eb89c07c0 100644
---
a/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/maintainer/IcebergTableMaintainer.java
+++
b/amoro-format-iceberg/src/main/java/org/apache/amoro/formats/iceberg/maintainer/IcebergTableMaintainer.java
@@ -875,7 +875,6 @@ public class IcebergTableMaintainer implements
TableMaintainer {
}
public void expireFiles(ExpireFiles expiredFiles, long expireTimestamp) {
- long snapshotId = IcebergTableUtil.getSnapshotId(table, false);
Queue<DataFile> dataFiles = expiredFiles.dataFiles;
Queue<DeleteFile> deleteFiles = expiredFiles.deleteFiles;
if (dataFiles.isEmpty() && deleteFiles.isEmpty()) {
@@ -890,6 +889,7 @@ public class IcebergTableMaintainer implements
TableMaintainer {
delete.commit();
// expire delete files
if (!deleteFiles.isEmpty()) {
+ long snapshotId = IcebergTableUtil.getSnapshotId(table, false);
RewriteFiles rewriteFiles =
table.newRewrite().validateFromSnapshot(snapshotId);
deleteFiles.forEach(rewriteFiles::deleteFile);
rewriteFiles.set(