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


##########
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:
   If the HA table region is not ready, manager.getHAGroupNames() would return 
an exception. We should catch the exception and retry. 



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