Skip to content

fix(hive-sync): make skip_ro_suffix take precedence over sync_snapshot_with_table_name - #19427

Merged
voonhous merged 3 commits into
apache:masterfrom
yihua:skip-ro-suffix-precedence
Jul 31, 2026
Merged

fix(hive-sync): make skip_ro_suffix take precedence over sync_snapshot_with_table_name#19427
voonhous merged 3 commits into
apache:masterfrom
yihua:skip-ro-suffix-precedence

Conversation

@yihua

@yihua yihua commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

Hudi 1.x flipped the default of hoodie.meta.sync.sync_snapshot_with_table_name from false to true ([HUDI-7415]). Under the default ALL hive-sync-table-strategy, HiveSyncTool.doSync() now syncs the bare table name of a MERGE_ON_READ table twice in the same run when hoodie.datasource.hive_sync.skip_ro_suffix=true is also set: once as the read-optimized (RO) table (since skip_ro_suffix redirects the RO sync onto the bare name instead of <table>_ro), then again as the real-time (RT) table for the "sync origin table" step, with the RT sync silently winning. This makes skip_ro_suffix a no-op, leaves no RO view registered anywhere, and breaks read-optimized queries against the bare table name for engines that can't read HoodieParquetRealtimeInputFormat (e.g. Presto/Trino).

Summary and Changelog

Skips the redundant bare-name RT sync in HiveSyncTool.doSync() when skip_ro_suffix is set, logging a WARN naming the table and stating which config takes precedence. The real-time view remains available at <table>_rt; the bare table name stays registered as the RO view.

No code was copied.

Impact

No public API change. Behavior change only for MERGE_ON_READ tables with both hoodie.datasource.hive_sync.skip_ro_suffix=true and hoodie.meta.sync.sync_snapshot_with_table_name=true: the bare table name now stays registered as the read-optimized view instead of being flipped to real-time.

Risk Level

low

Change is scoped to a single conditional in HiveSyncTool.doSync(); all other config combinations (including the previous default of sync_snapshot_with_table_name=false) are unaffected. Covered by a new regression test that reproduces the pre-fix flip.

Documentation Update

none

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:S PR with lines of changes in (10, 100] label Jul 30, 2026
@codecov-commenter

codecov-commenter commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.56%. Comparing base (e37bfb5) to head (bce565b).
⚠️ Report is 6 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master   #19427   +/-   ##
=========================================
  Coverage     75.55%   75.56%           
- Complexity    32657    32663    +6     
=========================================
  Files          2574     2574           
  Lines        142995   142999    +4     
  Branches      17530    17531    +1     
=========================================
+ Hits         108038   108051   +13     
+ Misses        26922    26911   -11     
- Partials       8035     8037    +2     
Components Coverage Δ
hudi-common 82.26% <ø> (-0.01%) ⬇️
hudi-client 81.79% <ø> (-0.02%) ⬇️
hudi-flink 84.10% <ø> (+0.11%) ⬆️
hudi-spark-datasource 68.34% <ø> (+<0.01%) ⬆️
hudi-utilities 71.18% <ø> (-0.04%) ⬇️
hudi-cli 15.32% <ø> (ø)
hudi-hadoop 63.49% <ø> (ø)
hudi-sync 70.75% <100.00%> (+0.07%) ⬆️
hudi-io 79.57% <ø> (ø)
hudi-timeline-service 83.54% <ø> (-0.98%) ⬇️
hudi-cloud 64.00% <ø> (ø)
hudi-kafka-connect 53.96% <ø> (+0.76%) ⬆️
Flag Coverage Δ
common-and-other-modules 49.22% <100.00%> (+<0.01%) ⬆️
flink-integration-tests 48.88% <0.00%> (+0.04%) ⬆️
hadoop-mr-java-client 43.39% <ø> (+0.01%) ⬆️
integration-tests 13.63% <0.00%> (+<0.01%) ⬆️
spark-client-hadoop-common 48.71% <ø> (-0.01%) ⬇️
spark-java-tests 51.37% <0.00%> (-0.03%) ⬇️
spark-scala-tests 46.09% <0.00%> (-0.02%) ⬇️
utilities 36.65% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
...c/main/java/org/apache/hudi/hive/HiveSyncTool.java 83.26% <100.00%> (+1.05%) ⬆️

... and 21 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.

@yihua
yihua marked this pull request as ready for review July 30, 2026 21:59

@hudi-agent hudi-agent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ 🤖 This review was generated by an AI agent and may contain mistakes. Please verify any suggestions before applying.

Thanks for working on this! This PR fixes HiveSyncTool.doSync() so that when both skip_ro_suffix=true and sync_snapshot_with_table_name=true are set on a MERGE_ON_READ table, the redundant bare-name RT sync is skipped, keeping the bare table name registered as the read-optimized view. I traced the interaction with roTableName and the RO/RT sync ordering, and the guarded conditional correctly targets only the conflicting case while leaving all other config combinations unchanged. No correctness issues found. A few style/readability suggestions in the inline comments. Please take a look, and this should be ready for a Hudi committer or PMC member to take it from here. One small wording nit in the warn log — "base table name" risks confusion with Hudi's "base file" concept.

cc @yihua

Comment thread hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java Outdated
Comment thread hudi-sync/hudi-hive-sync/src/main/java/org/apache/hudi/hive/HiveSyncTool.java Outdated
@wombatu-kun

Copy link
Copy Markdown
Contributor

The single-round versus two-round difference behind my TestHiveSyncTool comment comes from HoodieHiveSyncClient caching the metastore table per run and never invalidating it after its own writes, which is also why the Glue client does not hit this path. Filed separately as #19431 since it needs a contract decision, and it does not block this PR.

@yihua

yihua commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

@wombatu-kun comments are addressed.

// a second sync round with a new commit: the bare table name's read-optimized sync (which runs
// immediately before the origin-table sync within the same doSync() call) advances its own
// last-commit-time-synced marker, so the origin-table step is the only one still eligible to run
// and flip the format if not guarded

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment says the read-optimized sync advancing its own last-commit-time-synced marker is what leaves the origin-table step eligible, but that advance is exactly why a single round does not reproduce the flip. Not a blocker: what actually keeps the origin step eligible in the second round is HoodieHiveSyncClient serving a per-run cached table snapshot taken before that write, so either name that or drop the explanation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped the explanation.

yihua added 3 commits July 30, 2026 23:56
…t_with_table_name

hoodie.datasource.hive_sync.skip_ro_suffix=true claims the bare table name
for the read-optimized (RO) view of a MOR table. Hudi 1.x flipped the default
of hoodie.meta.sync.sync_snapshot_with_table_name from false to true
(HUDI-7415), so under the default ALL hive-sync-table-strategy,
HiveSyncTool.doSync() now syncs the bare table name twice in the same run
when both configs are true: once as the RO table, then again as the RT
table, with the RT sync silently winning. This makes skip_ro_suffix a no-op
and breaks read-optimized queries against the bare table name in case the
engine can't read with HoodieParquetRealtimeInputFormat (e.g., Presto).

This change skips the redundant bare-name RT sync when skip_ro_suffix is
set, and logs a WARN naming the table and stating which config wins. The
real-time view remains available at <table>_rt.
…ndant comment, strengthen regression test to a second sync round
@yihua
yihua force-pushed the skip-ro-suffix-precedence branch from 6bd8413 to bce565b Compare July 31, 2026 06:58
@yihua

yihua commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Comments addressed.

@voonhous voonhous left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@voonhous
voonhous enabled auto-merge (squash) July 31, 2026 07:52
@hudi-bot

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

@voonhous
voonhous merged commit 8ee40b4 into apache:master Jul 31, 2026
74 of 75 checks passed
voonhous pushed a commit that referenced this pull request Aug 6, 2026
…t_with_table_name (#19427)

* fix(hive-sync): make skip_ro_suffix take precedence over sync_snapshot_with_table_name

hoodie.datasource.hive_sync.skip_ro_suffix=true claims the bare table name
for the read-optimized (RO) view of a MOR table. Hudi 1.x flipped the default
of hoodie.meta.sync.sync_snapshot_with_table_name from false to true
(HUDI-7415), so under the default ALL hive-sync-table-strategy,
HiveSyncTool.doSync() now syncs the bare table name twice in the same run
when both configs are true: once as the RO table, then again as the RT
table, with the RT sync silently winning. This makes skip_ro_suffix a no-op
and breaks read-optimized queries against the bare table name in case the
engine can't read with HoodieParquetRealtimeInputFormat (e.g., Presto).

This change skips the redundant bare-name RT sync when skip_ro_suffix is
set, and logs a WARN naming the table and stating which config wins. The
real-time view remains available at <table>_rt.

* Address review comments: fix bare-table-name wording, remove now-redundant comment, strengthen regression test to a second sync round

* Drop the second-round explanation comment per review feedback

(cherry picked from commit 8ee40b4)
voonhous pushed a commit that referenced this pull request Aug 7, 2026
…t_with_table_name (#19427)

* fix(hive-sync): make skip_ro_suffix take precedence over sync_snapshot_with_table_name

hoodie.datasource.hive_sync.skip_ro_suffix=true claims the bare table name
for the read-optimized (RO) view of a MOR table. Hudi 1.x flipped the default
of hoodie.meta.sync.sync_snapshot_with_table_name from false to true
(HUDI-7415), so under the default ALL hive-sync-table-strategy,
HiveSyncTool.doSync() now syncs the bare table name twice in the same run
when both configs are true: once as the RO table, then again as the RT
table, with the RT sync silently winning. This makes skip_ro_suffix a no-op
and breaks read-optimized queries against the bare table name in case the
engine can't read with HoodieParquetRealtimeInputFormat (e.g., Presto).

This change skips the redundant bare-name RT sync when skip_ro_suffix is
set, and logs a WARN naming the table and stating which config wins. The
real-time view remains available at <table>_rt.

* Address review comments: fix bare-table-name wording, remove now-redundant comment, strengthen regression test to a second sync round

* Drop the second-round explanation comment per review feedback

(cherry picked from commit 8ee40b4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S PR with lines of changes in (10, 100]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants