Repository navigation
fix(table): keep v2 position deletes when a v3 delete writes a file's first DV - #2669
Open
AynSiddiqui wants to merge 1 commit into
Open
AynSiddiqui wants to merge 1 commit into
AynSiddiqui wants to merge 1 commit into
Conversation
… first DV When a v3 merge-on-read Delete gives a data file its first deletion vector, merge the positions from that file's v2 position delete files into the DV and remove the file-scoped ones in the same snapshot, as Java's BaseDVFileWriter does. Partition-scoped files are kept. Fixes apache#2604 Signed-off-by: Ayaan <ayaansiddiqui68@gmail.com>
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.
Fixes #2604
What
On a table upgraded from v2 to v3, a merge-on-read Delete wrote a deletion vector (DV) with only the new deletes. Once a data file has a DV, readers skip its v2 position delete files, so rows deleted before the upgrade came back.
How
When a v3 Delete gives a data file its first DV, the positions from all of that file's v2 position delete files (matched like scan planning does) are merged into the DV. As in Java's BaseDVFileWriter, only file-scoped position delete files (referenced_data_file is that data file) are removed in the same snapshot. Partition-scoped files that can cover several data files are kept: readers ignore them for files that have a DV and still apply them to the others. Equality deletes are not touched. Removing a delete file makes the commit non-replayable, as for existing DV replacement, so a concurrent commit fails with ErrCommitFailed and the caller retries.
Notes:
Tests
New tests in
table/mor_v3_upgrade_deletes_test.go: the issue's scenario with a second delete after the upgrade, several position delete files on one data file, a shared position delete file, a partitioned table, a partition spec change before the upgrade, equality deletes kept, a delete that matches no row still writing the seeded DV, and a concurrent commit failure. They fail on main and pass with the fix.go test ./table/...andmake lintpass.