From d43e28dc8269d19596aaf801de8e63c8bbd8b68f Mon Sep 17 00:00:00 2001 From: zhangduo Date: Fri, 27 Jul 2018 08:40:46 +0800 Subject: [PATCH] Revert "HBASE-20949 Add logs for debugging" This reverts commit 8b8de1f8a77b5b9f6d4b8cfb7eeb3d545a69d0f2. --- .../hadoop/hbase/procedure2/LockAndQueue.java | 13 +++---------- .../master/procedure/MasterProcedureScheduler.java | 14 +++++++------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/LockAndQueue.java b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/LockAndQueue.java index f86c7c8dafe..ae8daa28314 100644 --- a/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/LockAndQueue.java +++ b/hbase-procedure/src/main/java/org/apache/hadoop/hbase/procedure2/LockAndQueue.java @@ -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(); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java index 4180a962e56..2a29ee1cbb4 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterProcedureScheduler.java @@ -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); }