amogh-jahagirdar commented on code in PR #13614:
URL: https://github.com/apache/iceberg/pull/13614#discussion_r2227018502
##########
core/src/main/java/org/apache/iceberg/RemoveSnapshots.java:
##########
@@ -390,4 +391,41 @@ private void cleanExpiredSnapshots() {
cleanupStrategy.cleanFiles(base, current);
}
+
+ private void validateCleanupCanBeIncremental(TableMetadata current) {
+ if (specifiedSnapshotId) {
+ throw new UnsupportedOperationException(
+ "Cannot clean files incrementally when snapshot IDs are specified");
+ }
+
+ if (!hasOnlyMainBranch(base) || !hasOnlyMainBranch(current)) {
+ throw new UnsupportedOperationException(
+ "Cannot incrementally clean files for tables with more than 1 ref");
+ }
+
+ if (!allSnapshotsAreInMain(base) || !allSnapshotsAreInMain(current)) {
+ throw new UnsupportedOperationException(
+ "Cannot incrementally clean files when there are snapshots outside
of main");
+ }
+ }
+
+ private boolean hasOnlyMainBranch(TableMetadata metadata) {
+ return metadata.refs().size() == 1 &&
metadata.refs().containsKey(SnapshotRef.MAIN_BRANCH);
Review Comment:
Ok, I forgot that we actually don't return a main ref with -1, no ref would
be surfaced. I'll need to fix that as well
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]