← Back to Pull requests

Core: Skip DV cleanup when live manifests are incomplete #19204

Open
ebyhr opened this pull request with 75 lines diff across 2 files
View on GitHub
ebyhr ebyhr commented on Nov 30, 2026 03:50 UTC
Author

A failed manifest list read left liveDeleteManifests incomplete, so a Puffin file shared with a live DV could be deleted.

Diff: 75 lines (+68 / -7) across 2 files Reviewer: ebyhr Review duration: 2375m
All Vouch review confidence checks passed
Residual risk 0.11 = Change Risk (0.44) × (1 − Review Confidence (0.75)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 75 lines diff across 2 files
0.44
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.83 · 1 substantive comment(s)
0.83
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
75%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.259
Self Review self_review
0.140
Real PR Conversation Timeline
2 items
ebyhr ebyhr commented on code on Nov 30, 2026 03:50 UTC
Code Review
core/src/test/java/org/apache/iceberg/TestRemoveSnapshots.java:1
@@ -2214,6 +2214,58 @@ void expireDeletesPuffinFileWhenAllSharedDeletionVectorsReplaced() {
     assertThat(deletedFiles).contains(sharedPuffinPath);
   }
 
+  @TestTemplate
+  void expireKeepsSharedPuffinFileWhenRetainedManifestListUnreadable() {
+    assumeThat(formatVersion).as("Deletion vectors require V3 or later").isGreaterThanOrEqualTo(3);
+    assumeThat(incrementalCleanup).isTrue();
+
+    table.newAppend().appendFile(FILE_A).appendFile(FILE_B).commit();
+
+    String sharedPuffinPath = "/path/to/shared-dvs-" + UUID.randomUUID() + ".puffin";
+    DeleteFile dvA = deletionVector(sharedPuffinPath, FILE_A, 4L);
+    DeleteFile dvB = deletionVector(sharedPuffinPath, FILE_B, 44L);
+    table.newRowDelta().addDeletes(dvA).addDeletes(dvB).commit();
+
+    // replacing dvA expires; dvB stays live in the shared file for the retained snapshot
+    DeleteFile newDvA =
+        deletionVector("/path/to/new-dv-a-" + UUID.randomUUID() + ".puffin", FILE_A, 4L);
+    table
+        .newRowDelta()
+        .validateFromSnapshot(table.currentSnapshot().snapshotId())
+        .removeDeletes(dvA)
+        .addDeletes(newDvA)
+        .commit();
+
+    table.newAppend().appendFile(FILE_C).commit();
+    Snapshot retained = table.currentSnapshot();
+
+    // only a later snapshot stops referencing dvB
+    DeleteFile newDvB =
+        deletionVector("/path/to/new-dv-b-" + UUID.randomUUID() + ".puffin", FILE_B, 4L);
+    table
+        .newRowDelta()
+        .validateFromSnapshot(retained.snapshotId())
+        .removeDeletes(dvB)
+        .addDeletes(newDvB)
+        .commit();
+
+    long tAfterCommits = waitUntilAfter(table.currentSnapshot().timestampMillis());
+
+    table.io().deleteFile(retained.manifestListLocation());
+
+    Set<String> deletedFiles = Sets.newHashSet();
+    removeSnapshots(table)
+        .retainLast(2)
+        .expireOlderThan(tAfterCommits)
+        .deleteWith(deletedFiles::add)
+        .commit();
+
+    assertThat(table.snapshot(retained.snapshotId())).isNotNull();
+    assertThat(deletedFiles)
+        .as("Puffin file must be kept when live deletion vectors cannot be determined")
+        .doesNotContain(sharedPuffinPath);

This assertion fails if we revert this PR:

java.lang.AssertionError: [Puffin file must be kept when live deletion vectors cannot be determined] 
Expecting
  ["/var/folders/9s/_zwn4r_n2_9bp0krllp1pl3c0000gp/T/junit-4226703397745214989/metadata/c7fbdd11-77a9-47eb-abf7-6429b23b8b53-m0.avro",
    "/var/folders/9s/_zwn4r_n2_9bp0krllp1pl3c0000gp/T/junit-4226703397745214989/metadata/snap-1-1-ad57a407-383c-4ad5-ac89-79b5d7a3171e.avro",
    "/var/folders/9s/_zwn4r_n2_9bp0krllp1pl3c0000gp/T/junit-4226703397745214989/metadata/snap-2-1-322da627-3a8e-468f-8fa1-331a5c9dfe27.avro",
    "/var/folders/9s/_zwn4r_n2_9bp0krllp1pl3c0000gp/T/junit-4226703397745214989/metadata/322da627-3a8e-468f-8fa1-331a5c9dfe27-m0.avro",
    "/var/folders/9s/_zwn4r_n2_9bp0krllp1pl3c0000gp/T/junit-4226703397745214989/metadata/snap-3-1-c7fbdd11-77a9-47eb-abf7-6429b23b8b53.avro",
    "/path/to/shared-dvs-142fa9db-12d2-4410-a2b7-385c7ee98a52.puffin"]
not to contain
  ["/path/to/shared-dvs-142fa9db-12d2-4410-a2b7-385c7ee98a52.puffin"]
but found
  ["/path/to/shared-dvs-142fa9db-12d2-4410-a2b7-385c7ee98a52.puffin"]

Reviewers
Assignees
ebyhr ebyhr
Labels
risk: low confidence: 75.4% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 44.4% (MEDIUM) · Higher = larger blast radius
44.4%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 75.4% · Lower = rushed or shallow review
75.4%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 10.9% · Safe to merge
10.9%
Repository