amogh-jahagirdar commented on code in PR #12401: URL: https://github.com/apache/iceberg/pull/12401#discussion_r1981745209
########## core/src/main/java/org/apache/iceberg/view/ViewMetadata.java: ########## @@ -462,9 +463,18 @@ public ViewMetadata build() { ViewProperties.VERSION_HISTORY_SIZE, historySize); - // expire old versions, but keep at least the versions added in this builder - int numAddedVersions = (int) changes(MetadataUpdate.AddViewVersion.class).count(); - int numVersionsToKeep = Math.max(numAddedVersions, historySize); + // expire old versions, but keep at least the versions added in this builder and the current + // version + int numVersions = + ImmutableSet.builder() + .addAll( + changes(MetadataUpdate.AddViewVersion.class) + .map(v -> v.viewVersion().versionId()) + .collect(Collectors.toSet())) + .add(currentVersionId) + .build() + .size(); Review Comment: Ah yeah good point @nastra @gaborkaszab , I agree with that. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org