Apache9 commented on a change in pull request #3405:
URL: https://github.com/apache/hbase/pull/3405#discussion_r657168459
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java
##########
@@ -163,6 +169,44 @@
private final ConcurrentNavigableMap<ServerName, ServerMetrics>
onlineServers =
new ConcurrentSkipListMap<>();
+ /**
+ * Store the snapshot of the current region server list, for improving read
performance.
+ * <p/>
+ * The hashCode is used to determine whether there are changes to the region
servers.
+ */
+ private static final class OnlineServerListSnapshot {
+
+ private static final HashFunction HASH = Hashing.murmur3_128();
+
+ final List<ServerName> servers;
+
+ final long hashCode;
+
+ public OnlineServerListSnapshot(List<ServerName> servers) {
+ this.servers = Collections.unmodifiableList(servers);
+ Hasher hasher = HASH.newHasher();
+ for (ServerName server : servers) {
+ hasher.putString(server.getServerName(), StandardCharsets.UTF_8);
+ }
+ this.hashCode = hasher.hash().asLong();
Review comment:
And this could also be a problem for the old zk based implementation. We
just watch znode and process the znode deleted event, but it is also possible
that, after a trigger of the watcher, before set a new watcher, a region server
is up and then down, then you can not get the deleted event either.
So the solution should be general, maybe we need to get all the replicators
from the replication queue storage, and compare it with the current live region
server set, to find out the dead region server.
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]