From 9f7557729cafafcf71aa7a6f0f7ee54013f7c624 Mon Sep 17 00:00:00 2001 From: Nicolas Spiegelberg Date: Tue, 22 Nov 2011 03:56:59 +0000 Subject: [PATCH] HBASE-4808 Test to Ensure Expired Deletes Don't Override Puts git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1204802 13f79535-47bb-0310-9956-ffa450edef68 --- .../hbase/regionserver/TestStoreScanner.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java b/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java index f881c6584e7..cbd9e081b0b 100644 --- a/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java +++ b/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java @@ -466,4 +466,33 @@ public class TestStoreScanner extends TestCase { 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 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 results = new ArrayList(); + assertEquals(true, scanner.next(results)); + assertEquals(1, results.size()); + assertEquals(kvs[1], results.get(0)); + results.clear(); + + assertEquals(false, scanner.next(results)); + } }