hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1498532 - in /hbase/branches/0.94/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:43 GMT
Author: larsh
Date: Mon Jul  1 15:55:43 2013
New Revision: 1498532

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

Modified:
    hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
    hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java

Modified: hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java?rev=1498532&r1=1498531&r2=1498532&view=diff
==============================================================================
--- hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
(original)
+++ hbase/branches/0.94/src/main/java/org/apache/hadoop/hbase/regionserver/ScanQueryMatcher.java
Mon Jul  1 15:55:43 2013
@@ -296,7 +296,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/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java?rev=1498532&r1=1498531&r2=1498532&view=diff
==============================================================================
--- hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
(original)
+++ hbase/branches/0.94/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java
Mon Jul  1 15:55:43 2013
@@ -276,16 +276,16 @@ public class TestKeepDeletes extends HBa
     p.add(c0, c0, T3);
     region.put(p);
 
-    Delete d = new Delete(T1, ts+1, null);
-    region.delete(d, null, true);
+    Delete d = new Delete(T1, ts+1);
+    region.delete(d, true);
 
-    d = new Delete(T1, ts+2, null);
+    d = new Delete(T1, ts+2);
     d.deleteColumn(c0, c0, ts+2);
-    region.delete(d, null, true);
+    region.delete(d, true);
 
-    d = new Delete(T1, ts+3, null);
+    d = new Delete(T1, ts+3);
     d.deleteColumns(c0, c0, ts+3);
-    region.delete(d, null, true);
+    region.delete(d, true);
 
     Scan s = new Scan();
     s.setRaw(true);
@@ -293,12 +293,54 @@ 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());
 
     region.close();
     region.getLog().closeAndDelete();



Mime
View raw message