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-5769] Ensure partitions created by async indexer are not deleted by regular writers #12662

Merged
merged 5 commits into from
Jan 25, 2025

Conversation

codope
Copy link
Member

@codope codope commented Jan 17, 2025

Change Logs

Ensure partitions created by async indexer are not deleted by regular writers.

  • Add a new metadata config to declare what metadata partitions to delete.
  • Fix the condition for checking whether MDT partition needs to be deleted in HoodieTable
  • Add a test in TestHoodieIndexer

Let's understand the interplay between index enable/disable boolean flag and the new config. For illustration prupose, we will assume, files and column_statsare enabled by ingestion writer, andrecord_index` is created using async indexer.

Existing boolean configs: hoodie.metadata.enable, hoodie.metadata.index.column.stats.enable and hoodie.metadata.record.index.enable.
New string config: hoodie.metadata.index.drop (this takes the index name/MDT partition name as value)

  1. Regular ingestion writer has hoodie.metadata.enable and hoodie.metadata.index.column.stats.enable set to true. And, files and column_stats index are present.
  2. Async indexer starts with setting only hoodie.metadata.enable and hoodie.metadata.record.index.enable to true. It checks the available partitions and automatically sets the columns stats config to true as well -
    props.setProperty(ENABLE_METADATA_INDEX_COLUMN_STATS.key(), "true");
  3. Indexer continues to build the record_index and that is now part of inflight metadata partitions in table config.
  4. Ingestion writer continue to log updates for files, column_stats, and record_index (which is already inflight a this point), while indexer catches up with ingestion writer commit. Note that at this point, regular ingestion writer does not set hoodie.metadata.index.drop config, so even though the hoodie.metadata.record.index.enable is false in ingestion writer config, the record_index is not deleted.
  5. Indexer has caught up. Ingestion writer notices that in addition to files and column_stats, we have record_index fully available (not inflight) in the table config. It logs updates for all 3 indexes now.
  6. In case users want to delete record_index in future, they need to set not only hoodie.metadata.record.index.enable=false but also hoodie.metadata.index.drop=record_index.

To summarise, there is a boolean flag for enabling.disabling an index, and there is a string config to explicitly specify what index to delete. The interplay between these two decides finally, whether index needs to be disabled/dropped or not.

(boolean, string) -> enabled
true, null or non-matching -> true
false, null or no-matching -> true
true, record_index -> true
false, record_index -> false

Impact

Ensure partitions created by async indexer are not deleted by regular writers.

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:S PR with lines of changes in (10, 100] label Jan 17, 2025
@codope codope force-pushed the HUDI-5769-indexer-del-part branch from 243dfa7 to 899cd0a Compare January 20, 2025 07:12
@codope codope force-pushed the HUDI-5769-indexer-del-part branch from 899cd0a to 0c0d9b4 Compare January 23, 2025 03:52
@github-actions github-actions bot added size:M PR with lines of changes in (100, 300] and removed size:S PR with lines of changes in (10, 100] labels Jan 23, 2025
@nsivabalan
Copy link
Contributor

thanks for the PR desc, it helps.

btw, for bullet 4 in your PR desc

4. Ingestion writer continue to log updates for files and column_stats, while indexer catches up with ingestion writer commit. Note that at this point, regular ingestion writer does not set hoodie.metadata.index.drop config, so even though the hoodie.metadata.record.index.enable is false in ingestion writer config, the record_index is not deleted.

woudn't the ingestion writer also log updates for RLI, since the table config's inflight metadata partitions will say RLI.

@nsivabalan
Copy link
Contributor

can you create a follow up ticket for doc updates. This def needs to go into some runbook in our docs.

@codope
Copy link
Member Author

codope commented Jan 24, 2025

thanks for the PR desc, it helps.

btw, for bullet 4 in your PR desc

4. Ingestion writer continue to log updates for files and column_stats, while indexer catches up with ingestion writer commit. Note that at this point, regular ingestion writer does not set hoodie.metadata.index.drop config, so even though the hoodie.metadata.record.index.enable is false in ingestion writer config, the record_index is not deleted.

woudn't the ingestion writer also log updates for RLI, since the table config's inflight metadata partitions will say RLI.

Yes, ingestion writer will update logs for RLI as well. No change in design. Updated the PR description.

@codope codope force-pushed the HUDI-5769-indexer-del-part branch from 179fc3b to 0f2dd65 Compare January 24, 2025 17:45
@codope codope force-pushed the HUDI-5769-indexer-del-part branch from 0f2dd65 to e15ddba Compare January 25, 2025 01:27
@hudi-bot
Copy link

CI report:

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

@codope codope merged commit febf0c5 into apache:master Jan 25, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M PR with lines of changes in (100, 300]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants