This is the 2nd patch among series of patch.
In this patch, we are making SI to not rely on RDD.
SI needs to know what record keys have been deleted or updated so that it can delete those entries from SI. We are only adjusting this to not depend on the writeStatus.
We had to make some changes to our RLI and SI records are generated.
We do not want to read from data files repeatedly(once for RLI and again for SI). And so, here is what we are doing.
Step1: For every HoodieWriteStat in the HoodieCommitMetadata, we are generating PerFileGroupRecordKeyInfos which contains
a boolean flag to denote whether the file group of interest contains pure inserts.
and List . RecordKeyInfo is a POJO containing below items
private final String recordKey;
private final RecordStatus recordStatus;
private String partition;
private String fileId;
where RecordStatus is an enum with INSERT or UPDATE or DELETE
Incase of parquet file:
if previous base file is present, we read both old and new and generate PerFileGroupRecordKeyInfos. If only RLI is enabled, we do some optimizations here as we don't really need to differentiate insert/updates in latest parquet file.
Incase of log files:
For regular data blocks, we populate values only if both RLI and SI are enabled. If only RLI is enabled, we don't need to process data blocks as RLI only cares about inserts and deletes.
Incase of delete blocks, we read them and and populate values for List in PerFileGroupRecordKeyInfos.
Step2:
Persist the output from Step1. (PairRDD)
Step 3:
We use the output from Step2 and generate RLI records.
Step4:
We use the output from Step 2 and generate SI records. Here we only poll the PerFileGroupRecordKeyInfos to understand the record keys that have been deleted or updated.
We still have code snippets here to read directly from data files for SI purpose. This might be taking up in a separate patch (as it might increase the scope of the patch)
Essentially, at a high level, we do one processing of data files to populate PerFileGroupRecordKeyInfos for every HoodieWriteStat (i.e. every partition, fileId combination).
And then use the paired RDD to compute RLI and SI records.
Pending:
I need to write more tests. But most of existing tests for RLI and SI except 1 which I am investigating.
Impact
No non-determinism or undefined behavior for RLI and SI is fixed.
Risk level (write none, low medium or high below)
low
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".
The config description must be updated if new configs are added or the default value of the configs are changed
Any new feature or user-facing change requires updating the Hudi website. Please create a Jira ticket, attach the
ticket number here and follow the instruction to make
changes to the website.
Change Logs
Fixing SI MDT record generation in MDT to not rely on RDD
This is a stacked patch over https://github.com/apache/hudi/pull/12269
This is the 2nd patch among series of patch. In this patch, we are making SI to not rely on RDD.
SI needs to know what record keys have been deleted or updated so that it can delete those entries from SI. We are only adjusting this to not depend on the writeStatus.
We had to make some changes to our RLI and SI records are generated. We do not want to read from data files repeatedly(once for RLI and again for SI). And so, here is what we are doing.
Step1: For every HoodieWriteStat in the HoodieCommitMetadata, we are generating PerFileGroupRecordKeyInfos which contains
where RecordStatus is an enum with INSERT or UPDATE or DELETE
Incase of parquet file:
Step2: Persist the output from Step1. (PairRDD)
Step 3:
Step4:
Essentially, at a high level, we do one processing of data files to populate PerFileGroupRecordKeyInfos for every HoodieWriteStat (i.e. every partition, fileId combination). And then use the paired RDD to compute RLI and SI records.
Pending: I need to write more tests. But most of existing tests for RLI and SI except 1 which I am investigating.
Impact
No non-determinism or undefined behavior for RLI and SI is fixed.
Risk level (write none, low medium or high below)
low
Documentation Update
Describe any necessary documentation update if there is any new feature, config, or user-facing change. If not, put "none".
Contributor's checklist