[HUDI-7518] Fix HoodieMetadataPayload merging logic around repeated deletes#10913
Merged
nsivabalan merged 1 commit intoapache:masterfrom Mar 27, 2024
Merged
Conversation
101b295 to
e162c91
Compare
nsivabalan
reviewed
Mar 25, 2024
...rk-client/src/test/java/org/apache/hudi/client/functional/TestHoodieBackedTableMetadata.java
Show resolved
Hide resolved
nsivabalan
reviewed
Mar 25, 2024
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieMetadataPayload.java
Show resolved
Hide resolved
nsivabalan
approved these changes
Mar 27, 2024
yihua
added a commit
that referenced
this pull request
May 14, 2024
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.
Change Logs
When there are repeated duplicate deletes to the partition file list in
filespartition of the MDT, the current HoodieMetadataPayload merging logic drops such "deletion", causing the file that is deleted from the file system and supposed to be deleted from MDT file listing still left in MDT, because the merging logic of file system metadata does not account for such a case. Other MDT partitions have already considered repeated deletes when merging payloads.This PR fixes the logic. New tests are added around the repeated deletes (the tests fail before the fix and succeed after the fix).
The impact of this bug is that deleted files may still exist in MDT if there are repeated delete operations. It does not cause any data loss.
Here's a concrete example of how this bug causes the ingestion to fail:
(1) A data file and file group are replaced by clustering. The data file is still on the file system and in MDT file listing.
(2) A cleaner plan is generated to delete the data file.
(3) The cleaner plan is executed the first time, and fails before commit due to Spark job shutdown.
(4) The ingestion continues and succeeds, and another cleaner plan is generated containing the same data file/file group to delete.
(5) The first cleaner plan is successfully executed, incurring deletion to the file list with a metadata payload, and this is added to one log file in MDT, e.g.,
(6) The second cleaner plan is also successfully executed, incurring deletion to the file list with a metadata payload containing the same data file to delete, and this is added to a subsequent log file in the same file slice in MDT, e.g.,
(7) The replacecommit corresponds to the clustering is archived as the cleaner has deleted the replaced file groups.
(8) When reading MDT or MDT compaction happens, the merging of these two metadata payloads with identical deletes leads to empty deletion, so the data file is not deleted from the partition file list in MDT. The expected behavior is to keep the data file in the "deletions" field.
(9) Next time, when doing upsert and indexing, the deleted data file is served by the file system view based on MDT (e.g.,
7f6b146e-cd43-4fd3-9ce0-118232562569-0_63-29223-5579389_20240303214408245.parquet), and the data file cannot be found on the file system, causing the ingestion to fail.Impact
MDT bug fix.
Risk level
low
Documentation Update
N/A
Contributor's checklist