Skip to content

fix: preserve overlays across rebased deletes - #9218

Merged
wjones127 merged 2 commits into
mainfrom
gatekeeper/fix-9216-1
Sep 17, 2026
Merged

wjones127 merged 2 commits into
mainfrom
gatekeeper/fix-9216-1

Conversation

@lance-gatefixer

@lance-gatefixer lance-gatefixer Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • apply a staged delete deletion file to the current fragment instead of replacing the fragment with its stale post-image
  • preserve concurrent overlays, stable-row lineage, and other current fragment state across delete rebases
  • strengthen the delete manifest regression to cover the deletion file, overlay, and row-version metadata together

Root cause

The Delete manifest arm replaced an updated fragment wholesale with a post-image built at the transaction read version. Because conflict resolution permits concurrent fragment-preserving operations such as DataOverlay, that replacement discarded state present only in the newer current manifest.

Validation

  • cargo test -p lance-table
  • cargo fmt --all
  • cargo clippy --all --tests --benches -- -D warnings

Fixes #9216

@github-actions github-actions Bot added the bug Something isn't working label Sep 14, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Gate recommendation: request changes.

Preserving the overlay file is necessary, but a rebased delete must also preserve the current fragment state that gives the overlay its semantics. Apply the staged deletion to the current fragment instead of replacing it with a stale post-image so overlay lineage and other concurrently committed fragment state survive.

// The post-image was built at the transaction's read
// version, so carry forward overlays that may have been
// committed while the delete was being rebased.
updated.overlays = f.overlays.clone();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This preserves the overlay file but leaves last_updated_at_version_meta from the stale delete post-image. On a stable-row-id dataset, DataOverlay stamps every covered row to its commit version; after this delete rebases, the overlay value remains while its row version rewinds. DatasetDelta::get_updated_rows filters on that version, so downstream change-data consumers silently miss the overlay update.

Start from the current fragment and apply only the staged deletion file (or otherwise preserve current lineage together with the overlay). That also avoids the same stale-post-image mechanism tracked in #9217.

Reproducer

Added temporarily beside the existing manifest tests and ran cargo test -p lance-table test_delete_build_manifest_preserves_concurrent_overlay_lineage:

#[test]
fn test_delete_build_manifest_preserves_concurrent_overlay_lineage() {
    let row_ids = RowIdSequence::from([10u64, 11].as_slice());
    let version_meta = RowDatasetVersionMeta::from_sequence(
        &RowDatasetVersionSequence::from_uniform_row_count(2, 1),
    )
    .unwrap();
    let fragment = Fragment {
        id: 1,
        files: vec![],
        overlays: vec![],
        deletion_file: None,
        row_id_meta: Some(RowIdMeta::Inline(write_row_ids(&row_ids).into())),
        physical_rows: Some(2),
        last_updated_at_version_meta: Some(version_meta.clone()),
        created_at_version_meta: Some(version_meta),
    };
    let base = make_stable_row_id_manifest(vec![fragment.clone()]);
    let overlay = Transaction::new(
        base.version,
        Operation::DataOverlay {
            groups: vec![DataOverlayGroup {
                fragment_id: 1,
                overlays: vec![overlay_with_field(0, 0)],
            }],
        },
        None,
    );
    let (current, _) = overlay
        .build_manifest(Some(&base), vec![], "overlay", &default_build_config())
        .unwrap();
    assert_eq!(last_updated_at_versions(&current, 1), vec![5, 1]);

    let delete = Transaction::new(
        base.version,
        Operation::Delete {
            updated_fragments: vec![fragment],
            deleted_fragment_ids: vec![],
            predicate: "id = 11".to_string(),
        },
        None,
    );
    let (rebased, _) = delete
        .build_manifest(Some(&current), vec![], "delete", &default_build_config())
        .unwrap();

    assert_eq!(rebased.fragments[0].overlays.len(), 1);
    assert_eq!(last_updated_at_versions(&rebased, 1), vec![5, 1]);
}

The final assertion failed with left: [1, 1], right: [5, 1].

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 6db5faa: rebased deletes now retain the current fragment and apply only the staged deletion file, preserving overlay lineage and all other concurrent fragment state. The regression now covers the deletion file, overlay, and row-version metadata together.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 6db5faac4: the delete now applies only its staged deletion file to the current fragment, preserving both concurrent overlays and their row-version lineage. The regression covers the deletion file, overlay, and last_updated_at_version_meta together.

@lance-gatekeeper lance-gatekeeper Bot added the K-changes Latest Gatekeeper recommendation requests changes. label Sep 14, 2026
@lance-gatekeeper lance-gatekeeper Bot removed the K-changes Latest Gatekeeper recommendation requests changes. label Sep 14, 2026

@lance-gatekeeper lance-gatekeeper Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Gate recommendation: approve.

The prior row-lineage issue is fixed. Applying only the staged deletion file to the current fragment preserves concurrent overlays, lineage, and other fragment state, and the regression covers those invariants together.

@lance-gatekeeper lance-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 14, 2026
@wjones127
wjones127 merged commit 2534657 into main Sep 17, 2026
39 of 41 checks passed
@wjones127
wjones127 deleted the gatekeeper/fix-9216-1 branch September 17, 2026 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: a legacy Delete drops a concurrently committed DataOverlay

1 participant