manuzhang commented on code in PR #19027:
URL: https://github.com/apache/iceberg/pull/19027#discussion_r4734471029
##########
core/src/main/java/org/apache/iceberg/BaseRewriteManifests.java:
##########
@@ -284,17 +295,45 @@ private boolean matchesPredicate(ManifestFile manifest) {
}
private void validateDeletedManifests(
- Set<ManifestFile> currentManifests, long currentSnapshotID) {
- // directly deleted manifests must be still present in the current snapshot
- deletedManifests.stream()
- .filter(manifest -> !currentManifests.contains(manifest))
- .findAny()
- .ifPresent(
- manifest -> {
- throw new ValidationException(
- "Deleted manifest %s could not be found in the latest
snapshot %d",
- manifest.path(), currentSnapshotID);
- });
+ Map<String, ManifestFile> currentManifestsByPath, long
currentSnapshotID) {
+ for (ManifestFile manifest : deletedManifests) {
+ // directly deleted manifests must be still present in the current
snapshot
+ ManifestFile current = currentManifestsByPath.get(manifest.path());
+ ValidationException.check(
+ current != null,
+ "Deleted manifest %s could not be found in the latest snapshot %d",
+ manifest.path(),
+ currentSnapshotID);
+
+ // a replacement written from the entries of a manifest that inherits
other metadata now would
+ // not have it
+ ValidationException.check(
+ inheritsSameMetadata(manifest, current),
Review Comment:
Could we save the resolved manifest metadata on the first validation and
compare it on retry? Otherwise, it will commit stale sequence numbers in V2–V4
and a stale first row ID in V3–V4
--
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]