hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1187531 [2/2] - in /hbase/trunk: ./ src/docbkx/ src/main/java/org/apache/hadoop/hbase/ src/main/java/org/apache/hadoop/hbase/client/ src/main/java/org/apache/hadoop/hbase/regionserver/ src/main/ruby/hbase/ src/test/java/org/apache/hadoop/h...
Date Fri, 21 Oct 2011 19:57:08 GMT
Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java?rev=1187531&r1=1187530&r2=1187531&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java Fri
Oct 21 19:57:07 2011
@@ -49,7 +49,7 @@ public class TestMinVersions extends HBa
    * Verify behavior of getClosestBefore(...)
    */
   public void testGetClosestBefore() throws Exception {
-    HTableDescriptor htd = createTableDescriptor(getName(), 1, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 1, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
 
     long ts = System.currentTimeMillis() - 2000; // 2s in the past
@@ -92,7 +92,7 @@ public class TestMinVersions extends HBa
    */
   public void testStoreMemStore() throws Exception {
     // keep 3 versions minimum
-    HTableDescriptor htd = createTableDescriptor(getName(), 3, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 3, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
 
     long ts = System.currentTimeMillis() - 2000; // 2s in the past
@@ -141,7 +141,7 @@ public class TestMinVersions extends HBa
    * Make sure the Deletes behave as expected with minimum versions
    */
   public void testDelete() throws Exception {
-    HTableDescriptor htd = createTableDescriptor(getName(), 3, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 3, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
 
     long ts = System.currentTimeMillis() - 2000; // 2s in the past
@@ -193,7 +193,7 @@ public class TestMinVersions extends HBa
    * Make sure the memstor behaves correctly with minimum versions
    */
   public void testMemStore() throws Exception {
-    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
 
     long ts = System.currentTimeMillis() - 2000; // 2s in the past
@@ -262,7 +262,7 @@ public class TestMinVersions extends HBa
    */
   public void testBaseCase() throws Exception {
     // 1 version minimum, 1000 versions maximum, ttl = 1s
-    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
 
     long ts = System.currentTimeMillis() - 2000; // 2s in the past
@@ -347,7 +347,7 @@ public class TestMinVersions extends HBa
    * minimum versions enabled.
    */
   public void testFilters() throws Exception {
-    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1);
+    HTableDescriptor htd = createTableDescriptor(getName(), 2, 1000, 1, false);
     HRegion region = createNewHRegion(htd, null, null);
     final byte [] c1 = COLUMNS[1];
 
@@ -408,7 +408,7 @@ public class TestMinVersions extends HBa
     g.setMaxVersions();
     r = region.get(g, null);
     checkResult(r, c0, T2);
-}
+  }
 
   private void checkResult(Result r, byte[] col, byte[] ... vals) {
     assertEquals(r.size(), vals.length);

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestQueryMatcher.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestQueryMatcher.java?rev=1187531&r1=1187530&r2=1187531&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestQueryMatcher.java (original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestQueryMatcher.java Fri
Oct 21 19:57:07 2011
@@ -26,6 +26,7 @@ import java.util.List;
 
 import org.apache.hadoop.hbase.HBaseTestCase;
 import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.KeyValue.KVComparator;
 import org.apache.hadoop.hbase.KeyValue.KeyComparator;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.Scan;
@@ -51,7 +52,7 @@ public class TestQueryMatcher extends HB
   private Get get;
 
   long ttl = Long.MAX_VALUE;
-  KeyComparator rowComparator;
+  KVComparator rowComparator;
   private Scan scan;
 
   public void setUp() throws Exception {
@@ -76,7 +77,7 @@ public class TestQueryMatcher extends HB
     get.addColumn(fam2, col5);
     this.scan = new Scan(get);
 
-    rowComparator = KeyValue.KEY_COMPARATOR;
+    rowComparator = KeyValue.COMPARATOR;
 
   }
 
@@ -95,8 +96,9 @@ public class TestQueryMatcher extends HB
     expected.add(ScanQueryMatcher.MatchCode.DONE);
 
     // 2,4,5
-    ScanQueryMatcher qm = new ScanQueryMatcher(scan, fam2,
-        get.getFamilyMap().get(fam2), ttl, rowComparator, 1);
+    
+    ScanQueryMatcher qm = new ScanQueryMatcher(scan, new Store.ScanInfo(fam2,
+        0, 1, ttl, false, rowComparator), get.getFamilyMap().get(fam2));
 
     List<KeyValue> memstore = new ArrayList<KeyValue>();
     memstore.add(new KeyValue(row1, fam2, col1, 1, data));
@@ -139,7 +141,8 @@ public class TestQueryMatcher extends HB
     expected.add(ScanQueryMatcher.MatchCode.INCLUDE);
     expected.add(ScanQueryMatcher.MatchCode.DONE);
 
-    ScanQueryMatcher qm = new ScanQueryMatcher(scan, fam2, null, ttl, rowComparator, 1);
+    ScanQueryMatcher qm = new ScanQueryMatcher(scan, new Store.ScanInfo(fam2,
+        0, 1, ttl, false, rowComparator), null);
 
     List<KeyValue> memstore = new ArrayList<KeyValue>();
     memstore.add(new KeyValue(row1, fam2, col1, 1, data));
@@ -189,8 +192,8 @@ public class TestQueryMatcher extends HB
         ScanQueryMatcher.MatchCode.DONE
     };
 
-    ScanQueryMatcher qm = new ScanQueryMatcher(scan, fam2,
-        get.getFamilyMap().get(fam2), testTTL, rowComparator, 1);
+    ScanQueryMatcher qm = new ScanQueryMatcher(scan, new Store.ScanInfo(fam2,
+        0, 1, testTTL, false, rowComparator), get.getFamilyMap().get(fam2));
 
     long now = System.currentTimeMillis();
     KeyValue [] kvs = new KeyValue[] {
@@ -241,8 +244,8 @@ public class TestQueryMatcher extends HB
         ScanQueryMatcher.MatchCode.DONE
     };
 
-    ScanQueryMatcher qm = new ScanQueryMatcher(scan, fam2,
-        null, testTTL, rowComparator, 1);
+    ScanQueryMatcher qm = new ScanQueryMatcher(scan, new Store.ScanInfo(fam2,
+        0, 1, testTTL, false, rowComparator), null);
 
     long now = System.currentTimeMillis();
     KeyValue [] kvs = new KeyValue[] {

Modified: hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanWildcardColumnTracker.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanWildcardColumnTracker.java?rev=1187531&r1=1187530&r2=1187531&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanWildcardColumnTracker.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/regionserver/TestScanWildcardColumnTracker.java
Fri Oct 21 19:57:07 2011
@@ -25,6 +25,7 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.hadoop.hbase.HBaseTestCase;
+import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.regionserver.ScanQueryMatcher.MatchCode;
 import org.apache.hadoop.hbase.util.Bytes;
 
@@ -54,7 +55,7 @@ public class TestScanWildcardColumnTrack
 
     for(byte [] qualifier : qualifiers) {
       ScanQueryMatcher.MatchCode mc = tracker.checkColumn(qualifier, 0,
-          qualifier.length, 1);
+          qualifier.length, 1, KeyValue.Type.Put.getCode());
       actual.add(mc);
     }
 
@@ -87,7 +88,7 @@ public class TestScanWildcardColumnTrack
     long timestamp = 0;
     for(byte [] qualifier : qualifiers) {
       MatchCode mc = tracker.checkColumn(qualifier, 0, qualifier.length,
-          ++timestamp);
+          ++timestamp, KeyValue.Type.Put.getCode());
       actual.add(mc);
     }
 
@@ -110,7 +111,8 @@ public class TestScanWildcardColumnTrack
 
     try {
       for(byte [] qualifier : qualifiers) {
-        tracker.checkColumn(qualifier, 0, qualifier.length, 1);
+        tracker.checkColumn(qualifier, 0, qualifier.length, 1,
+            KeyValue.Type.Put.getCode());
       }
     } catch (Exception e) {
       ok = true;

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=1187531&r1=1187530&r2=1187531&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 Fri
Oct 21 19:57:07 2011
@@ -24,16 +24,13 @@ import junit.framework.TestCase;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.KeyValueTestUtil;
 import org.apache.hadoop.hbase.client.Scan;
+import org.apache.hadoop.hbase.regionserver.Store.ScanInfo;
+import org.apache.hadoop.hbase.regionserver.StoreScanner.ScanType;
 import org.apache.hadoop.hbase.util.Bytes;
-import org.mockito.Mockito;
-import org.mockito.stubbing.OngoingStubbing;
-
-import com.google.common.collect.Lists;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.List;
 import java.util.NavigableSet;
 import java.util.TreeSet;
@@ -42,6 +39,9 @@ import static org.apache.hadoop.hbase.re
 public class TestStoreScanner extends TestCase {
   private static final String CF_STR = "cf";
   final byte [] CF = Bytes.toBytes(CF_STR);
+  private ScanInfo scanInfo = new ScanInfo(CF, 0, Integer.MAX_VALUE, Long.MAX_VALUE, false,
+      KeyValue.COMPARATOR);
+  private ScanType scanType = ScanType.USER_SCAN;
 
   /*
    * Test utility for building a NavigableSet for scanners.
@@ -74,9 +74,8 @@ public class TestStoreScanner extends Te
     Scan scanSpec = new Scan(Bytes.toBytes(r1));
     scanSpec.setTimeRange(0, 6);
     scanSpec.setMaxVersions();
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-        KeyValue.COMPARATOR, getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(5, results.size());
@@ -85,8 +84,8 @@ public class TestStoreScanner extends Te
     scanSpec = new Scan(Bytes.toBytes(r1));
     scanSpec.setTimeRange(1, 3);
     scanSpec.setMaxVersions();
-    scan = new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-      KeyValue.COMPARATOR, getCols("a"), scanners);
+    scan = new StoreScanner(scanSpec, scanInfo, scanType, getCols("a"),
+        scanners);
     results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(2, results.size());
@@ -94,8 +93,8 @@ public class TestStoreScanner extends Te
     scanSpec = new Scan(Bytes.toBytes(r1));
     scanSpec.setTimeRange(5, 10);
     scanSpec.setMaxVersions();
-    scan = new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-      KeyValue.COMPARATOR, getCols("a"), scanners);
+    scan = new StoreScanner(scanSpec, scanInfo, scanType, getCols("a"),
+        scanners);
     results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(1, results.size());
@@ -104,8 +103,8 @@ public class TestStoreScanner extends Te
     scanSpec = new Scan(Bytes.toBytes(r1));
     scanSpec.setTimeRange(0, 10);
     scanSpec.setMaxVersions(3);
-    scan = new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-      KeyValue.COMPARATOR, getCols("a"), scanners);
+    scan = new StoreScanner(scanSpec, scanInfo, scanType, getCols("a"),
+        scanners);
     results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(3, results.size());
@@ -124,10 +123,8 @@ public class TestStoreScanner extends Te
 
     Scan scanSpec = new Scan(Bytes.toBytes("R1"));
     // this only uses maxVersions (default=1) and TimeRange (default=all)
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-          KeyValue.COMPARATOR, getCols("a"),
-          scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
@@ -153,10 +150,8 @@ public class TestStoreScanner extends Te
 
     Scan scanSpec = new Scan(Bytes.toBytes("R1"));
     // this only uses maxVersions (default=1) and TimeRange (default=all)
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE,
-          KeyValue.COMPARATOR, getCols("a"),
-          scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
     scan.next(results);
@@ -183,9 +178,8 @@ public class TestStoreScanner extends Te
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
     Scan scanSpec = new Scan(Bytes.toBytes("R1"));
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertFalse(scan.next(results));
@@ -204,9 +198,8 @@ public class TestStoreScanner extends Te
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
     Scan scanSpec = new Scan(Bytes.toBytes("R1"));
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
@@ -232,9 +225,8 @@ public class TestStoreScanner extends Te
     };
     List<KeyValueScanner> scanners = scanFixture(kvs1, kvs2);
 
-    StoreScanner scan =
-      new StoreScanner(new Scan(Bytes.toBytes("R1")), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(new Scan(Bytes.toBytes("R1")),
+        scanInfo, scanType, getCols("a"), scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     // the two put at ts=now will be masked by the 1 delete, and
     // since the scan default returns 1 version we'll return the newest
@@ -258,9 +250,8 @@ public class TestStoreScanner extends Te
     List<KeyValueScanner> scanners = scanFixture(kvs1, kvs2);
 
     Scan scanSpec = new Scan(Bytes.toBytes("R1")).setMaxVersions(2);
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(2, results.size());
@@ -275,9 +266,8 @@ public class TestStoreScanner extends Te
         KeyValueTestUtil.create("R1", "cf", "a", 1, KeyValue.Type.DeleteColumn, "dont-care"),
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-      new StoreScanner(new Scan(Bytes.toBytes("R1")), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          null, scanners);
+    StoreScanner scan = new StoreScanner(new Scan(Bytes.toBytes("R1")),
+        scanInfo, scanType, null, scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(2, results.size());
@@ -305,9 +295,8 @@ public class TestStoreScanner extends Te
 
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-      new StoreScanner(new Scan().setMaxVersions(2), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          null, scanners);
+    StoreScanner scan = new StoreScanner(new Scan().setMaxVersions(2),
+        scanInfo, scanType, null, scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(5, results.size());
@@ -334,9 +323,9 @@ public class TestStoreScanner extends Te
         KeyValueTestUtil.create("R2", "cf", "a", 11, KeyValue.Type.Put, "dont-care"),
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-      new StoreScanner(new Scan().setMaxVersions(Integer.MAX_VALUE), CF, Long.MAX_VALUE,
KeyValue.COMPARATOR,
-          null, scanners);
+    StoreScanner scan = new StoreScanner(
+        new Scan().setMaxVersions(Integer.MAX_VALUE), scanInfo, scanType, null,
+        scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(0, results.size());
@@ -355,9 +344,8 @@ public class TestStoreScanner extends Te
         KeyValueTestUtil.create("R1", "cf", "b", 5, KeyValue.Type.Put, "dont-care")
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-      new StoreScanner(new Scan(), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          null, scanners);
+    StoreScanner scan = new StoreScanner(new Scan(), scanInfo, scanType, null,
+        scanners);
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
     assertEquals(1, results.size());
@@ -379,9 +367,8 @@ public class TestStoreScanner extends Te
 
   public void testSkipColumn() throws IOException {
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-      new StoreScanner(new Scan(), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a", "d"), scanners);
+    StoreScanner scan = new StoreScanner(new Scan(), scanInfo, scanType,
+        getCols("a", "d"), scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
     assertEquals(true, scan.next(results));
@@ -417,8 +404,11 @@ public class TestStoreScanner extends Te
     List<KeyValueScanner> scanners = scanFixture(kvs);
     Scan scan = new Scan();
     scan.setMaxVersions(1);
+    ScanInfo scanInfo = new ScanInfo(CF, 0, 1, 500, false,
+        KeyValue.COMPARATOR);
+    ScanType scanType = ScanType.USER_SCAN;
     StoreScanner scanner =
-      new StoreScanner(scan, CF, 500, KeyValue.COMPARATOR,
+      new StoreScanner(scan, scanInfo, scanType,
           null, scanners);
 
     List<KeyValue> results = new ArrayList<KeyValue>();
@@ -440,10 +430,8 @@ public class TestStoreScanner extends Te
 
   public void testScannerReseekDoesntNPE() throws Exception {
     List<KeyValueScanner> scanners = scanFixture(kvs);
-    StoreScanner scan =
-        new StoreScanner(new Scan(), CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-            getCols("a", "d"), scanners);
-
+    StoreScanner scan = new StoreScanner(new Scan(), scanInfo, scanType,
+        getCols("a", "d"), scanners);
 
     // Previously a updateReaders twice in a row would cause an NPE.  In test this would
also
     // normally cause an NPE because scan.store is null.  So as long as we get through these
@@ -467,9 +455,8 @@ public class TestStoreScanner extends Te
     };
     List<KeyValueScanner> scanners = scanFixture(kvs);
     Scan scanSpec = new Scan(Bytes.toBytes("R1"));
-    StoreScanner scan =
-      new StoreScanner(scanSpec, CF, Long.MAX_VALUE, KeyValue.COMPARATOR,
-          getCols("a"), scanners);
+    StoreScanner scan = new StoreScanner(scanSpec, scanInfo, scanType,
+        getCols("a"), scanners);
     assertNull(scan.peek());
   }
 }



Mime
View raw message