hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yangzhe1...@apache.org
Subject [1/2] hbase git commit: HBASE-15968 New behavior of versions considering mvcc and ts rather than ts only
Date Tue, 25 Jul 2017 07:06:59 GMT
Repository: hbase
Updated Branches:
  refs/heads/master fabab8c23 -> 1ac4152b1


http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestReversibleScanners.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestReversibleScanners.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestReversibleScanners.java
index 4475955..3782fdb 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestReversibleScanners.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestReversibleScanners.java
@@ -266,7 +266,7 @@ public class TestReversibleScanners {
     ScanType scanType = ScanType.USER_SCAN;
     ScanInfo scanInfo =
         new ScanInfo(TEST_UTIL.getConfiguration(), FAMILYNAME, 0, Integer.MAX_VALUE, Long.MAX_VALUE,
-            KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR);
+            KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR,
false);
 
     // Case 1.Test a full reversed scan
     Scan scan = new Scan();

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
index 10f00a6..1653728 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java
@@ -69,7 +69,7 @@ public class TestStoreScanner {
   private static final byte [] CF = Bytes.toBytes(CF_STR);
   static Configuration CONF = HBaseConfiguration.create();
   private ScanInfo scanInfo = new ScanInfo(CONF, CF, 0, Integer.MAX_VALUE, Long.MAX_VALUE,
-      KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR);
+      KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR,
false);
   private ScanType scanType = ScanType.USER_SCAN;
 
   /**
@@ -831,7 +831,7 @@ public class TestStoreScanner {
     Scan scan = new Scan();
     scan.setMaxVersions(1);
     ScanInfo scanInfo = new ScanInfo(CONF, CF, 0, 1, 500, KeepDeletedCells.FALSE,
-        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR);
+        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR, false);
     ScanType scanType = ScanType.USER_SCAN;
     try (StoreScanner scanner = new StoreScanner(scan, scanInfo, scanType, null, scanners))
{
       List<Cell> results = new ArrayList<>();
@@ -904,7 +904,7 @@ public class TestStoreScanner {
     scan.setMaxVersions(1);
     // scanner with ttl equal to 500
     ScanInfo scanInfo = new ScanInfo(CONF, CF, 0, 1, 500, KeepDeletedCells.FALSE,
-        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR);
+        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR, false);
     ScanType scanType = ScanType.USER_SCAN;
     try (StoreScanner scanner =
         new StoreScanner(scan, scanInfo, scanType, null, scanners)) {
@@ -971,7 +971,7 @@ public class TestStoreScanner {
         KeepDeletedCells.FALSE /* keepDeletedCells */,
         HConstants.DEFAULT_BLOCKSIZE /* block size */,
         200, /* timeToPurgeDeletes */
-        CellComparator.COMPARATOR);
+        CellComparator.COMPARATOR, false);
       try (StoreScanner scanner =
         new StoreScanner(scan, scanInfo,
           ScanType.COMPACT_DROP_DELETES, null, scanners,
@@ -1004,7 +1004,7 @@ public class TestStoreScanner {
     List<KeyValueScanner> scanners = scanFixture(kvs);
     Scan scan = new Scan();
     ScanInfo scanInfo = new ScanInfo(CONF, CF, 0, 1, 500, KeepDeletedCells.FALSE,
-        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR);
+        HConstants.DEFAULT_BLOCKSIZE, 0, CellComparator.COMPARATOR, false);
     StoreScanner storeScanner = new StoreScanner(scan, scanInfo, scanType, null, scanners);
     assertFalse(storeScanner.isScanUsePread());
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestCompactionScanQueryMatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestCompactionScanQueryMatcher.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestCompactionScanQueryMatcher.java
index 73c92e4..3d5ed44 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestCompactionScanQueryMatcher.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestCompactionScanQueryMatcher.java
@@ -74,7 +74,7 @@ public class TestCompactionScanQueryMatcher extends AbstractTestScanQueryMatcher
     long now = EnvironmentEdgeManager.currentTime();
     // Set time to purge deletes to negative value to avoid it ever happening.
     ScanInfo scanInfo = new ScanInfo(this.conf, fam2, 0, 1, ttl, KeepDeletedCells.FALSE,
-        HConstants.DEFAULT_BLOCKSIZE, -1L, rowComparator);
+        HConstants.DEFAULT_BLOCKSIZE, -1L, rowComparator, false);
 
     CompactionScanQueryMatcher qm = CompactionScanQueryMatcher.create(scanInfo,
       ScanType.COMPACT_RETAIN_DELETES, Long.MAX_VALUE, HConstants.OLDEST_TIMESTAMP,

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestNewVersionBehaviorTracker.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestNewVersionBehaviorTracker.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestNewVersionBehaviorTracker.java
new file mode 100644
index 0000000..420622d
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestNewVersionBehaviorTracker.java
@@ -0,0 +1,262 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver.querymatcher;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.KeyValue;
+import org.apache.hadoop.hbase.regionserver.querymatcher.DeleteTracker.DeleteResult;
+import org.apache.hadoop.hbase.regionserver.querymatcher.ScanQueryMatcher.MatchCode;
+import org.apache.hadoop.hbase.testclassification.RegionServerTests;
+import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import static org.junit.Assert.assertEquals;
+
+@Category({ RegionServerTests.class, SmallTests.class })
+public class TestNewVersionBehaviorTracker {
+
+  private final byte[] col1 = Bytes.toBytes("col1");
+  private final byte[] col2 = Bytes.toBytes("col2");
+  private final byte[] row = Bytes.toBytes("row");
+  private final byte[] family = Bytes.toBytes("family");
+  private final byte[] value = Bytes.toBytes("value");
+
+  @Test
+  public void testMaxVersionMask() {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 10000);
+
+    KeyValue keyValue = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    keyValue.setTimestamp(20000);
+    keyValue.setSequenceId(1000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(999);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(998);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19998);
+    keyValue.setSequenceId(997);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19997);
+    keyValue.setSequenceId(996);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+
+    keyValue = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    keyValue.setTimestamp(20000);
+    keyValue.setSequenceId(1000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(1002);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(1001);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19998);
+    keyValue.setSequenceId(1003);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    keyValue.setTimestamp(19997);
+    keyValue.setSequenceId(1004);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+  }
+
+  @Test
+  public void testVersionsDelete() {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 10000);
+    KeyValue put = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    KeyValue delete = new KeyValue(row, family, col1, 20000, KeyValue.Type.DeleteColumn,
value);
+    delete.setSequenceId(1000);
+    delete.setTimestamp(20000);
+    tracker.add(delete);
+    put.setSequenceId(1001);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(19998);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+
+    delete = new KeyValue(row, family, col2, 20000, KeyValue.Type.DeleteColumn, value);
+    delete.setSequenceId(1002);
+    delete.setTimestamp(20000);
+    tracker.add(delete);
+    put = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    put.setSequenceId(1001);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(19998);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+  }
+
+  @Test
+  public void testVersionDelete() {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 10000);
+    KeyValue put = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    KeyValue delete = new KeyValue(row, family, col1, 20000, KeyValue.Type.Delete, value);
+    delete.setSequenceId(1000);
+    delete.setTimestamp(20000);
+    tracker.add(delete);
+    put.setSequenceId(1001);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.VERSION_DELETED, tracker.isDeleted(put));
+
+    delete = new KeyValue(row, family, col2, 20000, KeyValue.Type.Delete, value);
+    delete.setSequenceId(1002);
+    delete.setTimestamp(20000);
+    tracker.add(delete);
+    put = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    put.setSequenceId(1001);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.VERSION_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.VERSION_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(1002);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(998);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(put));
+  }
+
+  @Test
+  public void testFamilyVersionsDelete() {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 10000);
+
+    KeyValue delete = new KeyValue(row, family, null, 20000, KeyValue.Type.DeleteFamily,
value);
+    delete.setSequenceId(1000);
+    delete.setTimestamp(20000);
+
+    KeyValue put = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    tracker.add(delete);
+    put.setSequenceId(1001);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(19998);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+
+    put = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    put.setSequenceId(998);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(19998);
+    assertEquals(DeleteResult.COLUMN_DELETED, tracker.isDeleted(put));
+  }
+
+  @Test
+  public void testFamilyVersionDelete() {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 10000);
+
+    KeyValue delete = new KeyValue(row, family, null, 20000, KeyValue.Type.DeleteFamilyVersion,
+        value);
+    delete.setSequenceId(1000);
+    delete.setTimestamp(20000);
+    tracker.add(delete);
+
+    KeyValue put = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    put.setSequenceId(1001);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.VERSION_DELETED, tracker.isDeleted(put));
+
+    put = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    put.setSequenceId(1001);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(999);
+    put.setTimestamp(20000);
+    assertEquals(DeleteResult.VERSION_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(1002);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(put));
+    put.setSequenceId(998);
+    put.setTimestamp(19999);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(put));
+  }
+
+  @Test
+  public void testMinVersionsAndTTL() throws IOException {
+    NewVersionBehaviorTracker tracker = new NewVersionBehaviorTracker(null, 1, 3, 3, 30000);
+
+    KeyValue keyValue = new KeyValue(row, family, col1, 20000, KeyValue.Type.Put, value);
+    keyValue.setTimestamp(20000);
+    keyValue.setSequenceId(1000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.INCLUDE_AND_SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(999);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(
+        MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(998);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19998);
+    keyValue.setSequenceId(997);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19997);
+    keyValue.setSequenceId(996);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+
+    keyValue = new KeyValue(row, family, col2, 20000, KeyValue.Type.Put, value);
+    keyValue.setTimestamp(20000);
+    keyValue.setSequenceId(1000);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.INCLUDE_AND_SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(1002);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19999);
+    keyValue.setSequenceId(1001);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19998);
+    keyValue.setSequenceId(1003);
+    assertEquals(DeleteResult.NOT_DELETED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+    keyValue.setTimestamp(19997);
+    keyValue.setSequenceId(1004);
+    assertEquals(DeleteResult.VERSION_MASKED, tracker.isDeleted(keyValue));
+    assertEquals(MatchCode.SEEK_NEXT_COL,
+        tracker.checkVersions(keyValue, keyValue.getTimestamp(), keyValue.getTypeByte(),
false));
+  }
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcher.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcher.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcher.java
index f3cf604..2d80b3f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcher.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/querymatcher/TestUserScanQueryMatcher.java
@@ -55,7 +55,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher
{
     // Do with fam2 which has a col2 qualifier.
     UserScanQueryMatcher qm = UserScanQueryMatcher.create(scan,
       new ScanInfo(this.conf, fam2, 10, 1, ttl, KeepDeletedCells.FALSE,
-          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator),
+          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
       get.getFamilyMap().get(fam2), now - ttl, now, null);
     Cell kv = new KeyValue(row1, fam2, col2, 1, data);
     Cell cell = CellUtil.createLastOnRowCol(kv);
@@ -82,7 +82,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher
{
     // 2,4,5
     UserScanQueryMatcher qm = UserScanQueryMatcher.create(
       scan, new ScanInfo(this.conf, fam2, 0, 1, ttl, KeepDeletedCells.FALSE,
-          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator),
+          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
       get.getFamilyMap().get(fam2), now - ttl, now, null);
 
     List<KeyValue> memstore = new ArrayList<>(6);
@@ -125,7 +125,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher
{
 
     long now = EnvironmentEdgeManager.currentTime();
     UserScanQueryMatcher qm = UserScanQueryMatcher.create(scan, new ScanInfo(this.conf, fam2,
0, 1,
-        ttl, KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator),
+        ttl, KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
       null, now - ttl, now, null);
 
     List<KeyValue> memstore = new ArrayList<>(6);
@@ -171,7 +171,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher
{
     long now = EnvironmentEdgeManager.currentTime();
     UserScanQueryMatcher qm = UserScanQueryMatcher.create(scan,
       new ScanInfo(this.conf, fam2, 0, 1, testTTL, KeepDeletedCells.FALSE,
-          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator),
+          HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator, false),
       get.getFamilyMap().get(fam2), now - testTTL, now, null);
 
     KeyValue[] kvs = new KeyValue[] { new KeyValue(row1, fam2, col1, now - 100, data),
@@ -213,7 +213,7 @@ public class TestUserScanQueryMatcher extends AbstractTestScanQueryMatcher
{
 
     long now = EnvironmentEdgeManager.currentTime();
     UserScanQueryMatcher qm = UserScanQueryMatcher.create(scan, new ScanInfo(this.conf, fam2,
0, 1,
-        testTTL, KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator),
+        testTTL, KeepDeletedCells.FALSE, HConstants.DEFAULT_BLOCKSIZE, 0, rowComparator,
false),
       null, now - testTTL, now, null);
 
     KeyValue[] kvs = new KeyValue[] { new KeyValue(row1, fam2, col1, now - 100, data),

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOnNewVersionBehaviorTable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOnNewVersionBehaviorTable.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOnNewVersionBehaviorTable.java
new file mode 100644
index 0000000..843ca99
--- /dev/null
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsOnNewVersionBehaviorTable.java
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.security.visibility;
+
+import java.io.IOException;
+
+import org.apache.hadoop.hbase.HColumnDescriptor;
+import org.apache.hadoop.hbase.HTableDescriptor;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Table;
+
+public class TestVisibilityLabelsOnNewVersionBehaviorTable extends TestVisibilityLabelsWithDeletes
{
+
+  protected Table createTable(HColumnDescriptor fam) throws IOException {
+    fam.setNewVersionBehavior(true);
+    TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
+    HTableDescriptor table = new HTableDescriptor(tableName);
+    table.addFamily(fam);
+    TEST_UTIL.getHBaseAdmin().createTable(table);
+    return TEST_UTIL.getConnection().getTable(tableName);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index 9e244ab..dfc48bf 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -41,9 +41,11 @@ import org.apache.hadoop.hbase.security.User;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.SecurityTests;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.Threads;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
@@ -73,11 +75,11 @@ public class TestVisibilityLabelsWithDeletes {
   public static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
   private static final byte[] row1 = Bytes.toBytes("row1");
   private static final byte[] row2 = Bytes.toBytes("row2");
-  private final static byte[] fam = Bytes.toBytes("info");
-  private final static byte[] qual = Bytes.toBytes("qual");
+  protected final static byte[] fam = Bytes.toBytes("info");
+  protected final static byte[] qual = Bytes.toBytes("qual");
   private final static byte[] qual1 = Bytes.toBytes("qual1");
   private final static byte[] qual2 = Bytes.toBytes("qual2");
-  private final static byte[] value = Bytes.toBytes("value");
+  protected final static byte[] value = Bytes.toBytes("value");
   private final static byte[] value1 = Bytes.toBytes("value1");
   public static Configuration conf;
 
@@ -111,13 +113,20 @@ public class TestVisibilityLabelsWithDeletes {
   public void tearDown() throws Exception {
   }
 
+  protected Table createTable(HColumnDescriptor fam) throws IOException {
+    TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
+    HTableDescriptor table = new HTableDescriptor(tableName);
+    table.addFamily(fam);
+    TEST_UTIL.getHBaseAdmin().createTable(table);
+    return TEST_UTIL.getConnection().getTable(tableName);
+  }
+
   @Test
   public void testVisibilityLabelsWithDeleteColumns() throws Throwable {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
 
-    try (Table table = createTableAndWriteDataWithLabels(tableName,
-        SECRET + "&" + TOPSECRET, SECRET)) {
+    try (Table table = createTableAndWriteDataWithLabels(SECRET + "&" + TOPSECRET, SECRET))
{
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>()
{
         @Override
         public Void run() throws Exception {
@@ -154,8 +163,7 @@ public class TestVisibilityLabelsWithDeletes {
   public void testVisibilityLabelsWithDeleteFamily() throws Exception {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    try (Table table = createTableAndWriteDataWithLabels(tableName, SECRET,
-        CONFIDENTIAL + "|" + TOPSECRET);) {
+    try (Table table = createTableAndWriteDataWithLabels(SECRET, CONFIDENTIAL + "|" + TOPSECRET);)
{
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>()
{
         @Override
         public Void run() throws Exception {
@@ -192,7 +200,7 @@ public class TestVisibilityLabelsWithDeletes {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     long[] ts = new long[] { 123l, 125l };
-    try (Table table = createTableAndWriteDataWithLabels(tableName, ts,
+    try (Table table = createTableAndWriteDataWithLabels(ts,
         CONFIDENTIAL + "|" + TOPSECRET, SECRET)) {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>()
{
         @Override
@@ -230,7 +238,7 @@ public class TestVisibilityLabelsWithDeletes {
     setAuths();
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     long[] ts = new long[] { 123l, 125l };
-    try (Table table = createTableAndWriteDataWithLabels(tableName, ts,
+    try (Table table = createTableAndWriteDataWithLabels(ts,
         CONFIDENTIAL + "|" + TOPSECRET, SECRET);) {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>()
{
         @Override
@@ -2230,7 +2238,7 @@ public class TestVisibilityLabelsWithDeletes {
     };
     VisibilityLabelsResponse response = SUPERUSER.runAs(action);
     final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
-    try (Table table = doPuts(tableName)){
+    try (Table table = doPuts(tableName)) {
       PrivilegedExceptionAction<Void> actiona = new PrivilegedExceptionAction<Void>()
{
         @Override
         public Void run() throws Exception {
@@ -3220,10 +3228,10 @@ public class TestVisibilityLabelsWithDeletes {
     assertEquals(0, result.rawCells().length);
   }
 
-  public static Table createTableAndWriteDataWithLabels(TableName tableName, String... labelExps)
+  public Table createTableAndWriteDataWithLabels(String... labelExps)
       throws Exception {
-    Table table = null;
-    table = TEST_UTIL.createTable(tableName, fam);
+    HColumnDescriptor cf = new HColumnDescriptor(fam);
+    Table table = createTable(cf);
     int i = 1;
     List<Put> puts = new ArrayList<>(labelExps.length);
     for (String labelExp : labelExps) {
@@ -3238,10 +3246,10 @@ public class TestVisibilityLabelsWithDeletes {
     return table;
   }
 
-  public static Table createTableAndWriteDataWithLabels(TableName tableName, long[] timestamp,
+  public Table createTableAndWriteDataWithLabels(long[] timestamp,
       String... labelExps) throws Exception {
-    Table table = null;
-    table = TEST_UTIL.createTable(tableName, fam);
+    HColumnDescriptor cf = new HColumnDescriptor(fam);
+    Table table = createTable(cf);
     int i = 1;
     List<Put> puts = new ArrayList<>(labelExps.length);
     for (String labelExp : labelExps) {
@@ -3250,7 +3258,7 @@ public class TestVisibilityLabelsWithDeletes {
       put.setCellVisibility(new CellVisibility(labelExp));
       puts.add(put);
       table.put(put);
-      TEST_UTIL.getAdmin().flush(tableName);
+      TEST_UTIL.getAdmin().flush(table.getName());
       i++;
     }
     return table;

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index 920d3ac..2a44243 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -249,7 +249,7 @@ public class TestCoprocessorScanPolicy {
       ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(), family.getName(),
           family.getMinVersions(), newVersions == null ? family.getMaxVersions() : newVersions,
           newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
-          family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
+          family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator(), family.isNewVersionBehavior());
       Scan scan = new Scan();
       scan.setMaxVersions(newVersions == null ? oldSI.getMaxVersions() : newVersions);
       return new StoreScanner(store, scanInfo, scan, scanners,
@@ -269,7 +269,7 @@ public class TestCoprocessorScanPolicy {
       ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(), family.getName(),
           family.getMinVersions(), newVersions == null ? family.getMaxVersions() : newVersions,
           newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
-          family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
+          family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator(), family.isNewVersionBehavior());
       Scan scan = new Scan();
       scan.setMaxVersions(newVersions == null ? oldSI.getMaxVersions() : newVersions);
       return new StoreScanner(store, scanInfo, scan, scanners, scanType,
@@ -289,7 +289,7 @@ public class TestCoprocessorScanPolicy {
         ScanInfo scanInfo = new ScanInfo(TEST_UTIL.getConfiguration(), family.getName(),
             family.getMinVersions(), newVersions == null ? family.getMaxVersions() : newVersions,
             newTtl == null ? oldSI.getTtl() : newTtl, family.getKeepDeletedCells(),
-            family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator());
+            family.getBlocksize(), oldSI.getTimeToPurgeDeletes(), oldSI.getComparator(),
family.isNewVersionBehavior());
         return new StoreScanner(store, scanInfo, scan, targetCols, readPt);
       } else {
         return s;

http://git-wip-us.apache.org/repos/asf/hbase/blob/1ac4152b/hbase-shell/src/main/ruby/hbase/admin.rb
----------------------------------------------------------------------
diff --git a/hbase-shell/src/main/ruby/hbase/admin.rb b/hbase-shell/src/main/ruby/hbase/admin.rb
index 460ede3..d7c2739 100644
--- a/hbase-shell/src/main/ruby/hbase/admin.rb
+++ b/hbase-shell/src/main/ruby/hbase/admin.rb
@@ -877,6 +877,7 @@ module Hbase
       family.setPrefetchBlocksOnOpen(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::PREFETCH_BLOCKS_ON_OPEN)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::PREFETCH_BLOCKS_ON_OPEN)
       family.setMobEnabled(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::IS_MOB)
       family.setMobThreshold(JLong.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::MOB_THRESHOLD)
+      family.setNewVersionBehavior(JBoolean.valueOf(arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::NEW_VERSION_BEHAVIOR)))
if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::NEW_VERSION_BEHAVIOR)
       if arg.include?(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER)
         bloomtype = arg.delete(org.apache.hadoop.hbase.HColumnDescriptor::BLOOMFILTER).upcase.to_sym
         if org.apache.hadoop.hbase.regionserver.BloomType.constants.include?(bloomtype)


Mime
View raw message