Skip to content

Commit 1641a4a

Browse files
rmdmattinglyRay Mattingly
andauthored
HBASE-28146: Make ServerManager rsAdmins map thread safe (#5461)
Co-authored-by: Ray Mattingly <[email protected]> Signed-off-by: Duo Zhang <[email protected]> Signed-off-by: Bryan Beaudreault <[email protected]>
1 parent 6febf48 commit 1641a4a

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.net.InetAddress;
2424
import java.util.ArrayList;
2525
import java.util.Collections;
26-
import java.util.HashMap;
2726
import java.util.HashSet;
2827
import java.util.List;
2928
import java.util.Map;
@@ -124,12 +123,6 @@ public class ServerManager {
124123
private final ConcurrentNavigableMap<ServerName, ServerMetrics> onlineServers =
125124
new ConcurrentSkipListMap<>();
126125

127-
/**
128-
* Map of admin interfaces per registered regionserver; these interfaces we use to control
129-
* regionservers out on the cluster
130-
*/
131-
private final Map<ServerName, AdminService.BlockingInterface> rsAdmins = new HashMap<>();
132-
133126
/** List of region servers that should not get any more new regions. */
134127
private final ArrayList<ServerName> drainingServers = new ArrayList<>();
135128

@@ -402,7 +395,6 @@ public ServerName findServerWithSameHostnamePortWithLock(final ServerName server
402395
void recordNewServerWithLock(final ServerName serverName, final ServerMetrics sl) {
403396
LOG.info("Registering regionserver=" + serverName);
404397
this.onlineServers.put(serverName, sl);
405-
this.rsAdmins.remove(serverName);
406398
}
407399

408400
public RegionStoreSequenceIds getLastFlushedSequenceId(byte[] encodedRegionName) {
@@ -604,7 +596,6 @@ public synchronized void moveFromOnlineToDeadServers(final ServerName sn) {
604596
LOG.trace("Expiration of {} but server not online", sn);
605597
}
606598
}
607-
this.rsAdmins.remove(sn);
608599
}
609600

610601
/*
@@ -716,18 +707,13 @@ public static void closeRegionSilentlyAndWait(ClusterConnection connection, Serv
716707
* @throws RetriesExhaustedException wrapping a ConnectException if failed
717708
*/
718709
public AdminService.BlockingInterface getRsAdmin(final ServerName sn) throws IOException {
719-
AdminService.BlockingInterface admin = this.rsAdmins.get(sn);
720-
if (admin == null) {
721-
LOG.debug("New admin connection to " + sn.toString());
722-
if (sn.equals(master.getServerName()) && master instanceof HRegionServer) {
723-
// A master is also a region server now, see HBASE-10569 for details
724-
admin = ((HRegionServer) master).getRSRpcServices();
725-
} else {
726-
admin = this.connection.getAdmin(sn);
727-
}
728-
this.rsAdmins.put(sn, admin);
710+
LOG.debug("New admin connection to {}", sn);
711+
if (sn.equals(master.getServerName()) && master instanceof HRegionServer) {
712+
// A master is also a region server now, see HBASE-10569 for details
713+
return ((HRegionServer) master).getRSRpcServices();
714+
} else {
715+
return this.connection.getAdmin(sn);
729716
}
730-
return admin;
731717
}
732718

733719
/**

0 commit comments

Comments
 (0)