-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Conversation
@@ -1799,6 +1799,33 @@ public void testExpireSnapshotsWithExecutor() { | |||
.isGreaterThan(0); | |||
} | |||
|
|||
@TestTemplate | |||
public void testRemoveMetadataWithNoSnapshots() throws Exception { |
There was a problem hiding this comment.
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?
There was a problem hiding this 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.
Update to add test. Thanks @pvary @amogh-jahagirdar for reviewing |
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, updated accordingly
There was a problem hiding this 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
Merged to main. |
Thanks @pvary @amogh-jahagirdar for reviewing and merging! |
This fixes #13294