Revert "HBASE-20949 Add logs for debugging"

This reverts commit 8b8de1f8a7.
This commit is contained in:
zhangduo 2018-07-27 08:40:46 +08:00
parent 973b4ddcfa
commit d43e28dc82
2 changed files with 10 additions and 17 deletions

View File

@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.procedure2;
import java.util.function.Predicate;
import java.util.stream.Stream;
import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Locking for mutual exclusion between procedures. Used only by procedure framework internally.
@ -50,7 +48,6 @@ import org.slf4j.LoggerFactory;
*/
@InterfaceAudience.Private
public class LockAndQueue implements LockStatus {
private static final Logger LOG = LoggerFactory.getLogger(LockAndQueue.class);
private final ProcedureDeque queue = new ProcedureDeque();
private Procedure<?> exclusiveLockOwnerProcedure = null;
private int sharedLock = 0;
@ -114,13 +111,11 @@ public class LockAndQueue implements LockStatus {
*/
public boolean trySharedLock(Procedure<?> proc) {
if (hasExclusiveLock() && !hasLockAccess(proc)) {
LOG.debug("{} acquire shared lock {} failed", proc, this, new Exception());
return false;
}
// If no one holds the xlock, then we are free to hold the sharedLock
// If the parent proc or we have already held the xlock, then we return true here as
// xlock is more powerful then shared lock.
LOG.debug("{} acquire shared lock {} succeeded", proc, this, new Exception());
sharedLock++;
return true;
}
@ -128,8 +123,7 @@ public class LockAndQueue implements LockStatus {
/**
* @return whether we should wake the procedures waiting on the lock here.
*/
public boolean releaseSharedLock(Procedure<?> proc) {
LOG.debug("{} release shared lock {}", proc, this, new Exception());
public boolean releaseSharedLock() {
// hasExclusiveLock could be true, it usually means we acquire shared lock while we or our
// parent have held the xlock. And since there is still an exclusive lock, we do not need to
// wake any procedures.
@ -192,8 +186,7 @@ public class LockAndQueue implements LockStatus {
@Override
public String toString() {
return String.format("%08x", hashCode()) + ": exclusiveLockOwner=" +
(hasExclusiveLock() ? getExclusiveLockProcIdOwner() : "NONE") + ", sharedLockCount=" +
getSharedLockCount() + ", waitingProcCount=" + queue.size();
return "exclusiveLockOwner=" + (hasExclusiveLock() ? getExclusiveLockProcIdOwner() : "NONE") +
", sharedLockCount=" + getSharedLockCount() + ", waitingProcCount=" + queue.size();
}
}

View File

@ -526,7 +526,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
return true;
}
if (!tableLock.tryExclusiveLock(procedure)) {
namespaceLock.releaseSharedLock(procedure);
namespaceLock.releaseSharedLock();
waitProcedure(tableLock, procedure);
logLockedResource(LockedResourceType.TABLE, table.getNameAsString());
return true;
@ -552,7 +552,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
if (tableLock.releaseExclusiveLock(procedure)) {
waitingCount += wakeWaitingProcedures(tableLock);
}
if (namespaceLock.releaseSharedLock(procedure)) {
if (namespaceLock.releaseSharedLock()) {
waitingCount += wakeWaitingProcedures(namespaceLock);
}
addToRunQueue(tableRunQueue, getTableQueue(table));
@ -584,7 +584,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
}
if (!tableLock.trySharedLock(procedure)) {
namespaceLock.releaseSharedLock(procedure);
namespaceLock.releaseSharedLock();
waitProcedure(tableLock, procedure);
return null;
}
@ -606,11 +606,11 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
final LockAndQueue namespaceLock = locking.getNamespaceLock(table.getNamespaceAsString());
final LockAndQueue tableLock = locking.getTableLock(table);
int waitingCount = 0;
if (tableLock.releaseSharedLock(procedure)) {
if (tableLock.releaseSharedLock()) {
addToRunQueue(tableRunQueue, getTableQueue(table));
waitingCount += wakeWaitingProcedures(tableLock);
}
if (namespaceLock.releaseSharedLock(procedure)) {
if (namespaceLock.releaseSharedLock()) {
waitingCount += wakeWaitingProcedures(namespaceLock);
}
wakePollIfNeeded(waitingCount);
@ -784,7 +784,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
final LockAndQueue namespaceLock = locking.getNamespaceLock(namespace);
if (!namespaceLock.tryExclusiveLock(procedure)) {
systemNamespaceTableLock.releaseSharedLock(procedure);
systemNamespaceTableLock.releaseSharedLock();
waitProcedure(namespaceLock, procedure);
logLockedResource(LockedResourceType.NAMESPACE, namespace);
return true;
@ -811,7 +811,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
if (namespaceLock.releaseExclusiveLock(procedure)) {
waitingCount += wakeWaitingProcedures(namespaceLock);
}
if (systemNamespaceTableLock.releaseSharedLock(procedure)) {
if (systemNamespaceTableLock.releaseSharedLock()) {
addToRunQueue(tableRunQueue, getTableQueue(TableName.NAMESPACE_TABLE_NAME));
waitingCount += wakeWaitingProcedures(systemNamespaceTableLock);
}