This is an automated email from the ASF dual-hosted git repository.

tkhurana pushed a commit to branch PHOENIX-7562-feature-new
in repository https://gitbox.apache.org/repos/asf/phoenix.git


The following commit(s) were added to refs/heads/PHOENIX-7562-feature-new by 
this push:
     new 2d2989b04e PHOENIX-7861 ReplicationLogGroup cache should be keyed by 
servername + hagroup name (#2484)
2d2989b04e is described below

commit 2d2989b04e1928b8db89c3caa33b69f3d59dc9d7
Author: tkhurana <[email protected]>
AuthorDate: Wed May 20 16:35:17 2026 -0700

    PHOENIX-7861 ReplicationLogGroup cache should be keyed by servername + 
hagroup name (#2484)
---
 .../org/apache/phoenix/replication/ReplicationLogGroup.java  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git 
a/phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogGroup.java
 
b/phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogGroup.java
index 1fe559b449..b3dc9f7f00 100644
--- 
a/phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogGroup.java
+++ 
b/phoenix-core-server/src/main/java/org/apache/phoenix/replication/ReplicationLogGroup.java
@@ -178,10 +178,14 @@ public class ReplicationLogGroup {
   public static final String STANDBY_DIR = "in";
   public static final String FALLBACK_DIR = "out";
 
-  /** Cache of ReplicationLogGroup instances by HA Group ID */
+  /** Cache of ReplicationLogGroup instances by server name + HA Group name */
   protected static final ConcurrentHashMap<String, ReplicationLogGroup> 
INSTANCES =
     new ConcurrentHashMap<>();
 
+  private static String instanceKey(ServerName serverName, String haGroupName) 
{
+    return serverName.getServerName() + "|" + haGroupName;
+  }
+
   protected final Configuration conf;
   protected final ServerName serverName;
   protected final String haGroupName;
@@ -362,7 +366,7 @@ public class ReplicationLogGroup {
   public static ReplicationLogGroup get(Configuration conf, ServerName 
serverName,
     String haGroupName, Abortable abortable) throws IOException {
     try {
-      return INSTANCES.computeIfAbsent(haGroupName, k -> {
+      return INSTANCES.computeIfAbsent(instanceKey(serverName, haGroupName), k 
-> {
         try {
           ReplicationLogGroup group = new ReplicationLogGroup(conf, 
serverName, haGroupName,
             HAGroupStoreManager.getInstance(conf), abortable);
@@ -390,7 +394,7 @@ public class ReplicationLogGroup {
   public static ReplicationLogGroup get(Configuration conf, ServerName 
serverName,
     String haGroupName, HAGroupStoreManager haGroupStoreManager) throws 
IOException {
     try {
-      return INSTANCES.computeIfAbsent(haGroupName, k -> {
+      return INSTANCES.computeIfAbsent(instanceKey(serverName, haGroupName), k 
-> {
         try {
           ReplicationLogGroup group =
             new ReplicationLogGroup(conf, serverName, haGroupName, 
haGroupStoreManager);
@@ -654,7 +658,7 @@ public class ReplicationLogGroup {
       return;
     }
     LOG.info("Closing HAGroup {}", this);
-    INSTANCES.remove(haGroupName);
+    INSTANCES.remove(instanceKey(serverName, haGroupName));
     try {
       disruptor.shutdown(shutdownTimeoutMs, TimeUnit.MILLISECONDS);
     } catch (com.lmax.disruptor.TimeoutException e) {

Reply via email to