Revert "HBASE-20949 Add logs for debugging"
This reverts commit 8b8de1f8a7
.
This commit is contained in:
parent
973b4ddcfa
commit
d43e28dc82
|
@ -21,8 +21,6 @@ package org.apache.hadoop.hbase.procedure2;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
import org.apache.yetus.audience.InterfaceAudience;
|
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.
|
* Locking for mutual exclusion between procedures. Used only by procedure framework internally.
|
||||||
|
@ -50,7 +48,6 @@ import org.slf4j.LoggerFactory;
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
public class LockAndQueue implements LockStatus {
|
public class LockAndQueue implements LockStatus {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(LockAndQueue.class);
|
|
||||||
private final ProcedureDeque queue = new ProcedureDeque();
|
private final ProcedureDeque queue = new ProcedureDeque();
|
||||||
private Procedure<?> exclusiveLockOwnerProcedure = null;
|
private Procedure<?> exclusiveLockOwnerProcedure = null;
|
||||||
private int sharedLock = 0;
|
private int sharedLock = 0;
|
||||||
|
@ -114,13 +111,11 @@ public class LockAndQueue implements LockStatus {
|
||||||
*/
|
*/
|
||||||
public boolean trySharedLock(Procedure<?> proc) {
|
public boolean trySharedLock(Procedure<?> proc) {
|
||||||
if (hasExclusiveLock() && !hasLockAccess(proc)) {
|
if (hasExclusiveLock() && !hasLockAccess(proc)) {
|
||||||
LOG.debug("{} acquire shared lock {} failed", proc, this, new Exception());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// If no one holds the xlock, then we are free to hold the sharedLock
|
// 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
|
// If the parent proc or we have already held the xlock, then we return true here as
|
||||||
// xlock is more powerful then shared lock.
|
// xlock is more powerful then shared lock.
|
||||||
LOG.debug("{} acquire shared lock {} succeeded", proc, this, new Exception());
|
|
||||||
sharedLock++;
|
sharedLock++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -128,8 +123,7 @@ public class LockAndQueue implements LockStatus {
|
||||||
/**
|
/**
|
||||||
* @return whether we should wake the procedures waiting on the lock here.
|
* @return whether we should wake the procedures waiting on the lock here.
|
||||||
*/
|
*/
|
||||||
public boolean releaseSharedLock(Procedure<?> proc) {
|
public boolean releaseSharedLock() {
|
||||||
LOG.debug("{} release shared lock {}", proc, this, new Exception());
|
|
||||||
// hasExclusiveLock could be true, it usually means we acquire shared lock while we or our
|
// 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
|
// parent have held the xlock. And since there is still an exclusive lock, we do not need to
|
||||||
// wake any procedures.
|
// wake any procedures.
|
||||||
|
@ -192,8 +186,7 @@ public class LockAndQueue implements LockStatus {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%08x", hashCode()) + ": exclusiveLockOwner=" +
|
return "exclusiveLockOwner=" + (hasExclusiveLock() ? getExclusiveLockProcIdOwner() : "NONE") +
|
||||||
(hasExclusiveLock() ? getExclusiveLockProcIdOwner() : "NONE") + ", sharedLockCount=" +
|
", sharedLockCount=" + getSharedLockCount() + ", waitingProcCount=" + queue.size();
|
||||||
getSharedLockCount() + ", waitingProcCount=" + queue.size();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!tableLock.tryExclusiveLock(procedure)) {
|
if (!tableLock.tryExclusiveLock(procedure)) {
|
||||||
namespaceLock.releaseSharedLock(procedure);
|
namespaceLock.releaseSharedLock();
|
||||||
waitProcedure(tableLock, procedure);
|
waitProcedure(tableLock, procedure);
|
||||||
logLockedResource(LockedResourceType.TABLE, table.getNameAsString());
|
logLockedResource(LockedResourceType.TABLE, table.getNameAsString());
|
||||||
return true;
|
return true;
|
||||||
|
@ -552,7 +552,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
if (tableLock.releaseExclusiveLock(procedure)) {
|
if (tableLock.releaseExclusiveLock(procedure)) {
|
||||||
waitingCount += wakeWaitingProcedures(tableLock);
|
waitingCount += wakeWaitingProcedures(tableLock);
|
||||||
}
|
}
|
||||||
if (namespaceLock.releaseSharedLock(procedure)) {
|
if (namespaceLock.releaseSharedLock()) {
|
||||||
waitingCount += wakeWaitingProcedures(namespaceLock);
|
waitingCount += wakeWaitingProcedures(namespaceLock);
|
||||||
}
|
}
|
||||||
addToRunQueue(tableRunQueue, getTableQueue(table));
|
addToRunQueue(tableRunQueue, getTableQueue(table));
|
||||||
|
@ -584,7 +584,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tableLock.trySharedLock(procedure)) {
|
if (!tableLock.trySharedLock(procedure)) {
|
||||||
namespaceLock.releaseSharedLock(procedure);
|
namespaceLock.releaseSharedLock();
|
||||||
waitProcedure(tableLock, procedure);
|
waitProcedure(tableLock, procedure);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -606,11 +606,11 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
final LockAndQueue namespaceLock = locking.getNamespaceLock(table.getNamespaceAsString());
|
final LockAndQueue namespaceLock = locking.getNamespaceLock(table.getNamespaceAsString());
|
||||||
final LockAndQueue tableLock = locking.getTableLock(table);
|
final LockAndQueue tableLock = locking.getTableLock(table);
|
||||||
int waitingCount = 0;
|
int waitingCount = 0;
|
||||||
if (tableLock.releaseSharedLock(procedure)) {
|
if (tableLock.releaseSharedLock()) {
|
||||||
addToRunQueue(tableRunQueue, getTableQueue(table));
|
addToRunQueue(tableRunQueue, getTableQueue(table));
|
||||||
waitingCount += wakeWaitingProcedures(tableLock);
|
waitingCount += wakeWaitingProcedures(tableLock);
|
||||||
}
|
}
|
||||||
if (namespaceLock.releaseSharedLock(procedure)) {
|
if (namespaceLock.releaseSharedLock()) {
|
||||||
waitingCount += wakeWaitingProcedures(namespaceLock);
|
waitingCount += wakeWaitingProcedures(namespaceLock);
|
||||||
}
|
}
|
||||||
wakePollIfNeeded(waitingCount);
|
wakePollIfNeeded(waitingCount);
|
||||||
|
@ -784,7 +784,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
|
|
||||||
final LockAndQueue namespaceLock = locking.getNamespaceLock(namespace);
|
final LockAndQueue namespaceLock = locking.getNamespaceLock(namespace);
|
||||||
if (!namespaceLock.tryExclusiveLock(procedure)) {
|
if (!namespaceLock.tryExclusiveLock(procedure)) {
|
||||||
systemNamespaceTableLock.releaseSharedLock(procedure);
|
systemNamespaceTableLock.releaseSharedLock();
|
||||||
waitProcedure(namespaceLock, procedure);
|
waitProcedure(namespaceLock, procedure);
|
||||||
logLockedResource(LockedResourceType.NAMESPACE, namespace);
|
logLockedResource(LockedResourceType.NAMESPACE, namespace);
|
||||||
return true;
|
return true;
|
||||||
|
@ -811,7 +811,7 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler {
|
||||||
if (namespaceLock.releaseExclusiveLock(procedure)) {
|
if (namespaceLock.releaseExclusiveLock(procedure)) {
|
||||||
waitingCount += wakeWaitingProcedures(namespaceLock);
|
waitingCount += wakeWaitingProcedures(namespaceLock);
|
||||||
}
|
}
|
||||||
if (systemNamespaceTableLock.releaseSharedLock(procedure)) {
|
if (systemNamespaceTableLock.releaseSharedLock()) {
|
||||||
addToRunQueue(tableRunQueue, getTableQueue(TableName.NAMESPACE_TABLE_NAME));
|
addToRunQueue(tableRunQueue, getTableQueue(TableName.NAMESPACE_TABLE_NAME));
|
||||||
waitingCount += wakeWaitingProcedures(systemNamespaceTableLock);
|
waitingCount += wakeWaitingProcedures(systemNamespaceTableLock);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue