hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1530764 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
Date Wed, 09 Oct 2013 19:04:25 GMT
Author: larsh
Date: Wed Oct  9 19:04:25 2013
New Revision: 1530764

URL: http://svn.apache.org/r1530764
Log:
HBASE=9732 Static AtomicLong updated in StoreFileScanner every (re)seek

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
    hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java?rev=1530764&r1=1530763&r2=1530764&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
Wed Oct  9 19:04:25 2013
@@ -54,7 +54,7 @@ public class StoreFileScanner implements
 
   private boolean enforceMVCC = false;
 
-  private static final AtomicLong seekCount = new AtomicLong();
+  private static AtomicLong seekCount;
 
   private ScanQueryMatcher matcher;
 
@@ -135,7 +135,7 @@ public class StoreFileScanner implements
   }
 
   public boolean seek(KeyValue key) throws IOException {
-    seekCount.incrementAndGet();
+    if (seekCount != null) seekCount.incrementAndGet();
 
     try {
       try {
@@ -156,7 +156,7 @@ public class StoreFileScanner implements
   }
 
   public boolean reseek(KeyValue key) throws IOException {
-    seekCount.incrementAndGet();
+    if (seekCount != null) seekCount.incrementAndGet();
 
     try {
       try {
@@ -375,6 +375,9 @@ public class StoreFileScanner implements
   static final long getSeekCount() {
     return seekCount.get();
   }
+  static final void instrument() {
+    seekCount = new AtomicLong();
+  }
 
   @Override
   public boolean shouldUseScanner(Scan scan, SortedSet<byte[]> columns, long oldestUnexpiredTS)
{

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java?rev=1530764&r1=1530763&r2=1530764&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
Wed Oct  9 19:04:25 2013
@@ -140,6 +140,9 @@ public class TestSeekOptimizations {
 
   @Test
   public void testMultipleTimestampRanges() throws IOException {
+    // enable seek counting
+    StoreFileScanner.instrument();
+
     region = TEST_UTIL.createTestRegion("testMultipleTimestampRanges",
         new HColumnDescriptor(FAMILY)
             .setCompressionType(comprAlgo)



Mime
View raw message