sanjeet006py commented on code in PR #8733:
URL: https://github.com/apache/hbase/pull/8733#discussion_r4229288402


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/rsgroup/RSGroupInfoManagerImpl.java:
##########
@@ -247,37 +253,32 @@ private RSGroupInfoManagerImpl(MasterServices 
masterServices) {
     this.script = new RSGroupMappingScript(masterServices.getConfiguration());
   }
 
-  private synchronized void updateDefaultServers() {
-    LOG.info("Updating default servers.");
-    Map<String, RSGroupInfo> newGroupMap = 
Maps.newHashMap(holder.groupName2Group);
-    RSGroupInfo oldDefaultGroupInfo = getRSGroup(RSGroupInfo.DEFAULT_GROUP);
-    assert oldDefaultGroupInfo != null;
-    RSGroupInfo newDefaultGroupInfo =
-      new RSGroupInfo(RSGroupInfo.DEFAULT_GROUP, getDefaultServers());
-    newDefaultGroupInfo.addAllTables(oldDefaultGroupInfo.getTables());
-    newGroupMap.put(RSGroupInfo.DEFAULT_GROUP, newDefaultGroupInfo);
-    // do not need to persist, as we do not persist default group.
-    resetRSGroupMap(newGroupMap);
-    LOG.info("Updated default servers, {} servers", 
newDefaultGroupInfo.getServers().size());
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("New default servers list: {}", 
newDefaultGroupInfo.getServers());
+  /**
+   * Called synchronously from {@code ServerListener#serverAdded}/{@code 
#serverRemoved}. Server
+   * membership of 'default' and of every regex-governed group is never 
persisted, so it is
+   * recomputed from the live servers and applied in memory only -- no {@code 
hbase:rsgroup}/ZK I/O.
+   */
+  private synchronized void handleServerEvent() {
+    Map<String, RSGroupInfo> currentGroups = holder.groupName2Group;
+    Map<String, SortedSet<Address>> autoManagedServers =
+      computeAutoManagedRSGroupServers(currentGroups.values());
+    Map<String, RSGroupInfo> newGroupMap = Maps.newHashMap(currentGroups);
+    applyAutoManagedRSGroupServers(newGroupMap, autoManagedServers);
+    dropRegexGovernedServersFromOtherGroups(newGroupMap, autoManagedServers);
+    for (Map.Entry<String, RSGroupInfo> entry : newGroupMap.entrySet()) {
+      if 
(!entry.getValue().getServers().equals(currentGroups.get(entry.getKey()).getServers()))
 {
+        resetRSGroupMap(newGroupMap);
+        LOG.info("Updated auto-managed RSGroup servers, {} servers",
+          
autoManagedServers.values().stream().mapToInt(SortedSet::size).sum());
+        return;
+      }
     }
+    LOG.info("No changes in auto-managed RSGroup server membership.");

Review Comment:
   Removed this log line.



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