This is an automated email from the ASF dual-hosted git repository.
rdblue pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/main by this push:
new 3deb2b6617 Core: Fix confusing message in RemoveSnapshots and fix
flaky test (#19031)
3deb2b6617 is described below
commit 3deb2b6617be2f7047a6e9b830b755f8a62e9ca3
Author: Anoop Johnson <[email protected]>
AuthorDate: Thu Nov 19 12:04:02 2026 -0800
Core: Fix confusing message in RemoveSnapshots and fix flaky test (#19031)
Follow-up to https://github.com/apache/iceberg/pull/19006.
---
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java | 2 +-
core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java | 9 ++++-----
2 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
b/core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
index 518fccf48f..f4c3dfbb61 100644
--- a/core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
+++ b/core/src/main/java/org/apache/iceberg/RemoveSnapshots.java
@@ -198,7 +198,7 @@ class RemoveSnapshots implements ExpireSnapshots {
ValidationException.check(
CleanupLevel.NONE == cleanupLevel || !hasRootManifestSnapshot(base),
"File cleanup for V4 tables is not supported. "
- + "Use CleanupLevel.NONE to cleanup snapshot metadata.");
+ + "Use CleanupLevel.NONE to skip file cleanup.");
// attempt to clean expired metadata even if there are no snapshots to
expire
// table metadata builder takes care of the case when this should actually
be a no-op
diff --git a/core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java
b/core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java
index fea20dfd6e..5aafa83a88 100644
--- a/core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java
+++ b/core/src/test/java/org/apache/iceberg/TestRemoveSnapshotsV4.java
@@ -35,9 +35,8 @@ import org.junit.jupiter.params.provider.EnumSource;
class TestRemoveSnapshotsV4 {
private static final String CLEANUP_UNSUPPORTED_MESSAGE =
"File cleanup for V4 tables is not supported. "
- + "Use CleanupLevel.NONE to cleanup snapshot metadata.";
+ + "Use CleanupLevel.NONE to skip file cleanup.";
private static final long ROOT_MANIFEST_SNAPSHOT_ID = 42L;
- private static final long FAR_FUTURE_MS = System.currentTimeMillis() +
100_000;
@TempDir private File tableDir;
@@ -58,7 +57,7 @@ class TestRemoveSnapshotsV4 {
() ->
table
.expireSnapshots()
- .expireOlderThan(FAR_FUTURE_MS)
+ .expireOlderThan(table.currentSnapshot().timestampMillis()
+ 1)
.retainLast(1)
.cleanupLevel(cleanupLevel)
.commit())
@@ -70,13 +69,13 @@ class TestRemoveSnapshotsV4 {
}
@Test
- void allowsMetadataOnlyRemovalWithRootManifestSnapshot() {
+ void allowsExpirationWithoutFileCleanupWithRootManifestSnapshot() {
Table table = tableWithRootManifestSnapshot();
Set<String> deletedFiles = Sets.newHashSet();
table
.expireSnapshots()
- .expireOlderThan(FAR_FUTURE_MS)
+ .expireOlderThan(table.currentSnapshot().timestampMillis() + 1)
.retainLast(1)
.cleanupLevel(ExpireSnapshots.CleanupLevel.NONE)
.deleteWith(deletedFiles::add)