hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1204802 - /hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
Date Tue, 22 Nov 2011 03:57:00 GMT
Author: nspiegelberg
Date: Tue Nov 22 03:56:59 2011
New Revision: 1204802

URL: http://svn.apache.org/viewvc?rev=1204802&view=rev
Log:
HBASE-4808 Test to Ensure Expired Deletes Don't Override Puts

Modified:
    hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java?rev=1204802&r1=1204801&r2=1204802&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java Tue
Nov 22 03:56:59 2011
@@ -466,4 +466,33 @@ public class TestStoreScanner extends Te
         getCols("a"), scanners);
     assertNull(scan.peek());
   }
+
+  /**
+   * Ensure that expired delete family markers don't override valid puts
+   */
+  public void testExpiredDeleteFamily() throws Exception {
+    long now = System.currentTimeMillis();
+    KeyValue [] kvs = new KeyValue[] {
+        new KeyValue(Bytes.toBytes("R1"), Bytes.toBytes("cf"), null, now-1000,
+            KeyValue.Type.DeleteFamily),
+        KeyValueTestUtil.create("R1", "cf", "a", now-10, KeyValue.Type.Put,
+            "dont-care"),
+    };
+    List<KeyValueScanner> scanners = scanFixture(kvs);
+    Scan scan = new Scan();
+    scan.setMaxVersions(1);
+    // scanner with ttl equal to 500
+    ScanInfo scanInfo = new ScanInfo(CF, 0, 1, 500, false, KeyValue.COMPARATOR);
+    ScanType scanType = ScanType.USER_SCAN;
+    StoreScanner scanner =
+        new StoreScanner(scan, scanInfo, scanType, null, scanners);
+
+    List<KeyValue> results = new ArrayList<KeyValue>();
+    assertEquals(true, scanner.next(results));
+    assertEquals(1, results.size());
+    assertEquals(kvs[1], results.get(0));
+    results.clear();
+
+    assertEquals(false, scanner.next(results));
+  }
 }



Mime
View raw message