Skip to content

[WIP] PHOENIX-7623: Add a profile which runs ITs with phoenix ha client - #2508

Open
Divneet18 wants to merge 1 commit into
apache:PHOENIX-7623-featurefrom
Divneet18:PHOENIX-7623-feature-HA
Open

[WIP] PHOENIX-7623: Add a profile which runs ITs with phoenix ha client#2508
Divneet18 wants to merge 1 commit into
apache:PHOENIX-7623-featurefrom
Divneet18:PHOENIX-7623-feature-HA

Conversation

@Divneet18

@Divneet18 Divneet18 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR adds a Maven profile (ha-enabled) that allows existing integration tests to run through Phoenix HA client code paths (FailoverPhoenixConnection, ParallelPhoenixConnection) using a single HBase cluster. When activated with mvn test
-Pha-enabled, tests exercise the HA connection infrastructure without spinning up two physical clusters. The approach uses loopback aliases (localhost vs 127.0.0.1) for the ACTIVE and STANDBY cluster URLs — both resolve to the same cluster but
are distinct strings, satisfying the HA URL validation requirement.

Why are the changes needed?

The original PR #2205 converted 300+ integration tests to HA mode but was closed because it spun up 2 complete HBase clusters for every test, which was too resource-intensive. This PR achieves the same HA code coverage (testing
FailoverPhoenixConnection wrappers, HAGroupStoreRecord creation, HA URL handling, connection pooling with HA wrappers) while using only 1 physical cluster — reducing resource usage by 50%. CbrtFunctionEnd2EndIT is converted as
proof-of-concept, with the pattern ready to apply to additional tests.

Does this PR introduce any user-facing change?

No. All changes are to test infrastructure only. No production behavior is changed. The two production code changes (making HighAvailabilityGroup.close() public and ReadOnlyProps() constructor public) only affect visibility for test access.

How was this patch tested?

  • mvn test -Dtest=CbrtFunctionEnd2EndIT -Pha-enabled -pl phoenix-core — passes (2 tests, 78s) with HA single-cluster mode
  • mvn test -Dtest=CbrtFunctionEnd2EndIT -pl phoenix-core — passes (2 tests, 54s) without HA, verifying backward compatibility
  • mvn test -Dtest=HAGroupStoreClientIT -pl phoenix-core — passes, verifying existing dual-cluster HA tests are unaffected
  • mvn clean install -DskipTests — full project builds successfully

Was this patch authored or co-authored using generative AI tooling?

Yes. This patch was co-authored using Claude Code (Claude Opus 4.6/4.7). The AI assisted with investigating the root cause of connection timeout failures, identifying the loopback alias approach, implementing the fix, and debugging the
separate alias derivation for ZK and master configs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Divneet18 Divneet18 changed the title [WIP]PHOENIX-7623: Add a profile which runs ITs with phoenix ha client [WIP] PHOENIX-7623: Add a profile which runs ITs with phoenix ha client Jun 9, 2026
@apurtell
apurtell requested a balanced review from Copilot August 15, 2026 12:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an HA-enabled Maven test profile using loopback aliases to exercise HA client paths against one HBase cluster.

Changes:

  • Adds single-cluster HA test infrastructure and lifecycle handling.
  • Enables HA mode for parallel stats-disabled integration tests.
  • Updates Cbrt integration tests and exposes supporting APIs.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
phoenix-core/pom.xml Adds the ha-enabled profile.
TestUtil.java Supplies HA test properties.
BaseTest.java Adds HA cluster setup, URLs, and teardown.
HighAvailabilityTestingUtility.java Implements single-cluster HA aliases.
ParallelStatsDisabledIT.java Activates HA setup for subclasses.
CbrtFunctionEnd2EndIT.java Passes HA connection properties.
ReadOnlyProps.java Makes the empty constructor public.
HighAvailabilityGroup.java Makes group closure public.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

}

private ReadOnlyProps() {
public ReadOnlyProps() {
public static void tearDownForHA() throws Exception {
if (Boolean.parseBoolean(System.getProperty("phoenix.ha.profile.active"))) {
try {
DriverManager.deregisterDriver(PhoenixDriver.INSTANCE);
* Someone calling close on this would make it unusable, since the state would become closed.
*/
void close() {
public void close() {
Comment on lines +53 to +54
System.out.println("get url " + getUrl());
conn = DriverManager.getConnection(getUrl(), PropertiesUtil.deepCopy(TEST_PROPERTIES));
import org.apache.phoenix.jdbc.HighAvailabilityGroup;
import org.apache.phoenix.jdbc.HighAvailabilityPolicy;
import org.apache.phoenix.jdbc.HighAvailabilityTestingUtility;
import static org.apache.phoenix.jdbc.HighAvailabilityTestingUtility.getHighAvailibilityGroup;
import org.apache.phoenix.jdbc.HighAvailabilityTestingUtility;
import static org.apache.phoenix.jdbc.HighAvailabilityTestingUtility.getHighAvailibilityGroup;
import org.apache.phoenix.jdbc.PhoenixConnection;
import org.apache.phoenix.jdbc.PhoenixMonitoredConnection;
Comment on lines +58 to +61
if (Boolean.parseBoolean(System.getProperty("phoenix.ha.profile.active"))) {
// Set up HA cluster in single-cluster mode
setUpTestClusterForHA(new ReadOnlyProps(props.entrySet().iterator()),
new ReadOnlyProps(props.entrySet().iterator()));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants