HBASE-18109: Assign system tables first
This issue adds comments and a sort so system tables are queued first (which will ensure they go out first). This should be good enough along w/ existing scheduling mechanisms to ensure system/meta get assigned first. Signed-off-by: Michael Stack <stack@apache.org>
This commit is contained in:
parent
1e7804634c
commit
ea7d51e129
|
@ -161,6 +161,9 @@ public interface TableDescriptor {
|
||||||
*/
|
*/
|
||||||
long getMemStoreFlushSize();
|
long getMemStoreFlushSize();
|
||||||
|
|
||||||
|
// TODO: Currently this is used RPC scheduling only. Make it more generic than this; allow it
|
||||||
|
// to also be priority when scheduling procedures that pertain to this table scheduling first
|
||||||
|
// those tables with the highest priority (From Yi Liang over on HBASE-18109).
|
||||||
int getPriority();
|
int getPriority();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1169,7 +1169,7 @@ public class AssignmentManager implements ServerListener {
|
||||||
|
|
||||||
// assign offline regions
|
// assign offline regions
|
||||||
st = System.currentTimeMillis();
|
st = System.currentTimeMillis();
|
||||||
for (HRegionInfo regionInfo: regionsToAssign) {
|
for (HRegionInfo regionInfo: getOrderedRegions(regionsToAssign)) {
|
||||||
master.getMasterProcedureExecutor().submitProcedure(
|
master.getMasterProcedureExecutor().submitProcedure(
|
||||||
createAssignProcedure(regionInfo, false));
|
createAssignProcedure(regionInfo, false));
|
||||||
}
|
}
|
||||||
|
@ -1277,6 +1277,27 @@ public class AssignmentManager implements ServerListener {
|
||||||
return new Pair<Integer, Integer>(ritCount, states.size());
|
return new Pair<Integer, Integer>(ritCount, states.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used when assign regions, this method will put system regions in
|
||||||
|
* front of user regions
|
||||||
|
* @param regions
|
||||||
|
* @return A list of regions with system regions at front
|
||||||
|
*/
|
||||||
|
public List<HRegionInfo> getOrderedRegions(
|
||||||
|
final List<HRegionInfo> regions) {
|
||||||
|
if (regions == null) return Collections.emptyList();
|
||||||
|
|
||||||
|
List<HRegionInfo> systemList = new ArrayList<>();
|
||||||
|
List<HRegionInfo> userList = new ArrayList<>();
|
||||||
|
for (HRegionInfo hri : regions) {
|
||||||
|
if (hri.isSystemTable()) systemList.add(hri);
|
||||||
|
else userList.add(hri);
|
||||||
|
}
|
||||||
|
// Append userList to systemList
|
||||||
|
systemList.addAll(userList);
|
||||||
|
return systemList;
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================================
|
// ============================================================================================
|
||||||
// TODO: Region State In Transition
|
// TODO: Region State In Transition
|
||||||
// ============================================================================================
|
// ============================================================================================
|
||||||
|
|
|
@ -121,7 +121,9 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
/**
|
/**
|
||||||
* Table priority is used when scheduling procedures from {@link #tableRunQueue}. A TableQueue
|
* Table priority is used when scheduling procedures from {@link #tableRunQueue}. A TableQueue
|
||||||
* with priority 2 will get its procedures scheduled at twice the rate as compared to
|
* with priority 2 will get its procedures scheduled at twice the rate as compared to
|
||||||
* TableQueue with priority 1.
|
* TableQueue with priority 1. This should be enough to ensure system/meta get assigned out
|
||||||
|
* before user-space tables. HBASE-18109 is where we conclude what is here is good enough.
|
||||||
|
* Lets open new issue if we find it not enough.
|
||||||
*/
|
*/
|
||||||
private static class TablePriorities {
|
private static class TablePriorities {
|
||||||
final int metaTablePriority;
|
final int metaTablePriority;
|
||||||
|
|
|
@ -186,8 +186,9 @@ implements ServerProcedureInterface {
|
||||||
"; cycles=" + this.cycles);
|
"; cycles=" + this.cycles);
|
||||||
}
|
}
|
||||||
handleRIT(env, regionsOnCrashedServer);
|
handleRIT(env, regionsOnCrashedServer);
|
||||||
addChildProcedure(env.getAssignmentManager().
|
AssignmentManager am = env.getAssignmentManager();
|
||||||
createAssignProcedures(regionsOnCrashedServer, true));
|
addChildProcedure(am.
|
||||||
|
createAssignProcedures(am.getOrderedRegions(regionsOnCrashedServer), true));
|
||||||
}
|
}
|
||||||
setNextState(ServerCrashState.SERVER_CRASH_FINISH);
|
setNextState(ServerCrashState.SERVER_CRASH_FINISH);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue