Skip to content

Spark 4.2: Validate snapshot when removing dangling deletes - #18061

Open
manuzhang wants to merge 2 commits into
apache:mainfrom
manuzhang:spark42-validate-dangling-deletes
Open

Spark 4.2: Validate snapshot when removing dangling deletes#18061
manuzhang wants to merge 2 commits into
apache:mainfrom
manuzhang:spark42-validate-dangling-deletes

Conversation

@manuzhang

@manuzhang manuzhang commented Sep 11, 2026

Copy link
Copy Markdown
Member

A rollback between dangling-delete discovery and commit can restore data files that still need the candidate deletes. The cleanup rewrite can then rebase onto the restored snapshot and remove valid deletes, making deleted rows visible again.

Pin all metadata scans to the planning snapshot and validate that it is still current inside every commit attempt, including retries. Cleanup fails with a ValidationException if the snapshot changes; tables without a snapshot remain a no-op. This change is limited to Spark 4.2 and uses the existing core validation API.

Adds regression coverage for rollback before commit, rollback during a commit retry, snapshot changes during planning, and empty tables. The concurrency tests use a fixed v2 table and position-delete file. Related to #13120.

Validation:

  • Spark 4.2 TestRemoveDanglingDeleteAction: 18 tests, 17 passed and 1 expected skip.
  • The three concurrency regressions fail against the original implementation.
  • Spark 4.2 spotlessCheck.

AI Disclosure

  • Model: GPT-6
  • Platform/Tool: Codex
  • Human Oversight: reviewed
  • Prompt Summary: Fix dangling-delete cleanup races in Spark 4.2 using core commit-time snapshot validation, add regression tests, and open a PR.

Pin dangling-delete discovery to one snapshot and validate that snapshot
on every commit attempt so concurrent rollbacks cannot remove valid deletes.

Generated-by: Codex
@github-actions github-actions Bot added the spark label Sep 11, 2026
Use a fixed v2 table and position-delete file because these tests exercise
snapshot concurrency rather than differences between table formats.

Generated-by: Codex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant