Skip to content

Core: Clean expired metadata even if there is no snapshot to expire #13322

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 18, 2025

Conversation

lirui-apache
Copy link
Contributor

This fixes #13294

@github-actions github-actions bot added the core label Jun 16, 2025
@@ -1799,6 +1799,33 @@ public void testExpireSnapshotsWithExecutor() {
.isGreaterThan(0);
}

@TestTemplate
public void testRemoveMetadataWithNoSnapshots() throws Exception {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a test where there is no snapshots, and no metadata change either? Just to ensure that we do not fail?

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lirui-apache I agree with the fix though it'd be good to have the additional test that @pvary mentioned.

@lirui-apache
Copy link
Contributor Author

Update to add test. Thanks @pvary @amogh-jahagirdar for reviewing

Comment on lines 1805 to 1812
removeSnapshots(table)
.expireOlderThan(System.currentTimeMillis())
.retainLast(1)
.cleanExpiredMetadata(true)
.commit();
assertThat(table.ops().current())
.as("No snapshot or metadata to remove, should be a no-op")
.isSameAs(current);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lirui-apache I think I'd prefer to pull this out to a separate test testRemoveSnapshotsNoOp(), it's generally better to keep tests focused on a single aspect we're trying to test rather than have multiple assertions for different cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, updated accordingly

Copy link
Contributor

@amogh-jahagirdar amogh-jahagirdar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @lirui-apache this looks good to me now! I'll hold before merging in case @pvary has any other comments

@pvary pvary merged commit cdd2b5b into apache:main Jun 18, 2025
42 checks passed
@pvary
Copy link
Contributor

pvary commented Jun 18, 2025

Merged to main.
Thanks @lirui-apache for the fix and @amogh-jahagirdar for the review!

@lirui-apache
Copy link
Contributor Author

Thanks @pvary @amogh-jahagirdar for reviewing and merging!

@lirui-apache lirui-apache deleted the iceberg-13294 branch June 19, 2025 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clean expired metadata doesn't work when there is no snapshot
3 participants