You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/06/23 14:29:09 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #3405: HBASE-26011 Introduce a new API to sync the live region server list m…

Apache9 commented on a change in pull request #3405:
URL: https://github.com/apache/hbase/pull/3405#discussion_r657159026



##########
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:
       Ah, this is a problem. In real world, for the replication scenario, usually it is not a problem as it is not likely that a regionserver which can only live for less than 5 seconds could hold any regions. But consider general usage, maybe we should let users know there is a dead server.
   
   Let me think how to deal with this.




-- 
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:
users@infra.apache.org