Skip to content

Conversation

@ritegarg
Copy link
Contributor

@ritegarg ritegarg commented Nov 4, 2025

Summary
Currently HAGroupStoreClient is lazily initialized for a given haGroupName. When first mutation comes in, the HAGroupStoreClient for that haGroupName is invoked. This can cause blocking delay for the first call while HAGroupStoreClient initializes.

This task is to initialize the HAGroupStoreClient for all the HAGroups in System.HA_Group table asynchronously as part of RegionServerEndpoint's coproc start() method. The async executor should exit when HAGroupStoreClients are initialized. This will reduce the blocking wait time for first call.

Testing
Added a prewarming enabled config with default as true. Enabled config in 1 cluster and disabled in the other. Comparing the times for getting ClusterRoleRecord in both and asserting that prewarmed is better than non-prewarmed.

return;
}

List<String> pending = new ArrayList<>(manager.getHAGroupNames());
Copy link
Contributor

Choose a reason for hiding this comment

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

If the HA table region is not ready, manager.getHAGroupNames() would return an exception. We should catch the exception and retry.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the prewarm method to handle this condition. Also updated the javadoc

LOGGER.debug("HAGroupStoreManager is null, retrying in 2s...");
}

if (pending == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should not be necessary, pending cannot be null here. manager.getHAGroupNames() either returns a list possibly empty or an exception, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed, it also handled case when manager is null, added that explicitly now

@ritegarg ritegarg requested a review from kadirozde November 14, 2025 21:54
@kadirozde kadirozde merged commit d63f2bc into apache:PHOENIX-7562-feature Nov 14, 2025
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