Skip to content

feat(metadata): add standalone metadata table services tool - #19731

Open
cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:mdt_table_service_tool
Open

feat(metadata): add standalone metadata table services tool#19731
cshuo wants to merge 1 commit into
apache:masterfrom
cshuo:mdt_table_service_tool

Conversation

@cshuo

@cshuo cshuo commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

Closes #19025.

Metadata table services currently run through HoodieBackedTableMetadataWriter#performTableServices, which requires a data-table write even when the only goal is to maintain the metadata table. This can lead users to generate empty commits to trigger MDT compaction, log compaction, cleaning, and archival.

This change provides a standalone Spark-submit tool and reusable metadata-writer APIs so an external service can schedule and execute MDT table services without writing to the data table. Scheduling and timeline publication are serialized with data-table writers through the shared data-table lock, while expensive compaction execution uses the MDT OCC path added by #18295.

Summary and Changelog

  • Add HoodieMetadataTableServicesTool under hudi-utilities with schedule, execute, and schedule-and-execute modes for MDT compaction, log compaction, cleaning, and archival.
  • Add reusable scheduleTableServices and executeTableServices APIs, backed by MetadataTableServiceRequest, to HoodieTableMetadataWriter.
  • Refactor inline MDT table services to use the shared request-driven implementation while preserving table-version-specific compaction semantics.
  • Add separate scheduling delegation through hoodie.metadata.table.service.manager.schedule.actions while retaining the existing execution delegation behavior.
  • Derive MDT OCC lock configuration from the data-table lock so external execution shares the same logical data-table lock during timeline transitions and completion.

Impact

This adds public metadata-writer APIs, a new Spark-submit utility, and a new advanced scheduling-delegation configuration. Existing inline table-service behavior remains the default. Users can opt into external MDT maintenance without producing empty data-table commits.

Scheduling and short timeline publication/finalization sections contend on the existing data-table lock. Compaction and log-compaction execution do not hold that lock for the full execution duration.

Risk Level

Medium. The change affects MDT table-service orchestration and concurrent-writer locking. The implementation preserves the existing inline order, keeps table-version-six fallback behavior, reuses existing MDT write-client APIs, and includes focused coverage for request modes, delegation, lock derivation, failure propagation, and table-version-specific scheduling.

Documentation Update

Document the new HoodieMetadataTableServicesTool invocation and scheduling-delegation configuration before the feature is finalized.

Contributor's checklist

  • Read through contributor's guide
  • Enough context is provided in the sections above
  • Adequate tests were added if applicable
@github-actions github-actions Bot added the size:XL PR with lines of changes > 1000 label Aug 25, 2026
@codecov-commenter

codecov-commenter commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 46.73913% with 196 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.07%. Comparing base (6103a52) to head (62ad906).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...udi/utilities/HoodieMetadataTableServicesTool.java 11.84% 127 Missing and 7 partials ⚠️
...hudi/metadata/HoodieBackedTableMetadataWriter.java 64.13% 15 Missing and 18 partials ⚠️
...oodieBackedTableMetadataWriterTableVersionSix.java 52.77% 10 Missing and 7 partials ⚠️
...che/hudi/metadata/MetadataTableServiceRequest.java 81.81% 3 Missing and 5 partials ⚠️
...apache/hudi/metadata/MetadataTableServiceMode.java 57.14% 1 Missing and 2 partials ⚠️
...pache/hudi/common/config/HoodieMetadataConfig.java 97.14% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19731      +/-   ##
============================================
- Coverage     78.29%   78.07%   -0.23%     
+ Complexity    33861    33811      -50     
============================================
  Files          2541     2544       +3     
  Lines        141676   141981     +305     
  Branches      17172    17227      +55     
============================================
- Hits         110928   110854      -74     
- Misses        23039    23328     +289     
- Partials       7709     7799      +90     
Components Coverage Δ
hudi-common 83.61% <97.14%> (-0.06%) ⬇️
hudi-client 83.06% <66.29%> (-0.10%) ⬇️
hudi-flink 84.72% <ø> (-0.94%) ⬇️
hudi-spark-datasource 73.18% <ø> (-0.01%) ⬇️
hudi-utilities 73.73% <11.84%> (-0.79%) ⬇️
hudi-cli 15.06% <ø> (ø)
hudi-hadoop 70.71% <ø> (-0.02%) ⬇️
hudi-sync 75.56% <ø> (ø)
hudi-io 79.98% <ø> (-0.02%) ⬇️
hudi-timeline-service 83.74% <ø> (+0.29%) ⬆️
hudi-cloud 65.81% <ø> (ø)
hudi-kafka-connect 53.96% <ø> (+0.76%) ⬆️
Flag Coverage Δ
common-and-other-modules 51.42% <41.30%> (-0.04%) ⬇️
flink-integration-tests 47.98% <33.33%> (-0.85%) ⬇️
hadoop-mr-java-client 44.04% <31.48%> (-0.06%) ⬇️
integration-tests 13.52% <16.03%> (+<0.01%) ⬆️
spark-client-hadoop-common 50.47% <31.01%> (-0.04%) ⬇️
spark-java-tests 52.12% <25.27%> (-0.11%) ⬇️
spark-scala-tests 46.79% <19.29%> (-0.07%) ⬇️
utilities 36.54% <24.18%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...apache/hudi/metadata/HoodieMetadataWriteUtils.java 94.48% <100.00%> (+0.04%) ⬆️
...pache/hudi/metadata/HoodieTableMetadataWriter.java 100.00% <ø> (ø)
...pache/hudi/common/config/HoodieMetadataConfig.java 90.14% <97.14%> (+0.40%) ⬆️
...apache/hudi/metadata/MetadataTableServiceMode.java 57.14% <57.14%> (ø)
...che/hudi/metadata/MetadataTableServiceRequest.java 81.81% <81.81%> (ø)
...oodieBackedTableMetadataWriterTableVersionSix.java 83.21% <52.77%> (-8.02%) ⬇️
...hudi/metadata/HoodieBackedTableMetadataWriter.java 87.85% <64.13%> (-3.03%) ⬇️
...udi/utilities/HoodieMetadataTableServicesTool.java 11.84% <11.84%> (ø)

... and 67 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
@cshuo
cshuo force-pushed the mdt_table_service_tool branch 2 times, most recently from abdf2b4 to ddf5cf8 Compare August 28, 2026 03:05
@cshuo
cshuo marked this pull request as ready for review August 28, 2026 03:05
@cshuo
cshuo force-pushed the mdt_table_service_tool branch from ddf5cf8 to 62ad906 Compare September 1, 2026 01:46
@hudi-bot

hudi-bot commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build
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

3 participants