Skip to content

Commit 1883889

Browse files
authored
HBASE-22923 Consider minVersionToMoveSysTables while moving region and creating regionPlan (ADDENDUM) (apache#3455)
Signed-off-by: David Manning <[email protected]> Signed-off-by: Bharath Vissapragada <[email protected]>
1 parent 934fe02 commit 1883889

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java

+7-24
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ public void checkIfShouldMoveSystemRegionAsync() {
577577
List<RegionPlan> plans = new ArrayList<>();
578578
// TODO: I don't think this code does a good job if all servers in cluster have same
579579
// version. It looks like it will schedule unnecessary moves.
580-
for (ServerName server : getExcludedServersForSystemTable(true)) {
580+
for (ServerName server : getExcludedServersForSystemTable()) {
581581
if (master.getServerManager().isServerDead(server)) {
582582
// TODO: See HBASE-18494 and HBASE-18495. Though getExcludedServersForSystemTable()
583583
// considers only online servers, the server could be queued for dead server
@@ -2302,16 +2302,6 @@ private void addToPendingAssignment(final HashMap<RegionInfo, RegionStateNode> r
23022302
}
23032303
}
23042304

2305-
/**
2306-
* For a given cluster with mixed versions of servers, get a list of
2307-
* servers with lower versions, where system table regions should not be
2308-
* assigned to.
2309-
* For system table, we must assign regions to a server with highest version.
2310-
*/
2311-
public List<ServerName> getExcludedServersForSystemTable() {
2312-
return getExcludedServersForSystemTable(false);
2313-
}
2314-
23152305
/**
23162306
* For a given cluster with mixed versions of servers, get a list of
23172307
* servers with lower versions, where system table regions should not be
@@ -2321,15 +2311,9 @@ public List<ServerName> getExcludedServersForSystemTable() {
23212311
* "hbase.min.version.move.system.tables" if checkForMinVersion is true.
23222312
* Detailed explanation available with definition of minVersionToMoveSysTables.
23232313
*
2324-
* @param checkForMinVersion If false, return a list of servers with lower version. If true,
2325-
* compare higher version with minVersionToMoveSysTables. Only if higher version is greater
2326-
* than minVersionToMoveSysTables, this method returns list of servers with lower version. If
2327-
* higher version is less than or equal to minVersionToMoveSysTables, returns empty list.
2328-
* An example is provided with definition of minVersionToMoveSysTables.
23292314
* @return List of Excluded servers for System table regions.
23302315
*/
2331-
private List<ServerName> getExcludedServersForSystemTable(
2332-
boolean checkForMinVersion) {
2316+
public List<ServerName> getExcludedServersForSystemTable() {
23332317
// TODO: This should be a cached list kept by the ServerManager rather than calculated on each
23342318
// move or system region assign. The RegionServerTracker keeps list of online Servers with
23352319
// RegionServerInfo that includes Version.
@@ -2342,12 +2326,11 @@ private List<ServerName> getExcludedServersForSystemTable(
23422326
}
23432327
String highestVersion = Collections.max(serverList,
23442328
(o1, o2) -> VersionInfo.compareVersion(o1.getSecond(), o2.getSecond())).getSecond();
2345-
if (checkForMinVersion) {
2346-
if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
2347-
int comparedValue = VersionInfo.compareVersion(minVersionToMoveSysTables, highestVersion);
2348-
if (comparedValue > 0) {
2349-
return Collections.emptyList();
2350-
}
2329+
if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
2330+
int comparedValue = VersionInfo.compareVersion(minVersionToMoveSysTables,
2331+
highestVersion);
2332+
if (comparedValue > 0) {
2333+
return Collections.emptyList();
23512334
}
23522335
}
23532336
return serverList.stream()

0 commit comments

Comments
 (0)