Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22AE9D7B5 for ; Fri, 26 Oct 2012 17:30:03 +0000 (UTC) Received: (qmail 40992 invoked by uid 500); 26 Oct 2012 17:30:03 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 40794 invoked by uid 500); 26 Oct 2012 17:30:02 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 40777 invoked by uid 99); 26 Oct 2012 17:30:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2012 17:30:01 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Oct 2012 17:29:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 9A0D623888EA for ; Fri, 26 Oct 2012 17:29:13 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1402588 - in /hbase/branches/0.94/src: main/java/org/apache/hadoop/hbase/io/hfile/ main/java/org/apache/hadoop/hbase/regionserver/metrics/ test/java/org/apache/hadoop/hbase/regionserver/metrics/ Date: Fri, 26 Oct 2012 17:29:13 -0000 To: commits@hbase.apache.org From: larsh@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20121026172913.9A0D623888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: larsh Date: Fri Oct 26 17:29:12 2012 New Revision: 1402588 URL: http://svn.apache.org/viewvc?rev=1402588&view=rev Log: HBASE-6852 REVERT due to test failures. Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/SchemaMetrics.java hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/metrics/TestSchemaMetrics.java Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java?rev=1402588&r1=1402587&r2=1402588&view=diff ============================================================================== --- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java (original) +++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV1.java Fri Oct 26 17:29:12 2012 @@ -391,8 +391,6 @@ public class HFileReaderV1 extends Abstr this.istream.close(); this.istream = null; } - - getSchemaMetrics().flushMetrics(); } protected abstract static class AbstractScannerV1 Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java?rev=1402588&r1=1402587&r2=1402588&view=diff ============================================================================== --- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java (original) +++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java Fri Oct 26 17:29:12 2012 @@ -424,8 +424,6 @@ public class HFileReaderV2 extends Abstr istream = null; } } - - getSchemaMetrics().flushMetrics(); } protected abstract static class AbstractScannerV2 Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/SchemaMetrics.java URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/SchemaMetrics.java?rev=1402588&r1=1402587&r2=1402588&view=diff ============================================================================== --- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/SchemaMetrics.java (original) +++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/metrics/SchemaMetrics.java Fri Oct 26 17:29:12 2012 @@ -29,7 +29,6 @@ import java.util.Set; import java.util.TreeMap; import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicLongArray; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -39,6 +38,7 @@ import org.apache.commons.logging.LogFac import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.io.hfile.BlockType.BlockCategory; +import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Pair; @@ -236,9 +236,6 @@ public class SchemaMetrics { public static final SchemaMetrics ALL_SCHEMA_METRICS = getInstance(TOTAL_KEY, TOTAL_KEY); - /** Threshold for flush the metrics, currently used only for "on cache hit" */ - private static final long THRESHOLD_METRICS_FLUSH = 100l; - /** * Whether to include table name in metric names. If this is null, it has not * been initialized. This is a global instance, but we also have a copy of it @@ -257,8 +254,6 @@ public class SchemaMetrics { private final String[] bloomMetricNames = new String[2]; private final String[] storeMetricNames = new String[NUM_STORE_METRIC_TYPES]; private final String[] storeMetricNamesMax = new String[NUM_STORE_METRIC_TYPES]; - private final AtomicLongArray onHitCacheMetrics= - new AtomicLongArray(NUM_BLOCK_CATEGORIES * BOOL_VALUES.length); private SchemaMetrics(final String tableName, final String cfName) { String metricPrefix = SchemaMetrics.generateSchemaMetricsPrefix( @@ -266,9 +261,6 @@ public class SchemaMetrics { for (BlockCategory blockCategory : BlockCategory.values()) { for (boolean isCompaction : BOOL_VALUES) { - // initialize the cache metrics - onHitCacheMetrics.set(getCacheHitMetricIndex(blockCategory, isCompaction), 0); - for (BlockMetricType metricType : BlockMetricType.values()) { if (!metricType.compactionAware && isCompaction) { continue; @@ -344,11 +336,6 @@ public class SchemaMetrics { return existingMetrics != null ? existingMetrics : schemaMetrics; } - private static final int getCacheHitMetricIndex (BlockCategory blockCategory, - boolean isCompaction) { - return blockCategory.ordinal() * BOOL_VALUES.length + (isCompaction ? 1 : 0); - } - private static final int getBlockMetricIndex(BlockCategory blockCategory, boolean isCompaction, BlockMetricType metricType) { int i = 0; @@ -378,20 +365,11 @@ public class SchemaMetrics { */ private void incrNumericMetric(BlockCategory blockCategory, boolean isCompaction, BlockMetricType metricType) { - incrNumericMetric (blockCategory, isCompaction, metricType, 1); - } - - /** - * Increments the given metric, both per-CF and aggregate, for both the given - * category and all categories in aggregate (four counters total). - */ - private void incrNumericMetric(BlockCategory blockCategory, - boolean isCompaction, BlockMetricType metricType, long amount) { if (blockCategory == null) { blockCategory = BlockCategory.UNKNOWN; // So that we see this in stats. } RegionMetricsStorage.incrNumericMetric(getBlockMetricName(blockCategory, - isCompaction, metricType), amount); + isCompaction, metricType), 1); if (blockCategory != BlockCategory.ALL_CATEGORIES) { incrNumericMetric(BlockCategory.ALL_CATEGORIES, isCompaction, @@ -467,59 +445,14 @@ public class SchemaMetrics { */ public void updateOnCacheHit(BlockCategory blockCategory, boolean isCompaction) { - updateOnCacheHit (blockCategory, isCompaction, 1); - } - - /** - * Updates the number of hits and the total number of block reads on a block - * cache hit. - */ - public void updateOnCacheHit(BlockCategory blockCategory, - boolean isCompaction, long count) { blockCategory.expectSpecific(); - int idx = getCacheHitMetricIndex(blockCategory, isCompaction); - - if (this.onHitCacheMetrics.addAndGet(idx, count) > THRESHOLD_METRICS_FLUSH) { - flushCertainOnCacheHitMetrics(blockCategory, isCompaction); - } - } - - private void flushCertainOnCacheHitMetrics(BlockCategory blockCategory, boolean isCompaction) { - int idx = getCacheHitMetricIndex(blockCategory, isCompaction); - long tempCount = this.onHitCacheMetrics.getAndSet(idx, 0); - - if (tempCount > 0) { - incrNumericMetric(blockCategory, isCompaction, BlockMetricType.CACHE_HIT, tempCount); - incrNumericMetric(blockCategory, isCompaction, BlockMetricType.READ_COUNT, tempCount); - if (this != ALL_SCHEMA_METRICS) { - ALL_SCHEMA_METRICS.updateOnCacheHit(blockCategory, isCompaction, tempCount); - } - } - } - - /** - * Flush the on cache hit metrics; - */ - private void flushOnCacheHitMetrics() { - for (BlockCategory blockCategory : BlockCategory.values()) { - for (boolean isCompaction : BOOL_VALUES) { - flushCertainOnCacheHitMetrics (blockCategory, isCompaction); - } - } - } - - /** - * Notify the SchemaMetrics to flush all of the the metrics - */ - public void flushMetrics() { - // currently only for "on cache hit metrics" - flushOnCacheHitMetrics(); - + incrNumericMetric(blockCategory, isCompaction, BlockMetricType.CACHE_HIT); + incrNumericMetric(blockCategory, isCompaction, BlockMetricType.READ_COUNT); if (this != ALL_SCHEMA_METRICS) { - ALL_SCHEMA_METRICS.flushMetrics(); + ALL_SCHEMA_METRICS.updateOnCacheHit(blockCategory, isCompaction); } } - + /** * Updates read time, the number of misses, and the total number of block * reads on a block cache miss. Modified: hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/metrics/TestSchemaMetrics.java URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/metrics/TestSchemaMetrics.java?rev=1402588&r1=1402587&r2=1402588&view=diff ============================================================================== --- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/metrics/TestSchemaMetrics.java (original) +++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/metrics/TestSchemaMetrics.java Fri Oct 26 17:29:12 2012 @@ -201,10 +201,8 @@ public class TestSchemaMetrics { for (boolean isCompaction : BOOL_VALUES) { sm.updateOnCacheHit(blockCat, isCompaction); - sm.flushMetrics(); checkMetrics(); sm.updateOnCacheMiss(blockCat, isCompaction, rand.nextInt()); - sm.flushMetrics(); checkMetrics(); }