You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PHOENIX-7819 HighAvailabilityGroup.URLS inner Set must be thread-safe - #2437
When multiple threads register HA URL infos for the same HAGroupInfo, computeIfAbsent() returns the same HashSet instance to every thread, which then concurrently call add() on it. java.util.HashSet is not thread-safe. Concurrent add() is undefined behavior and can lose entries.
Posted by Claude Code (an AI assistant) on behalf of Andrew Purtell.
The 5.4 stabilization sweep traced this failure to the race that this PR fixes: FailoverPhoenixConnectionIT.testHAGroupMappingsWithDifferentPrincipalsOnDifferentThreads fails with expected:<5> but was:<6> and expected:<6> but was:<5> at line 779. It failed in 2 recent master branch builds on HBase 2.6 (NeedsOwnMiniClusterTest D-K): runs 44824116658 and 44992193332. Many threads change the plain HashSet in HighAvailabilityGroup.URLS, so an add can be lost or an entry can be duplicated. The concurrent set in this PR removes the race.
The branch is rebased onto the latest master (81e0d02fdf), and spotless is clean. Docker check of the rebased branch, JDK 11: FailoverPhoenixConnectionIT and HighAvailabilityGroupIT each passed 3 of 3 runs on HBase 2.6 and 3 of 3 runs on HBase 2.5.
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
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.
When multiple threads register HA URL infos for the same
HAGroupInfo,computeIfAbsent()returns the same HashSet instance to every thread, which then concurrently calladd()on it.java.util.HashSetis not thread-safe. Concurrentadd()is undefined behavior and can lose entries.