Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HUDI-8543] Fixing SI MDT record generation in MDT to not rely on RDD<WriteStatus> #12291

Closed
wants to merge 4 commits into from

Conversation

nsivabalan
Copy link
Contributor

@nsivabalan nsivabalan commented Nov 19, 2024

Change Logs

Fixing SI MDT record generation in MDT to not rely on RDD
This is a stacked patch over #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

  • 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.

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@github-actions github-actions bot added the size:L PR with lines of changes in (300, 1000] label Nov 19, 2024
@github-actions github-actions bot added size:XL PR with lines of changes > 1000 and removed size:L PR with lines of changes in (300, 1000] labels Nov 20, 2024
@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@nsivabalan
Copy link
Contributor Author

Closing this in favor of #12313

@nsivabalan nsivabalan closed this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XL PR with lines of changes > 1000
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants