PHOENIX-7859 Make ParallelPhoenixConnectionFallbackIT deterministic#2482
Open
mnpoonia wants to merge 1 commit into
Open
PHOENIX-7859 Make ParallelPhoenixConnectionFallbackIT deterministic#2482mnpoonia wants to merge 1 commit into
mnpoonia wants to merge 1 commit into
Conversation
ce41869 to
fb1bfd5
Compare
…y checking queue state directly The test ParallelPhoenixConnectionFallbackIT.testParallelConnectionBackoff times out intermittently in CI when polling hasCapacity() to detect when executor queues fill up. Root cause: hasCapacity() performs a multi-step calculation (read queue size, read capacity, divide, compare threshold) which creates a race condition. Tasks can enter queues during calculation steps, causing the check to miss state transitions. Solution: Check queue.size() >= 1 directly (single atomic operation), then verify hasCapacity() matches expected state as an assertion. Benefits: - Eliminates race condition (atomic read vs multi-step calculation) - More deterministic (checks actual state, not derived value) - Maintains 5s timeout (no increase needed) - Validates both queue state and hasCapacity() logic - Adds debug logging for troubleshooting Testing: Passed locally with HBase 2.6.5. Queues filled in ~105ms (2 checks), well under 5s timeout. State transition [0,0] → [1,1] detected reliably. hasCapacity() correctly returned [false, false]. Related: PHOENIX-6840 (flaky ParallelPhoenix tests) Co-authored-by: Claude Code <claude-code@anthropic.com>
fb1bfd5 to
2b1341c
Compare
Contributor
Author
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.
What is the purpose of this change?
Fix intermittent timeout in
ParallelPhoenixConnectionFallbackIT.testParallelConnectionBackoffby eliminating race condition in queue capacity check.Background
The test polls
hasCapacity()to detect when executor queues fill up. However,hasCapacity()performs a multi-step calculation (read size, read capacity, divide, compare) that creates a race condition with queue state changes. Tasks can enter queues during the calculation, causing the test to miss the state transition and timeout.This has caused intermittent CI failures and is part of a pattern of flakiness in
ParallelPhoenix*tests (see PHOENIX-6840, @W-15906980).What changes did I make?
Changed from polling
hasCapacity()(calculated value) to directly checkingqueue.size()(actual state), then verifyinghasCapacity()returns the expected result as an assertion.Before:
After:
Why is this better?
Race Condition Eliminated
hasCapacity() calculation window:
Direct queue check (atomic):
Performance
Benefits
hasCapacity()logic is correctTesting
✅ Local Testing:
[0,0] → [1,1]as expectedhasCapacity()correctly returned[false, false]✅ Expected CI Behavior:
Related Issues
Checklist
List,ThreadPoolExecutor)