Repository navigation
fix(clustering): read spilled log records of a file slice in place instead of copying them to the heap - #20664
Open
nsivabalan wants to merge 1 commit into
Open
nsivabalan wants to merge 1 commit into
nsivabalan wants to merge 1 commit into
Conversation
…stead of copying them to the heap On the 0.x clustering record path, HoodieFileSliceReader extends LogFileIterator, which returned the log records left after the base-file merge through values() of the scanner's ExternalSpillableMap. Once records spilled, that call fails (the disk maps do not support values()). Iterate the spillable map with its lazy iterator instead.
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.
Describe the issue this Pull Request addresses
On branch-0.x, clustering a MERGE_ON_READ file slice on the record (RDD) path, which is used when the row writer is off, fails once the slice's log records spill to disk.
HoodieFileSliceReader(used byMultipleSparkJobExecutionStrategyandJavaExecutionStrategy) extendsLogFileIterator. After the base file is merged,LogFileIteratorreturns the remaining log records throughscanner.getRecords().values().iterator(). The scanner's map is anExternalSpillableMap. Once it has spilled, itsvalues()callsvalues()on the disk map, and bothBitCaskDiskMapandRocksDbDiskMapthrowHoodieException: Unsupported Operation Exceptionthere. Even wherevalues()is made to work (HUDI-8860 on master copies the disk map into a list), it copies every record, spilled ones included, into oneArrayListon the heap, so spilling saves no heap.Not an issue on master (1.x):
LogFileIteratorandHoodieFileSliceReaderno longer exist there. Clustering reads file slices through the file group reader, whoseFileGroupRecordBufferiterates itsExternalSpillableMapin place (records.iterator()). This fix is for branch-0.x only.Summary and Changelog
The 0.x clustering record path reads the remaining log records of a file slice from the spillable map in place, instead of going through
values().LogFileIteratoriterates anExternalSpillableMapwith its owniterator(), which walks the in-memory records and then the disk map lazily. Other maps still usevalues().iterator().TestLogFileIterator: for each disk map type, spills the log records, removes two keys as a base-file merge would, and asserts the exact set of remaining keys and thatvalues()is never called. Without the fix it fails for every disk map type with theUnsupported Operation Exceptionabove.Impact
Clustering MOR file slices whose log records spill no longer fails on the 0.x record path, and the remaining log records are read without copying them to the heap. No public API or config change.
Risk Level
low. One iteration call changes; the records returned and their removal semantics are the same, as the new test checks for both disk map types.
Documentation Update
none
Contributor's checklist