hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1530766 - in /hbase/branches/0.94/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:07:20 GMT
Author: larsh
Date: Wed Oct  9 19:07:19 2013
New Revision: 1530766

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

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java?rev=1530766&r1=1530765&r2=1530766&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/StoreFileScanner.java
Wed Oct  9 19:07:19 2013
@@ -52,7 +52,7 @@ public class StoreFileScanner implements
 
   private boolean enforceMVCC = false;
 
-  private static final AtomicLong seekCount = new AtomicLong();
+  private static AtomicLong seekCount;
 
   private ScanQueryMatcher matcher;
 
@@ -133,7 +133,7 @@ public class StoreFileScanner implements
   }
 
   public boolean seek(KeyValue key) throws IOException {
-    seekCount.incrementAndGet();
+    if (seekCount != null) seekCount.incrementAndGet();
 
     try {
       try {
@@ -154,7 +154,7 @@ public class StoreFileScanner implements
   }
 
   public boolean reseek(KeyValue key) throws IOException {
-    seekCount.incrementAndGet();
+    if (seekCount != null) seekCount.incrementAndGet();
 
     try {
       try {
@@ -366,6 +366,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/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java?rev=1530766&r1=1530765&r2=1530766&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestSeekOptimizations.java
Wed Oct  9 19:07:19 2013
@@ -142,6 +142,8 @@ public class TestSeekOptimizations {
 
   @Test
   public void testMultipleTimestampRanges() throws IOException {
+    // enable seek counting
+    StoreFileScanner.instrument();
     region = TEST_UTIL.createTestRegion(TestSeekOptimizations.class.getName(),
         new HColumnDescriptor(FAMILY)
             .setCompressionType(comprAlgo)



Mime
View raw message