Repository navigation
Scope concurrent delete-file conflicts by partition - #4508
Open
harshilv17 wants to merge 1 commit into
Open
harshilv17 wants to merge 1 commit into
harshilv17 wants to merge 1 commit into
Conversation
Commit validation checked concurrent delete files only against the data filter's column metrics, which position deletes and deletion vectors don't have for data columns, so any delete file committed in another partition failed a partition-filtered delete or overwrite. Project the data filter onto each delete file's spec, as Java's DeleteFileIndex does, and skip delete files whose partition can't match.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4507
Rationale for this change
On a commit retry,
_validate_no_new_delete_filesis called withpartition_set=None, and_added_delete_filescan only rule out a delete file by its column stats. Position deletes and deletion vectors have no stats on data columns, so a delete file committed concurrently in any partition fails a partition-filtereddelete()oroverwrite(). This shows up on tables shared with Spark or Flink merge-on-read writers. It was raised in the #3320 review and deferred with a code comment.Java scopes this by partition:
DeleteFileIndex.Builderprojects the data filter onto each spec withProjections.inclusive(spec, caseSensitive)and filters delete manifest entries by partition. This change does the same in_added_delete_files: when adata_filteris given, it builds a per-spec evaluator frominclusive_projection+expression_evaluator(asDataScan._build_partition_evaluatordoes) and skips delete files whose partition can't match. A filter on non-partition columns projects toAlwaysTrue, so those delete files still count as conflicts. The comment deferring this insnapshot.pyis removed.Are these changes tested?
Yes.
test_partition_filtered_write_validates_concurrent_position_delete_by_partitionintests/table/test_commit_retry.pycommits a concurrent position delete (with the existingcommit_partition_position_deletehelper) in the written partition and in another one, for bothdeleteandoverwrite, on each catalog fixture. On main the other-partition cases fail withValidationException: Found new conflicting delete files; with this change they succeed, and the same-partition cases still conflict.test_added_delete_files_case_insensitive_filterused a mock delete file withpartition=Noneon a table partitioned byx, which a real manifest can't contain; it now haspartition=Record(1).tests/tablepasses, and ruff and mypy are clean.Are there any user-facing changes?
Yes: a
delete()oroverwrite()filtered to some partitions no longer fails its commit retry because another writer committed a delete file in an unrelated partition.