fix(common): prevent multi-table commits failing with metrics enabled - #19787
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19787 +/- ##
============================================
- Coverage 78.16% 78.15% -0.01%
+ Complexity 33730 33728 -2
============================================
Files 2541 2541
Lines 141536 141534 -2
Branches 17138 17138
============================================
- Hits 110634 110622 -12
- Misses 23195 23201 +6
- Partials 7707 7711 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Signed-off-by: 1fanwang <1fannnw@gmail.com>
1fanwang
force-pushed
the
fix/local-registry-clear-race
branch
from
August 29, 2026 04:43
1165839 to
f74202b
Compare
Collaborator
danny0405
approved these changes
Aug 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the issue this Pull Request addresses
When one Spark driver writes several Hudi tables with metrics enabled, clearing one table's local metrics can abort another table's commit.
LocalRegistry.clear()can run betweencontainsKey()andget(), causing a concurrent metric update to fail with:Closes #19570.
Summary and Changelog
Counter lookup now uses
ConcurrentHashMap.computeIfAbsent(), so a concurrent clear cannot make it return null. The atomic lookup matches the fix proposed in #19584. This PR adds a deterministic interleaving test that reproduces the failure.Impact
There is no public API change. Concurrent metric updates no longer fail when the local registry is cleared.
Risk Level
Low. The change replaces a compound access to an existing
ConcurrentHashMapwith its atomic lookup operation.Testing
Raw failing and passing regression
Full hudi-io suite
Documentation Update
None.
Contributor's checklist
upstream/master, passes on this branch, and the fullhudi-iosuite passes.