lokiore opened a new pull request, #2583:
URL: https://github.com/apache/phoenix/pull/2583
### What changes were proposed in this pull request?
Fixes intermittent timeouts in the HA integration-test helper
`transitClusterRole` (~1 in 5 runs) when a group transitions with both clusters
live. The helper writes an expected `ClusterRoleRecord` to both clusters and
then `waitFor`s the refreshed record to equal it. When the local cluster moves
toward standby (`ACTIVE_TO_STANDBY`), a live peer's failover-management
listener autonomously advances a `STANDBY` peer to `STANDBY_TO_ACTIVE`. Naming
the transient pre-advance role in the wait races that autonomous transition and
intermittently never matches, timing out at the 10s poll deadline.
Two complementary, deterministic fixes, each matching its call site's intent:
- **`FailoverPhoenixConnectionIT`, `HAGroupMetricsIT`** (setup-then-assert
sites): the `{ACTIVE_TO_STANDBY, STANDBY}` transit is only a stepping stone to
a later settled state the test actually asserts on. Keep the settle-wait but
name the **settled** peer role `STANDBY_TO_ACTIVE` — a fixed point in the
peer/local transition maps — so the record matches on the first poll regardless
of listener timing.
- **`ParallelPhoenixConnectionIT.testOneClusterATSRoleWithStandby`**
(asserts on the transient pair itself): `{ACTIVE_TO_STANDBY, STANDBY}` is the
state under test and is not reachable as a stable pair with both clusters live,
so no settled role can be named without changing what the test exercises. Skip
the settle-wait (`doRefresh=false`) instead; the parallel connection is still
exercised against the `ACTIVE_TO_STANDBY` cluster pair and must complete
without error. The now-unused single-argument
`testOneClusterATSRole(ClusterRole)` overload is removed.
The `transitClusterRole` Javadoc and the cluster-down / cluster-restart
variants are annotated to document the peer-advance exposure and why each is or
is not subject to it.
### Why are the changes needed?
The tests are flaky: the `waitFor` equality check against a role pair that a
live peer autonomously advances past will intermittently never match, producing
a `TimeoutException` unrelated to any product defect. This erodes trust in the
HA IT suite and causes spurious CI failures.
### Does this PR introduce _any_ user-facing change?
No. Test-only change; no production code is touched.
### How was this patch tested?
- `mvn spotless:apply` clean; test-compile `BUILD SUCCESS`.
- `ParallelPhoenixConnectionIT#testOneClusterATSRoleWithStandby` run in
isolation: `Tests run: 1, Failures: 0, Errors: 0`, zero `Timed out`
occurrences. Verified non-vacuous — the log shows the group reaching
`ACTIVE_IN_SYNC_TO_STANDBY` while the parallel connection ran.
- Loop of `testOneClusterATSRoleWithStandby` (5×) plus
`testOneClusterATSRoleWithActive` and `testBothClusterATSRole`: all green, zero
timeouts/failures/errors.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Opus 4.8 (1M context))
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]