Skip to content

test(sync): cover the meta-sync completion-time watermark end to end - #19726

Open
Davis-Zhang-Onehouse wants to merge 2 commits into
apache:masterfrom
Davis-Zhang-Onehouse:sync-completion-time-watermark-tests
Open

test(sync): cover the meta-sync completion-time watermark end to end#19726
Davis-Zhang-Onehouse wants to merge 2 commits into
apache:masterfrom
Davis-Zhang-Onehouse:sync-completion-time-watermark-tests

Conversation

@Davis-Zhang-Onehouse

@Davis-Zhang-Onehouse Davis-Zhang-Onehouse commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Describe the issue this Pull Request addresses

closes #19725

HUDI-7494 taught the meta-sync clients to persist and read last_commit_completion_time_sync so incremental sync can register a commit that completes after the instant-time watermark has already moved past it. The mechanism has no test coverage on the sync clients: nothing fails if the completion watermark stops being written, is computed with the wrong ordering, or is never consulted on read. Separately, the Glue test fixture writes its seed commit into .hoodie/ while the version-8 timeline reads .hoodie/timeline/, so every Glue test has been running against an empty active timeline.

Summary and Changelog

Test-only coverage for the completion-time watermark, plus one error-message fix.

  • TestAWSGlueSyncClient: four new tests. The watermark test seeds a second commit whose instant time sorts below the fixture's but whose completion time is later, and asserts the two watermarks come from the two different instants; mutating the client to persist the completion time of the instant-time-latest instant fails it (expected: <20250101000001000> but was: <20250101000000000>). Also: no-op when the timeline has no completed commit, and both read-back paths of getLastCommitCompletionTimeSynced.
  • TestHiveSyncToolLongRunningWriteWatermark (new): end-to-end on HiveSyncTool, parameterized over the client. A long-running INSERT_OVERWRITE completes after two sync cycles advanced the watermark past its instant time: the stock client registers the partition through the hollow-instant lookup in TimelineUtils.getCommitsTimelineAfter; an instant-time-only client silently and permanently drops it.
  • TestHiveSyncTool: updateLastCommitTimeSynced on a created-but-never-written table must no-op.
  • HiveTestUtil: startInsertOverwritePartition (requested + inflight markers and data files, no completed file) and addEmptyCommit helpers.
  • GlueTestUtil: the fixture commit is now written into the timeline folder with an explicit completion time in the file name, so the fixture timeline is actually visible; createCommitFile / deleteCommitFile helpers.
  • AWSGlueCatalogSyncClient: the getLastCommitCompletionTimeSynced failure message and the no-commit log line now name the database-qualified table like their siblings, and the watermark property map is typed to the Map interface.

Test code adapted from the 0.x backport of HUDI-7494.

Impact

None on production behavior; one exception message now includes the database name.

Risk Level

none

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

The completion-time watermark (last_commit_completion_time_sync) lets
incremental meta sync register a commit that completes after the
instant-time watermark moved past it, but nothing failed if it stopped
being written, was computed with the wrong ordering, or was never read.
Adds falsifiable unit tests on the Glue client, an end-to-end
HiveSyncTool test of the hollow-instant rescue, and a no-op check for a
table with no completed commit. The Glue fixture commit now lands in the
timeline folder with an explicit completion time, so the fixture
timeline is actually visible to the version-8 timeline reader.
@codecov-commenter

codecov-commenter commented Aug 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 77.92%. Comparing base (8adb095) to head (3020e63).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19726      +/-   ##
============================================
+ Coverage     77.90%   77.92%   +0.01%     
+ Complexity    33257    33256       -1     
============================================
  Files          2533     2533              
  Lines        140263   140263              
  Branches      16901    16901              
============================================
+ Hits         109274   109298      +24     
+ Misses        23359    23333      -26     
- Partials       7630     7632       +2     
Components Coverage Δ
hudi-common 83.34% <ø> (-0.02%) ⬇️
hudi-client 82.98% <ø> (+0.01%) ⬆️
hudi-flink 85.72% <ø> (-0.03%) ⬇️
hudi-spark-datasource 72.36% <ø> (ø)
hudi-utilities 74.32% <ø> (ø)
hudi-cli 15.06% <ø> (ø)
hudi-hadoop 69.09% <ø> (+0.01%) ⬆️
hudi-sync 75.60% <ø> (+0.02%) ⬆️
hudi-io 79.85% <ø> (ø)
hudi-timeline-service 83.74% <ø> (+0.29%) ⬆️
hudi-cloud 65.43% <66.66%> (+1.09%) ⬆️
hudi-kafka-connect 53.20% <ø> (ø)
Flag Coverage Δ
common-and-other-modules 50.96% <66.66%> (+0.01%) ⬆️
flink-integration-tests 49.12% <0.00%> (-0.01%) ⬇️
hadoop-mr-java-client 43.85% <ø> (-0.04%) ⬇️
integration-tests 13.61% <0.00%> (ø)
spark-client-hadoop-common 50.60% <ø> (-0.01%) ⬇️
spark-java-tests 51.96% <0.00%> (-0.02%) ⬇️
spark-scala-tests 46.53% <0.00%> (+0.02%) ⬆️
utilities 36.54% <0.00%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...apache/hudi/aws/sync/AWSGlueCatalogSyncClient.java 54.54% <66.66%> (+3.63%) ⬆️

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

The Glue watermark test seeds an existing table parameter and asserts
the update merges instead of replacing, the e2e test asserts the
registered partition's values, and the no-completed-commit test verifies
the metastore was left untouched. The no-commit log line now names the
table and the update's property map is typed to the Map interface.
@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

@Davis-Zhang-Onehouse
Davis-Zhang-Onehouse marked this pull request as ready for review August 26, 2026 19:05

@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 the contribution! This PR adds end-to-end and unit test coverage for the meta-sync completion-time watermark (last_commit_completion_time_sync) across the Glue and Hive sync clients, fixes the Glue test fixture to write its seed commit into .hoodie/timeline/ so the version-8 timeline actually reads it, and includes a small error-message/log wording fix in AWSGlueCatalogSyncClient. The production change is limited to cosmetic message updates and a local HashMapMap widening, and the new tests faithfully model the out-of-order-completion scenario the feature protects. 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 minor inconsistency in the new test — HashMap used as a declared type in one spot while this same PR switches to Map everywhere else.

cc @yihua

List<Column> columns = Collections.singletonList(GlueTestUtil.getColumn("name", "string", "person's name"));
List<Column> partitionKeys = Collections.singletonList(GlueTestUtil.getColumn("city", "string", "person's city"));
HashMap<String, String> props = new HashMap<>();
props.put(HOODIE_LAST_COMMIT_TIME_SYNC, "101");

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.

🤖 nit: this PR already switches HashMap to Map in the production code — could you do the same here (Map<String, String> props = new HashMap<>()) for consistency?

⚠️ AI-generated; verify before applying. React 👍/👎 to flag quality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L PR with lines of changes in (300, 1000]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Meta-sync completion-time watermark has no test coverage and the Glue test fixture commit is invisible to the timeline

4 participants