-
Notifications
You must be signed in to change notification settings - Fork 1k
PHOENIX-7719 Prewarm HAGroupStore Client #2313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| return; | ||
| } | ||
|
|
||
| List<String> pending = new ArrayList<>(manager.getHAGroupNames()); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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.