Skip to content

test(spark): reduce flakiness in TestHoodieClientMultiWriter insert-to-distinct-partitions test - #19758

Open
lokeshj1703 wants to merge 1 commit into
apache:masterfrom
lokeshj1703:oss-multiwriter-insert-flakiness
Open

test(spark): reduce flakiness in TestHoodieClientMultiWriter insert-to-distinct-partitions test#19758
lokeshj1703 wants to merge 1 commit into
apache:masterfrom
lokeshj1703:oss-multiwriter-insert-flakiness

Conversation

@lokeshj1703

Copy link
Copy Markdown
Collaborator

Describe the issue this Pull Request addresses

TestHoodieClientMultiWriter#testMultiWriterWithInsertsToDistinctPartitions can fail intermittently. It starts several writers concurrently in a tight submission loop, all contending for the same in-process lock, and under CI load the lock-acquisition timing occasionally interleaves in a way that fails the assertions even though the multi-writer behavior itself is correct.

Summary and Changelog

Add a small 100ms wait between concurrent writer-task submissions in the test so the writers are staggered slightly. This is test-only. The writers still overlap (each writer's Spark client setup plus OCC commit far exceeds 100ms, and completion is still gathered together afterwards), so the concurrency the test exercises is preserved.

Impact

No production behavior change. Reduces intermittent CI failures for this test.

Risk Level

low. Test-only timing change, covered by the existing test.

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

…o-distinct-partitions test

testMultiWriterWithInsertsToDistinctPartitions submits its concurrent
writer tasks in a tight loop. Under load the writers can race on
acquiring the in-process lock in a way that intermittently fails the
test. Add a small 100ms wait between task submissions to space them out
and stabilize the test. Test-only change; no production behavior is
affected.

Co-authored-by: Y Ethan Guo <ethan@onehouse.ai>
@github-actions github-actions Bot added the size:XS PR with lines of changes in <= 10 label Aug 26, 2026
@codecov-commenter

codecov-commenter commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.28%. Comparing base (a27828d) to head (160e4b9).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #19758      +/-   ##
============================================
- Coverage     77.37%   75.28%   -2.10%     
+ Complexity    33177    32313     -864     
============================================
  Files          2539     2539              
  Lines        140939   140939              
  Branches      17012    17012              
============================================
- Hits         109056   106103    -2953     
- Misses        24145    27016    +2871     
- Partials       7738     7820      +82     
Components Coverage Δ
hudi-common 81.95% <ø> (-1.09%) ⬇️
hudi-client 78.55% <ø> (-3.41%) ⬇️
hudi-flink 85.62% <ø> (-0.01%) ⬇️
hudi-spark-datasource 65.38% <ø> (-6.43%) ⬇️
hudi-utilities 74.34% <ø> (+0.02%) ⬆️
hudi-cli 15.06% <ø> (ø)
hudi-hadoop 66.21% <ø> (-1.34%) ⬇️
hudi-sync 75.56% <ø> (+0.02%) ⬆️
hudi-io 79.62% <ø> (-0.24%) ⬇️
hudi-timeline-service 77.57% <ø> (ø)
hudi-cloud 64.27% <ø> (ø)
hudi-kafka-connect 53.20% <ø> (ø)
Flag Coverage Δ
common-and-other-modules 51.03% <ø> (-0.01%) ⬇️
flink-integration-tests 49.00% <ø> (+<0.01%) ⬆️
hadoop-mr-java-client 43.74% <ø> (+<0.01%) ⬆️
integration-tests 13.56% <ø> (+<0.01%) ⬆️
spark-client-hadoop-common 50.54% <ø> (-0.01%) ⬇️
spark-java-tests 32.41% <ø> (-16.05%) ⬇️
utilities 36.42% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 269 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.

@lokeshj1703
lokeshj1703 marked this pull request as ready for review August 26, 2026 14:37

@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 adds a 100ms stagger between concurrent writer-task submissions in testMultiWriterWithInsertsToDistinctPartitions to reduce CI flakiness, with no production behavior change. 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 comment on the inline note — it describes the fix but omits the why, which is the part future readers actually need.

cc @yihua

@@ -753,6 +753,8 @@ public void testMultiWriterWithInsertsToDistinctPartitions(HoodieTableType table
throw new RuntimeException(e);
}

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: the comment restates what the code does — could you replace it with a note on why the sleep reduces flakiness (e.g. which race or ordering issue it sidesteps)? That context is what a future reader actually needs.

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

@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

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

Labels

size:XS PR with lines of changes in <= 10

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants