You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by vj...@apache.org on 2021/07/03 17:17:43 UTC

[hbase] branch branch-1 updated: HBASE-22923 Consider minVersionToMoveSysTables while moving region and creating regionPlan (ADDENDUM) (#3456) (#3455)

This is an automated email from the ASF dual-hosted git repository.

vjasani pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1 by this push:
     new cad219d  HBASE-22923 Consider minVersionToMoveSysTables while moving region and creating regionPlan (ADDENDUM) (#3456) (#3455)
cad219d is described below

commit cad219d844fc3d6336d5db341aaad84c0bc561d7
Author: Viraj Jasani <vj...@apache.org>
AuthorDate: Sat Jul 3 22:47:19 2021 +0530

    HBASE-22923 Consider minVersionToMoveSysTables while moving region and creating regionPlan (ADDENDUM) (#3456) (#3455)
    
    Signed-off-by: David Manning <da...@salesforce.com>
    Signed-off-by: Bharath Vissapragada <bh...@apache.org>
---
 .../hadoop/hbase/master/AssignmentManager.java     | 34 +++++-----------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
index 28555c8..0d6b379 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/AssignmentManager.java
@@ -2576,31 +2576,13 @@ public class AssignmentManager extends ZooKeeperListener {
    * servers with lower versions, where system table regions should not be
    * assigned to.
    * For system table, we must assign regions to a server with highest version.
-   * RS will report to master before register on zk, and only when RS have registered on zk we can
-   * 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);
-  }
-
-  /**
-   * For a given cluster with mixed versions of servers, get a list of
-   * servers with lower versions, where system table regions should not be
-   * assigned to.
-   * For system table, we must assign regions to a server with highest version.
    * However, we can disable this exclusion using config:
    * "hbase.min.version.move.system.tables" if checkForMinVersion is true.
    * Detailed explanation available with definition of minVersionToMoveSysTables.
    *
-   * @param checkForMinVersion If false, return a list of servers with lower version. If true,
-   *   compare higher version with minVersionToMoveSysTables. Only if higher version is greater
-   *   than minVersionToMoveSysTables, this method returns list of servers with lower version. If
-   *   higher version is less than or equal to minVersionToMoveSysTables, returns empty list.
-   *   An example is provided with definition of minVersionToMoveSysTables.
    * @return List of Excluded servers for System table regions.
    */
-  private List<ServerName> getExcludedServersForSystemTable(
-      boolean checkForMinVersion) {
+  public List<ServerName> getExcludedServersForSystemTable() {
     List<Pair<ServerName, String>> serverList = new ArrayList<>();
     for (ServerName s : serverManager.getOnlineServersList()) {
       serverList.add(new Pair<>(s, server.getRegionServerVersion(s)));
@@ -2615,13 +2597,11 @@ public class AssignmentManager extends ZooKeeperListener {
         return VersionInfo.compareVersion(o1.getSecond(), o2.getSecond());
       }
     }).getSecond();
-    if (checkForMinVersion) {
-      if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
-        int comparedValue = VersionInfo
-            .compareVersion(minVersionToMoveSysTables, highestVersion);
-        if (comparedValue > 0) {
-          return Collections.emptyList();
-        }
+    if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
+      int comparedValue = VersionInfo.compareVersion(minVersionToMoveSysTables,
+          highestVersion);
+      if (comparedValue > 0) {
+        return Collections.emptyList();
       }
     }
     List<ServerName> res = new ArrayList<>();
@@ -2754,7 +2734,7 @@ public class AssignmentManager extends ZooKeeperListener {
           synchronized (checkIfShouldMoveSystemRegionLock) {
             // RS register on ZK after reports startup on master
             List<HRegionInfo> regionsShouldMove = new ArrayList<>();
-            for (ServerName server : getExcludedServersForSystemTable(true)) {
+            for (ServerName server : getExcludedServersForSystemTable()) {
               regionsShouldMove.addAll(getCarryingSystemTables(server));
             }
             if (!regionsShouldMove.isEmpty()) {