ritegarg commented on code in PR #2313:
URL: https://github.com/apache/phoenix/pull/2313#discussion_r2525632912


##########
phoenix-core-server/src/main/java/org/apache/phoenix/coprocessor/PhoenixRegionServerEndpoint.java:
##########
@@ -195,4 +212,56 @@ public ServerMetadataCache getServerMetadataCache() {
         return ServerMetadataCacheImpl.getInstance(conf);
     }
 
+    /**
+     * Prewarms HAGroupStoreClients in background thread with retry.
+     * Initializes all HA group clients asynchronously at startup.
+     */
+    private void startHAGroupStoreClientPrewarming() {
+        prewarmExecutor = Executors.newSingleThreadExecutor(r -> {
+            Thread t = new Thread(r, "HAGroupStoreClient-Prewarm");
+            t.setDaemon(true);
+            return t;
+        });
+
+        prewarmExecutor.submit(() -> {
+            try {
+                HAGroupStoreManager manager = 
HAGroupStoreManager.getInstance(conf);
+                if (manager == null) {
+                    LOGGER.warn("HAGroupStoreManager is null, skipping 
prewarming");
+                    return;
+                }
+
+                List<String> pending = new 
ArrayList<>(manager.getHAGroupNames());

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



-- 
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]

Reply via email to