feat: sort input for lsm write#19079
Open
danny0405 wants to merge 2 commits into
Open
Conversation
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
This closes #19078
LSM storage layout write paths need incoming records to participate in sorted file-group merging instead of being handled through the regular merge-handle flow. This matters for preserving LSM ordering semantics across Spark, Flink, and Java write paths, including compaction and CDC-enabled updates.
The PR also keeps native CDC log writing scoped to LSM layout write paths. Native CDC files are written using the table base file format, while CDC reader-side native format support is intentionally left out for a follow-up PR.
Summary and Changelog
This PR adds LSM-specific merge handles and sorted input support, wires LSM-aware handle selection into Spark/Flink/Java write paths, and adds native CDC log writer support for LSM CDC writes.
LsmFileGroupReaderBasedMergeHandle,FlinkLsmFileGroupReaderBasedMergeHandle, andFlinkLsmFileGroupReaderBasedIncrementalMergeHandlefor LSM write/merge paths.HoodieMergeHandleFactoryandFlinkWriteHandleFactoryto select LSM file-group-reader based merge handles for LSM storage layout, and to avoid fallback forLsmFileGroupReaderBasedMergeHandlein compaction paths with reader context/file-group reader.LsmFileGroupRecordIteratorandInputSplitso incoming write records can be treated as an additional sorted run during LSM file-group reads.HoodieCDCLogWriterabstraction andHoodieCDCLogWriterFactoryto centralize CDC writer creation.HoodieAvroNativeCDCLoggerfor Avro CDC records and updated native CDC/log writers to use the table base file format rather than hard-coded Parquet.TestHoodieMergeHandleFactoryandTestHoodieRecordUtilsfor the new handle-selection and record utility behavior.Validation evidence:
mvn -pl hudi-client/hudi-client-common -DskipITs -DskipTests=false -Dtest=TestHoodieMergeHandleFactory testmvn -pl hudi-client/hudi-flink-client,hudi-client/hudi-client-common -DskipTests -DskipITs compilemvn -pl hudi-common -DskipTests -DskipITs compileImpact
This affects LSM storage layout write paths across common client, Flink client, Java client, and Flink datasource code. Non-LSM tables should continue to use the existing merge and CDC log paths because native CDC writing is gated on
HoodieTableConfig.isLSMTreeStorageLayout().There is no new public configuration. Native CDC file naming/writing follows the configured table base file format. CDC reader native-format support is not included in this PR and is expected to be addressed separately.
Risk Level
medium
The changes touch core write-path handle selection, compaction merge handle selection, LSM file-group reading, and CDC log writing. The risk is mitigated by keeping native CDC writes gated to LSM storage layout and by targeted validation of merge handle selection plus module compilation. Follow-up validation should include broader Spark/Flink CDC and LSM integration coverage.
Documentation Update
none
No new user-facing configuration is introduced. The changes refine internal LSM write-path behavior and native CDC writer selection.
Contributor's checklist