HBASE-22923 Consider minVersionToMoveSysTables while moving region and creating regionPlan (ADDENDUM) (#3455)
Signed-off-by: David Manning <david.manning@salesforce.com> Signed-off-by: Bharath Vissapragada <bharathv@apache.org>
This commit is contained in:
parent
934fe02e78
commit
1883889e26
|
@ -577,7 +577,7 @@ public class AssignmentManager {
|
||||||
List<RegionPlan> plans = new ArrayList<>();
|
List<RegionPlan> plans = new ArrayList<>();
|
||||||
// TODO: I don't think this code does a good job if all servers in cluster have same
|
// TODO: I don't think this code does a good job if all servers in cluster have same
|
||||||
// version. It looks like it will schedule unnecessary moves.
|
// version. It looks like it will schedule unnecessary moves.
|
||||||
for (ServerName server : getExcludedServersForSystemTable(true)) {
|
for (ServerName server : getExcludedServersForSystemTable()) {
|
||||||
if (master.getServerManager().isServerDead(server)) {
|
if (master.getServerManager().isServerDead(server)) {
|
||||||
// TODO: See HBASE-18494 and HBASE-18495. Though getExcludedServersForSystemTable()
|
// TODO: See HBASE-18494 and HBASE-18495. Though getExcludedServersForSystemTable()
|
||||||
// considers only online servers, the server could be queued for dead server
|
// considers only online servers, the server could be queued for dead server
|
||||||
|
@ -2302,16 +2302,6 @@ public class AssignmentManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
public List<ServerName> getExcludedServersForSystemTable() {
|
|
||||||
return getExcludedServersForSystemTable(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given cluster with mixed versions of servers, get a list of
|
* For a given cluster with mixed versions of servers, get a list of
|
||||||
* servers with lower versions, where system table regions should not be
|
* servers with lower versions, where system table regions should not be
|
||||||
|
@ -2321,15 +2311,9 @@ public class AssignmentManager {
|
||||||
* "hbase.min.version.move.system.tables" if checkForMinVersion is true.
|
* "hbase.min.version.move.system.tables" if checkForMinVersion is true.
|
||||||
* Detailed explanation available with definition of minVersionToMoveSysTables.
|
* 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.
|
* @return List of Excluded servers for System table regions.
|
||||||
*/
|
*/
|
||||||
private List<ServerName> getExcludedServersForSystemTable(
|
public List<ServerName> getExcludedServersForSystemTable() {
|
||||||
boolean checkForMinVersion) {
|
|
||||||
// TODO: This should be a cached list kept by the ServerManager rather than calculated on each
|
// TODO: This should be a cached list kept by the ServerManager rather than calculated on each
|
||||||
// move or system region assign. The RegionServerTracker keeps list of online Servers with
|
// move or system region assign. The RegionServerTracker keeps list of online Servers with
|
||||||
// RegionServerInfo that includes Version.
|
// RegionServerInfo that includes Version.
|
||||||
|
@ -2342,12 +2326,11 @@ public class AssignmentManager {
|
||||||
}
|
}
|
||||||
String highestVersion = Collections.max(serverList,
|
String highestVersion = Collections.max(serverList,
|
||||||
(o1, o2) -> VersionInfo.compareVersion(o1.getSecond(), o2.getSecond())).getSecond();
|
(o1, o2) -> VersionInfo.compareVersion(o1.getSecond(), o2.getSecond())).getSecond();
|
||||||
if (checkForMinVersion) {
|
if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
|
||||||
if (!DEFAULT_MIN_VERSION_MOVE_SYS_TABLES_CONFIG.equals(minVersionToMoveSysTables)) {
|
int comparedValue = VersionInfo.compareVersion(minVersionToMoveSysTables,
|
||||||
int comparedValue = VersionInfo.compareVersion(minVersionToMoveSysTables, highestVersion);
|
highestVersion);
|
||||||
if (comparedValue > 0) {
|
if (comparedValue > 0) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return serverList.stream()
|
return serverList.stream()
|
||||||
|
|
Loading…
Reference in New Issue