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/07/01 11:13:12 UTC

[GitHub] [hbase] virajjasani commented on a change in pull request #3438: HBASE-22923 min version of RegionServer to move system table regions

virajjasani commented on a change in pull request #3438:
URL: https://github.com/apache/hbase/pull/3438#discussion_r662179581



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
##########
@@ -2551,19 +2566,44 @@ private int setOfflineInZooKeeper(final RegionState state, final ServerName dest
    * know the version. So in fact we will never assign a system region to a RS without registering on zk.
    */
   public List<ServerName> getExcludedServersForSystemTable() {
+    return getExcludedServersForSystemTable(false);
+  }
+
+  /**
+   * Get a list of servers that this region can not assign to.
+   * For system table, we must assign them to a server with highest version.
+   * We can disable this exclusion using config:
+   * "hbase.min.version.move.system.tables" if checkForMinVersion is true.
+   *
+   * @param checkForMinVersion if true, check for minVersionToMoveSysTables
+   *   and decide moving system table regions accordingly.
+   * @return List of Excluded servers for System table regions.
+   */
+  private List<ServerName> getExcludedServersForSystemTable(
+      boolean checkForMinVersion) {
     List<Pair<ServerName, String>> serverList = new ArrayList<>();
     for (ServerName s : serverManager.getOnlineServersList()) {
       serverList.add(new Pair<>(s, server.getRegionServerVersion(s)));
     }
     if (serverList.isEmpty()) {
-      return new ArrayList<>();
+      return Collections.emptyList();
     }
-    String highestVersion = Collections.max(serverList, new Comparator<Pair<ServerName, String>>() {
+    String highestVersion = Collections.max(serverList,
+        new Comparator<Pair<ServerName, String>>() {
       @Override
       public int compare(Pair<ServerName, String> o1, Pair<ServerName, String> o2) {
         return VersionInfo.compareVersion(o1.getSecond(), o2.getSecond());
       }
     }).getSecond();
+    if (checkForMinVersion) {
+      if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {

Review comment:
       Love these discussions, always learn a thing or two :)
   
   `decisionFactor = decisionFactor && additionalFactors` yeah, this is also nice way. I wish we had some standards around this.
   For now, let me keep it as is as you don't have strong opinion, I still find this simpler:
   ```
     if (decisionFactor) {
       if (additionalFactors) {
       }
     }
   ```
   I think this is why we don't have standards because individuals find different approaches as simpler ones than others (but CPU doesn't care :) )




-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org