Revert "HBASE-21376 Add some verbose log to MasterProcedureScheduler"
This reverts commit 71224ee530
.
This commit is contained in:
parent
71224ee530
commit
940326d8f5
|
@ -82,9 +82,7 @@ public class MasterProcedureEnv implements ConfigurationObserver {
|
|||
public MasterProcedureEnv(final MasterServices master,
|
||||
final RSProcedureDispatcher remoteDispatcher) {
|
||||
this.master = master;
|
||||
boolean verbose = master.getConfiguration()
|
||||
.getBoolean("hbase.master.procedure.scheduler.verbose", false);
|
||||
this.procSched = new MasterProcedureScheduler(verbose);
|
||||
this.procSched = new MasterProcedureScheduler();
|
||||
this.remoteDispatcher = remoteDispatcher;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,16 +116,6 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
|
||||
private final SchemaLocking locking = new SchemaLocking();
|
||||
|
||||
private boolean verbose = false;
|
||||
|
||||
public MasterProcedureScheduler() {
|
||||
|
||||
}
|
||||
|
||||
public MasterProcedureScheduler(boolean verbose) {
|
||||
this.verbose = verbose;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void yield(final Procedure proc) {
|
||||
push(proc, isTableProcedure(proc), true);
|
||||
|
@ -157,11 +147,11 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
if (!queue.getLockStatus().hasExclusiveLock()) {
|
||||
// if the queue was not remove for an xlock execution,put the queue back into execution
|
||||
queue.add(proc, addFront);
|
||||
addToRunQueue(fairq, queue, proc, "queue doesn't have exclusivelock");
|
||||
addToRunQueue(fairq, queue);
|
||||
} else if (queue.getLockStatus().hasLockAccess(proc)) {
|
||||
// always add it to front as the have the lock access.
|
||||
queue.add(proc, true);
|
||||
addToRunQueue(fairq, queue, proc, "procedure has lock access");
|
||||
addToRunQueue(fairq, queue);
|
||||
} else {
|
||||
queue.add(proc, addFront);
|
||||
}
|
||||
|
@ -195,9 +185,6 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
private <T extends Comparable<T>> Procedure<?> doPoll(final FairQueue<T> fairq) {
|
||||
final Queue<T> rq = fairq.poll();
|
||||
if (rq == null || !rq.isAvailable()) {
|
||||
if (verbose && rq != null) {
|
||||
LOG.debug("polled from {} but it is not available", rq);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -208,30 +195,20 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
final boolean xlockReq = rq.requireExclusiveLock(pollResult);
|
||||
if (xlockReq && rq.getLockStatus().isLocked() && !rq.getLockStatus().hasLockAccess(pollResult)) {
|
||||
// someone is already holding the lock (e.g. shared lock). avoid a yield
|
||||
removeFromRunQueue(fairq, rq, pollResult,
|
||||
"exclusive lock not acquired: " + rq.getLockStatus());
|
||||
removeFromRunQueue(fairq, rq);
|
||||
return null;
|
||||
}
|
||||
|
||||
rq.poll();
|
||||
if (rq.isEmpty() || xlockReq) {
|
||||
String why = "";
|
||||
if (rq.isEmpty()) {
|
||||
why += "runqueue is empty ";
|
||||
}
|
||||
if (xlockReq) {
|
||||
why += "xlock is required for next procedure";
|
||||
}
|
||||
removeFromRunQueue(fairq, rq, pollResult, why);
|
||||
removeFromRunQueue(fairq, rq);
|
||||
} else if (rq.getLockStatus().hasParentLock(pollResult)) {
|
||||
// if the rq is in the fairq because of runnable child
|
||||
// check if the next procedure is still a child.
|
||||
// if not, remove the rq from the fairq and go back to the xlock state
|
||||
Procedure<?> nextProc = rq.peek();
|
||||
if (nextProc != null && !Procedure.haveSameParent(nextProc, pollResult)) {
|
||||
removeFromRunQueue(fairq, rq, pollResult,
|
||||
" parent holds the lock and the next one is not the child of the parent, next procid="
|
||||
+ nextProc.getProcId());
|
||||
removeFromRunQueue(fairq, rq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -292,9 +269,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
while (treeMap != null) {
|
||||
Queue<T> node = AvlTree.getFirst(treeMap);
|
||||
treeMap = AvlTree.remove(treeMap, node.getKey(), comparator);
|
||||
if (fairq != null) {
|
||||
removeFromRunQueue(fairq, node, null, "clear is called");
|
||||
}
|
||||
if (fairq != null) removeFromRunQueue(fairq, node);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,25 +326,16 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
}
|
||||
}
|
||||
|
||||
private <T extends Comparable<T>> void addToRunQueue(
|
||||
FairQueue<T> fairq, Queue<T> queue, final Procedure proc, String why) {
|
||||
private static <T extends Comparable<T>> void addToRunQueue(FairQueue<T> fairq, Queue<T> queue) {
|
||||
if (!AvlIterableList.isLinked(queue) && !queue.isEmpty()) {
|
||||
fairq.add(queue);
|
||||
if (verbose) {
|
||||
LOG.debug("Adding {} to runqueue, triggered by {}, since {}",
|
||||
queue.getKey(), proc, why);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private <T extends Comparable<T>> void removeFromRunQueue(
|
||||
FairQueue<T> fairq, Queue<T> queue, final Procedure proc, String why) {
|
||||
private static <T extends Comparable<T>> void removeFromRunQueue(
|
||||
FairQueue<T> fairq, Queue<T> queue) {
|
||||
if (AvlIterableList.isLinked(queue)) {
|
||||
fairq.remove(queue);
|
||||
if (verbose) {
|
||||
LOG.debug("Remove {} from runqueue, triggered by {}, since {}",
|
||||
queue.getKey(), proc, why);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -437,7 +403,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
|
||||
LockAndQueue lock = locking.getServerLock(serverName);
|
||||
if (node.isEmpty() && lock.tryExclusiveLock(proc)) {
|
||||
removeFromRunQueue(serverRunQueue, node, proc, "tryCleanupServerQueue is called");
|
||||
removeFromRunQueue(serverRunQueue, node);
|
||||
removeServerQueue(serverName);
|
||||
}
|
||||
} finally {
|
||||
|
@ -565,8 +531,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
logLockedResource(LockedResourceType.TABLE, table.getNameAsString());
|
||||
return true;
|
||||
}
|
||||
removeFromRunQueue(tableRunQueue, getTableQueue(table), procedure,
|
||||
"need to wait TableExclusiveLock, lockstatus=" + tableLock);
|
||||
removeFromRunQueue(tableRunQueue, getTableQueue(table));
|
||||
return false;
|
||||
} finally {
|
||||
schedUnlock();
|
||||
|
@ -590,8 +555,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
if (namespaceLock.releaseSharedLock()) {
|
||||
waitingCount += wakeWaitingProcedures(namespaceLock);
|
||||
}
|
||||
addToRunQueue(tableRunQueue, getTableQueue(table), procedure,
|
||||
"table's exclusive lock is available");
|
||||
addToRunQueue(tableRunQueue, getTableQueue(table));
|
||||
wakePollIfNeeded(waitingCount);
|
||||
} finally {
|
||||
schedUnlock();
|
||||
|
@ -643,8 +607,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
final LockAndQueue tableLock = locking.getTableLock(table);
|
||||
int waitingCount = 0;
|
||||
if (tableLock.releaseSharedLock()) {
|
||||
addToRunQueue(tableRunQueue, getTableQueue(table), procedure,
|
||||
"table's shard lock is available");
|
||||
addToRunQueue(tableRunQueue, getTableQueue(table));
|
||||
waitingCount += wakeWaitingProcedures(tableLock);
|
||||
}
|
||||
if (namespaceLock.releaseSharedLock()) {
|
||||
|
@ -852,8 +815,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
waitingCount += wakeWaitingProcedures(namespaceLock);
|
||||
}
|
||||
if (systemNamespaceTableLock.releaseSharedLock()) {
|
||||
addToRunQueue(tableRunQueue, getTableQueue(TableName.NAMESPACE_TABLE_NAME), procedure,
|
||||
"namespace exclusive lock is available");
|
||||
addToRunQueue(tableRunQueue, getTableQueue(TableName.NAMESPACE_TABLE_NAME));
|
||||
waitingCount += wakeWaitingProcedures(systemNamespaceTableLock);
|
||||
}
|
||||
wakePollIfNeeded(waitingCount);
|
||||
|
@ -883,9 +845,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
removeFromRunQueue(serverRunQueue,
|
||||
getServerQueue(serverName,
|
||||
procedure instanceof ServerProcedureInterface ? (ServerProcedureInterface) procedure
|
||||
: null), procedure,
|
||||
"need to wait ServerExclusiveLock, ownerid=" + lock
|
||||
.getExclusiveLockProcIdOwner());
|
||||
: null));
|
||||
return false;
|
||||
}
|
||||
waitProcedure(lock, procedure);
|
||||
|
@ -913,7 +873,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
addToRunQueue(serverRunQueue,
|
||||
getServerQueue(serverName,
|
||||
procedure instanceof ServerProcedureInterface ? (ServerProcedureInterface) procedure
|
||||
: null), procedure, "Server's exclusive lock is available");
|
||||
: null));
|
||||
int waitingCount = wakeWaitingProcedures(lock);
|
||||
wakePollIfNeeded(waitingCount);
|
||||
} finally {
|
||||
|
@ -988,8 +948,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
try {
|
||||
final LockAndQueue lock = locking.getMetaLock();
|
||||
if (lock.tryExclusiveLock(procedure)) {
|
||||
removeFromRunQueue(metaRunQueue, getMetaQueue(), procedure,
|
||||
"need to wait MetaExclusiveLock, lockStatus=" + lock);
|
||||
removeFromRunQueue(metaRunQueue, getMetaQueue());
|
||||
return false;
|
||||
}
|
||||
waitProcedure(lock, procedure);
|
||||
|
@ -1013,8 +972,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
|||
try {
|
||||
final LockAndQueue lock = locking.getMetaLock();
|
||||
lock.releaseExclusiveLock(procedure);
|
||||
addToRunQueue(metaRunQueue, getMetaQueue(), procedure,
|
||||
"meta's exclusive lock is available");
|
||||
addToRunQueue(metaRunQueue, getMetaQueue());
|
||||
int waitingCount = wakeWaitingProcedures(lock);
|
||||
wakePollIfNeeded(waitingCount);
|
||||
} finally {
|
||||
|
|
|
@ -118,10 +118,9 @@ abstract class Queue<TKey extends Comparable<TKey>> extends AvlLinkedNode<Queue<
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("%s(%s, xlock=%s sharedLock=%s size=%s peek=%s)",
|
||||
getClass().getSimpleName(), key, lockStatus.hasExclusiveLock() ?
|
||||
"true (" + lockStatus.getExclusiveLockProcIdOwner() + ")" :
|
||||
"false", lockStatus.getSharedLockCount(), size(),
|
||||
(size() > 0 ? peek() : "null"));
|
||||
return String.format("%s(%s, xlock=%s sharedLock=%s size=%s)", getClass().getSimpleName(), key,
|
||||
lockStatus.hasExclusiveLock() ? "true (" + lockStatus.getExclusiveLockProcIdOwner() + ")"
|
||||
: "false",
|
||||
lockStatus.getSharedLockCount(), size());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue