From fd940f3b78ae541fe135a564bf0f17889d0b51cc Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 16 Oct 2018 21:21:02 -0700 Subject: [PATCH] HBASE-21327 Fix minor logging issue where we don't report servername if no associated SCP Signed-off-by: Duo Zhang --- .../hbase/master/RegionServerTracker.java | 4 ++-- .../balancer/StochasticLoadBalancer.java | 21 +++++++------------ .../procedure/MasterProcedureScheduler.java | 5 ++++- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java index b2aedf09bef..f419732eb85 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionServerTracker.java @@ -126,8 +126,8 @@ public class RegionServerTracker extends ZKListener { // deadServersFromPE is made from a list of outstanding ServerCrashProcedures. // splittingServersFromWALDir are being actively split -- the directory in the FS ends in // '-SPLITTING'. Each splitting server should have a corresponding SCP. Log if not. - splittingServersFromWALDir.stream().map(s -> !deadServersFromPE.contains(s)). - forEach(s -> LOG.error("{} has no matching ServerCrashProcedure", s)); + splittingServersFromWALDir.stream().filter(s -> !deadServersFromPE.contains(s)). + forEach(s -> LOG.error("{} has no matching ServerCrashProcedure", s)); watcher.registerListener(this); synchronized (this) { List servers = diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java index 1ff8d1771cf..a93e2db1d04 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/StochasticLoadBalancer.java @@ -433,21 +433,16 @@ public class StochasticLoadBalancer extends BaseLoadBalancer { updateStochasticCosts(tableName, curOverallCost, curFunctionCosts); if (initCost > currentCost) { plans = createRegionPlans(cluster); - if (LOG.isDebugEnabled()) { - LOG.debug("Finished computing new load balance plan. Computation took " - + (endTime - startTime) + "ms to try " + step - + " different iterations. Found a solution that moves " - + plans.size() + " regions; Going from a computed cost of " - + initCost + " to a new cost of " + currentCost); - } - + LOG.info("Finished computing new load balance plan. Computation took {}" + + " to try {} different iterations. Found a solution that moves " + + "{} regions; Going from a computed cost of {}" + + " to a new cost of {}", java.time.Duration.ofMillis(endTime - startTime), + step, plans.size(), initCost, currentCost); return plans; } - if (LOG.isDebugEnabled()) { - LOG.debug("Could not find a better load balance plan. Tried " - + step + " different configurations in " + (endTime - startTime) - + "ms, and did not find anything with a computed cost less than " + initCost); - } + LOG.info("Could not find a better load balance plan. Tried {} different configurations in " + + "{}, and did not find anything with a computed cost less than {}", step, + java.time.Duration.ofMillis(endTime - startTime), initCost); return null; } 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 2a29ee1cbb4..5ee5f496844 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 @@ -686,7 +686,6 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { boolean hasLock = true; final LockAndQueue[] regionLocks = new LockAndQueue[regionInfo.length]; for (int i = 0; i < regionInfo.length; ++i) { - LOG.info("{} checking lock on {}", procedure, regionInfo[i].getEncodedName()); assert regionInfo[i] != null; assert regionInfo[i].getTable() != null; assert regionInfo[i].getTable().equals(table): regionInfo[i] + " " + procedure; @@ -694,12 +693,16 @@ public class MasterProcedureScheduler extends AbstractProcedureScheduler { regionLocks[i] = locking.getRegionLock(regionInfo[i].getEncodedName()); if (!regionLocks[i].tryExclusiveLock(procedure)) { + LOG.info("Waiting on xlock for {} held by pid={}", procedure, + regionLocks[i].getExclusiveLockProcIdOwner()); waitProcedure(regionLocks[i], procedure); hasLock = false; while (i-- > 0) { regionLocks[i].releaseExclusiveLock(procedure); } break; + } else { + LOG.info("Took xlock for {}", procedure); } }