From 77dae7ccb788e5d06ae6105ec9d800b204c77bec Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 8 Dec 2011 00:11:26 +0000 Subject: [PATCH] HBASE-4976 Add compaction/flush queue size metrics mistakenly removed by HFile v2 git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1211719 13f79535-47bb-0310-9956-ffa450edef68 --- .../hbase/regionserver/HRegionServer.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java index 10b70a68d6b..bda089223d1 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionServer.java @@ -759,12 +759,12 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, LOG.info("stopping server " + this.serverNameFromMasterPOV + "; all regions closed."); } - - //fsOk flag may be changed when closing regions throws exception. + + //fsOk flag may be changed when closing regions throws exception. if (!this.killed && this.fsOk) { closeWAL(abortRequested ? false : true); } - + // Make sure the proxy is down. if (this.hbaseMaster != null) { HBaseRPC.stopProxy(this.hbaseMaster); @@ -1389,6 +1389,10 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, (int) (totalStaticBloomSize / 1024)); this.metrics.readRequestsCount.set(readRequestsCount); this.metrics.writeRequestsCount.set(writeRequestsCount); + this.metrics.compactionQueueSize.set(compactSplitThread + .getCompactionQueueSize()); + this.metrics.flushQueueSize.set(cacheFlusher + .getFlushQueueSize()); BlockCache blockCache = cacheConfig.getBlockCache(); if (blockCache != null) { @@ -1674,7 +1678,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, public boolean isAborted() { return this.abortRequested; } - + /* * Simulate a kill -9 of this server. Exits w/o closing regions or cleaninup * logs but it does close socket in case want to bring up server on old @@ -2575,16 +2579,16 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, } return RegionOpeningState.OPENED; } - + private void checkIfRegionInTransition(HRegionInfo region, String currentAction) throws RegionAlreadyInTransitionException { byte[] encodedName = region.getEncodedNameAsBytes(); if (this.regionsInTransitionInRS.containsKey(encodedName)) { boolean openAction = this.regionsInTransitionInRS.get(encodedName); // The below exception message will be used in master. - throw new RegionAlreadyInTransitionException("Received:" + currentAction + + throw new RegionAlreadyInTransitionException("Received:" + currentAction + " for the region:" + region.getRegionNameAsString() + - " ,which we are already trying to " + + " ,which we are already trying to " + (openAction ? OPEN : CLOSE)+ "."); } } @@ -2621,7 +2625,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, checkIfRegionInTransition(region, CLOSE); return closeRegion(region, false, zk); } - + @Override @QosPriority(priority=HIGH_QOS) public boolean closeRegion(byte[] encodedRegionName, boolean zk) throws IOException { @@ -2655,7 +2659,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, this.service.submit(crh); return true; } - + /** * @param encodedRegionName * encodedregionName to close @@ -3282,7 +3286,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, public ConcurrentSkipListMap getRegionsInTransitionInRS() { return this.regionsInTransitionInRS; } - + public ExecutorService getExecutorService() { return service; } @@ -3305,7 +3309,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, // read in the name of the source replication class from the config file. String sourceClassname = conf.get(HConstants.REPLICATION_SOURCE_SERVICE_CLASSNAME, HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT); - + // read in the name of the sink replication class from the config file. String sinkClassname = conf.get(HConstants.REPLICATION_SINK_SERVICE_CLASSNAME, HConstants.REPLICATION_SERVICE_CLASSNAME_DEFAULT); @@ -3330,7 +3334,7 @@ public class HRegionServer implements HRegionInterface, HBaseRPCErrorHandler, } static private ReplicationService newReplicationInstance(String classname, - Configuration conf, HRegionServer server, FileSystem fs, Path logDir, + Configuration conf, HRegionServer server, FileSystem fs, Path logDir, Path oldLogDir) throws IOException{ Class clazz = null;