hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1498531 - in /hbase/trunk/hbase-server/src: main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
Date Mon, 01 Jul 2013 15:55:20 GMT
Author: larsh
Date: Mon Jul  1 15:55:20 2013
New Revision: 1498531

URL: http://svn.apache.org/r1498531
Log:
HBASE-8809 Include deletes in the scan (setRaw) method does not respect the time range or
the filter

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

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java?rev=1498531&r1=1498530&r2=1498531&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
Mon Jul  1 15:55:20 2013
@@ -323,7 +323,11 @@ public class ScanQueryMatcher {
           || kv.getMemstoreTS() > maxReadPointToTrackVersions) {
         // always include or it is not time yet to check whether it is OK
         // to purge deltes or not
-        return MatchCode.INCLUDE;
+        if (!isUserScan) {
+          // if this is not a user scan (compaction), we can filter this deletemarker right
here
+          // otherwise (i.e. a "raw" scan) we fall through to normal version and timerange
checking
+          return MatchCode.INCLUDE;
+        }
       } else if (keepDeletedCells) {
         if (timestamp < earliestPutTs) {
           // keeping delete rows, but there are no puts older than

Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java?rev=1498531&r1=1498530&r2=1498531&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
(original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
Mon Jul  1 15:55:20 2013
@@ -318,12 +318,55 @@ public class TestKeepDeletes extends HBa
     InternalScanner scan = region.getScanner(s);
     List<KeyValue> kvs = new ArrayList<KeyValue>();
     scan.next(kvs);
+    assertEquals(8, kvs.size());
     assertTrue(kvs.get(0).isDeleteFamily());
     assertEquals(kvs.get(1).getValue(), T3);
     assertTrue(kvs.get(2).isDelete());
     assertTrue(kvs.get(3).isDeleteType());
     assertEquals(kvs.get(4).getValue(), T2);
     assertEquals(kvs.get(5).getValue(), T1);
+    // we have 3 CFs, so there are two more delete markers
+    assertTrue(kvs.get(6).isDeleteFamily());
+    assertTrue(kvs.get(7).isDeleteFamily());
+
+    // verify that raw scans honor the passed timerange
+    s = new Scan();
+    s.setRaw(true);
+    s.setMaxVersions();
+    s.setTimeRange(0, 1);
+    scan = region.getScanner(s);
+    kvs = new ArrayList<KeyValue>();
+    scan.next(kvs);
+    // nothing in this interval, not even delete markers
+    assertTrue(kvs.isEmpty());
+
+    // filter new delete markers
+    s = new Scan();
+    s.setRaw(true);
+    s.setMaxVersions();
+    s.setTimeRange(0, ts+2);
+    scan = region.getScanner(s);
+    kvs = new ArrayList<KeyValue>();
+    scan.next(kvs);
+    assertEquals(4, kvs.size());
+    assertTrue(kvs.get(0).isDeleteFamily());
+    assertEquals(kvs.get(1).getValue(), T1);
+    // we have 3 CFs
+    assertTrue(kvs.get(2).isDeleteFamily());
+    assertTrue(kvs.get(3).isDeleteFamily());
+
+    // filter old delete markers
+    s = new Scan();
+    s.setRaw(true);
+    s.setMaxVersions();
+    s.setTimeRange(ts+3, ts+5);
+    scan = region.getScanner(s);
+    kvs = new ArrayList<KeyValue>();
+    scan.next(kvs);
+    assertEquals(2, kvs.size());
+    assertEquals(kvs.get(0).getValue(), T3);
+    assertTrue(kvs.get(1).isDelete());
+
 
     HRegion.closeHRegion(region);
   }



Mime
View raw message