Skip to content

[core] When looking up old records, deletion vectors should be checked - #11547

Open
tsreaper wants to merge 1 commit into
apache:masterfrom
tsreaper:fix-lookup-dv
Open

tsreaper wants to merge 1 commit into
apache:masterfrom
tsreaper:fix-lookup-dv

Conversation

@tsreaper

Copy link
Copy Markdown
Contributor

Purpose

Currently when looking up old records, we do not check deletion vectors, so removed records might be fetched.

This PR fixed the issue.

Tests

  • DeletionVectorITCase

Comment on lines +116 to +118
if (deletionVectorsMaintainer.notifyNewDeletion(
hit.fileName(), hit.rowPosition())) {
highLevel = hit.keyValue();

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.

[P1] Roll back deletion-vector changes when compaction fails

notifyNewDeletion marks the old row in the shared deletion-vector maintainer before compaction writes its output. If writing the output fails, the mark survives. Retrying prepareCommit on the same Java writer then skips the still-valid old value and commits an incorrect aggregate.

I reproduced this with an aggregation table using sum and deletion vectors, with the original file at level 2 and the update compacting to level 1. After committing 10 for a key, I wrote 7, injected a one-time IOException when opening the compaction output, and retried prepareCommit on the same writer. The PR parent (8b641ae1f3) committed 17. This PR committed 7.

Please stage the deletion-vector changes for the compaction task and apply them only after the whole task succeeds.

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.

If writing the output fails, Flink/Spark job will also fail, so the modified deletion vectors will not be committed. This is not a real problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants