From 2c7fdb39ce0ad8b5468bd221673b3bfa5e69fcda Mon Sep 17 00:00:00 2001 From: Jan Hentschel Date: Sun, 21 Apr 2019 11:10:02 +0200 Subject: [PATCH] HBASE-22277 Removed deprecated methods from Get --- .../hbase/backup/impl/BackupSystemTable.java | 6 +- .../org/apache/hadoop/hbase/client/Get.java | 58 +-------- .../hadoop/hbase/protobuf/ProtobufUtil.java | 2 +- .../hbase/shaded/protobuf/ProtobufUtil.java | 2 +- .../apache/hadoop/hbase/client/TestGet.java | 2 +- .../apache/hadoop/hbase/client/TestScan.java | 2 +- .../hbase/mapreduce/TestImportExport.java | 4 +- .../hadoop/hbase/rest/RowResultGenerator.java | 2 +- .../hbase/rest/client/TestRemoteTable.java | 4 +- .../hadoop/hbase/regionserver/HRegion.java | 2 +- .../security/access/AccessController.java | 6 +- .../hadoop/hbase/TestMultiVersions.java | 2 +- .../hadoop/hbase/TestSerialization.java | 2 +- .../hadoop/hbase/TimestampTestBase.java | 6 +- .../hbase/client/TestFromClientSide.java | 110 +++++++++--------- .../hbase/client/TestMultipleTimestamps.java | 2 +- .../hbase/client/TestTimestampsFilter.java | 4 +- .../hbase/regionserver/TestHRegion.java | 18 +-- .../hbase/regionserver/TestKeepDeletes.java | 10 +- .../hbase/regionserver/TestMinVersions.java | 32 ++--- .../regionserver/TestMinorCompaction.java | 16 +-- .../TestNewVersionBehaviorFromClientSide.java | 36 +++--- .../TestCellACLWithMultipleVersions.java | 4 +- .../thrift/ThriftHBaseServiceHandler.java | 4 +- .../hadoop/hbase/thrift2/ThriftUtilities.java | 2 +- .../hbase/thrift2/TestThriftConnection.java | 6 +- 26 files changed, 144 insertions(+), 200 deletions(-) diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java index 1cfb7a3f172..cdb535bc7aa 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/BackupSystemTable.java @@ -1405,7 +1405,7 @@ public final class BackupSystemTable implements Closeable { private Get createGetForBackupInfo(String backupId) throws IOException { Get get = new Get(rowkey(BACKUP_INFO_PREFIX, backupId)); get.addFamily(BackupSystemTable.SESSIONS_FAMILY); - get.setMaxVersions(1); + get.readVersions(1); return get; } @@ -1440,7 +1440,7 @@ public final class BackupSystemTable implements Closeable { private Get createGetForStartCode(String rootPath) throws IOException { Get get = new Get(rowkey(START_CODE_ROW, rootPath)); get.addFamily(BackupSystemTable.META_FAMILY); - get.setMaxVersions(1); + get.readVersions(1); return get; } @@ -1463,7 +1463,7 @@ public final class BackupSystemTable implements Closeable { private Get createGetForIncrBackupTableSet(String backupRoot) throws IOException { Get get = new Get(rowkey(INCR_BACKUP_SET, backupRoot)); get.addFamily(BackupSystemTable.META_FAMILY); - get.setMaxVersions(1); + get.readVersions(1); return get; } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java index a671b9f6b26..3609c910f38 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java @@ -59,7 +59,7 @@ import org.apache.hadoop.hbase.util.Bytes; * {@link #setTimestamp(long) setTimestamp}. *

* To limit the number of versions of each column to be returned, execute - * {@link #setMaxVersions(int) setMaxVersions}. + * {@link #readVersions(int) readVersions}. *

* To add a filter, call {@link #setFilter(Filter) setFilter}. */ @@ -160,26 +160,6 @@ public class Get extends Query implements Row { return this; } - /** - * This will always return the default value which is false as client cannot set the value to this - * property any more. - * @deprecated since 2.0.0 and will be removed in 3.0.0 - */ - @Deprecated - public boolean isClosestRowBefore() { - return closestRowBefore; - } - - /** - * This is not used any more and does nothing. Use reverse scan instead. - * @deprecated since 2.0.0 and will be removed in 3.0.0 - */ - @Deprecated - public Get setClosestRowBefore(boolean closestRowBefore) { - // do Nothing - return this; - } - /** * Get all columns from the specified family. *

@@ -227,18 +207,6 @@ public class Get extends Query implements Row { return this; } - /** - * Get versions of columns with the specified timestamp. - * @param timestamp version timestamp - * @return this for invocation chaining - * @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0. - * Use {@link #setTimestamp(long)} instead - */ - @Deprecated - public Get setTimeStamp(long timestamp) throws IOException { - return this.setTimestamp(timestamp); - } - /** * Get versions of columns with the specified timestamp. * @param timestamp version timestamp @@ -260,30 +228,6 @@ public class Get extends Query implements Row { return (Get) super.setColumnFamilyTimeRange(cf, minStamp, maxStamp); } - /** - * Get all available versions. - * @return this for invocation chaining - * @deprecated It is easy to misunderstand with column family's max versions, so use - * {@link #readAllVersions()} instead. - */ - @Deprecated - public Get setMaxVersions() { - return readAllVersions(); - } - - /** - * Get up to the specified number of versions of each column. - * @param maxVersions maximum versions for each column - * @throws IOException if invalid number of versions - * @return this for invocation chaining - * @deprecated It is easy to misunderstand with column family's max versions, so use - * {@link #readVersions(int)} instead. - */ - @Deprecated - public Get setMaxVersions(int maxVersions) throws IOException { - return readVersions(maxVersions); - } - /** * Get all available versions. * @return this for invocation chaining diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java index a3d49b5ec18..78bbc3de72a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java @@ -381,7 +381,7 @@ public final class ProtobufUtil { get.setCacheBlocks(proto.getCacheBlocks()); } if (proto.hasMaxVersions()) { - get.setMaxVersions(proto.getMaxVersions()); + get.readVersions(proto.getMaxVersions()); } if (proto.hasStoreLimit()) { get.setMaxResultsPerColumnFamily(proto.getStoreLimit()); diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java index 336c59cdc8c..774b144444c 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/shaded/protobuf/ProtobufUtil.java @@ -524,7 +524,7 @@ public final class ProtobufUtil { get.setCacheBlocks(proto.getCacheBlocks()); } if (proto.hasMaxVersions()) { - get.setMaxVersions(proto.getMaxVersions()); + get.readVersions(proto.getMaxVersions()); } if (proto.hasStoreLimit()) { get.setMaxResultsPerColumnFamily(proto.getStoreLimit()); diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java index c8491b21e3f..f70ad017596 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java @@ -175,7 +175,7 @@ public class TestGet { get.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED); get.setCheckExistenceOnly(true); get.setTimeRange(3, 4); - get.setMaxVersions(11); + get.readVersions(11); get.setMaxResultsPerColumnFamily(10); get.setRowOffsetPerColumnFamily(11); get.setCacheBlocks(true); diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java index 7ef95245f27..eb48201a3b2 100644 --- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java +++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java @@ -78,7 +78,7 @@ public class TestScan { .setIsolationLevel(IsolationLevel.READ_COMMITTED) .setLoadColumnFamiliesOnDemand(false) .setMaxResultsPerColumnFamily(1000) - .setMaxVersions(9999) + .readVersions(9999) .setRowOffsetPerColumnFamily(5) .setTimeRange(0, 13) .setAttribute("att_v0", Bytes.toBytes("att_v0")) diff --git a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java index 9c4da4b8910..089b8eb3544 100644 --- a/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java +++ b/hbase-mapreduce/src/test/java/org/apache/hadoop/hbase/mapreduce/TestImportExport.java @@ -228,11 +228,11 @@ public class TestImportExport { assertTrue(runImport(args)); Get g = new Get(ROW1); - g.setMaxVersions(); + g.readAllVersions(); Result r = t.get(g); assertEquals(3, r.size()); g = new Get(ROW2); - g.setMaxVersions(); + g.readAllVersions(); r = t.get(g); assertEquals(3, r.size()); g = new Get(ROW3); diff --git a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java index 9bc3ec3c156..a7166f68eec 100644 --- a/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java +++ b/hbase-rest/src/main/java/org/apache/hadoop/hbase/rest/RowResultGenerator.java @@ -62,7 +62,7 @@ public class RowResultGenerator extends ResultGenerator { } } get.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime()); - get.setMaxVersions(rowspec.getMaxVersions()); + get.readVersions(rowspec.getMaxVersions()); if (filter != null) { get.setFilter(filter); } diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java index 0e786226ba2..3dae90cd11e 100644 --- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java +++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java @@ -249,7 +249,7 @@ public class TestRemoteTable { get = new Get(ROW_2); get.addFamily(COLUMN_1); - get.setMaxVersions(2); + get.readVersions(2); result = remoteTable.get(get); int count = 0; for (Cell kv: result.listCells()) { @@ -279,7 +279,7 @@ public class TestRemoteTable { //Test Versions gets = new ArrayList<>(2); Get g = new Get(ROW_1); - g.setMaxVersions(3); + g.readVersions(3); gets.add(g); gets.add(new Get(ROW_2)); results = remoteTable.get(gets); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index d291b39d22f..25e040c4edb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -3087,7 +3087,7 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi count = kvCount.get(qual); Get get = new Get(CellUtil.cloneRow(cell)); - get.setMaxVersions(count); + get.readVersions(count); get.addColumn(family, qual); if (coprocessorHost != null) { if (!coprocessorHost.prePrepareTimeStampForDeleteVersion(mutation, cell, diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java index 9dcfc8cbc17..62bcb349c3d 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/access/AccessController.java @@ -466,9 +466,9 @@ public class AccessController implements MasterCoprocessor, RegionCoprocessor, // version delete just consider only one version for those column cells. boolean considerCellTs = (request == OpType.PUT || request == OpType.DELETE); if (considerCellTs) { - get.setMaxVersions(); + get.readAllVersions(); } else { - get.setMaxVersions(1); + get.readVersions(1); } boolean diffCellTsFromOpTs = false; for (Map.Entry> entry: familyMap.entrySet()) { @@ -527,7 +527,7 @@ public class AccessController implements MasterCoprocessor, RegionCoprocessor, // where columns are added with TS other than the Mutation TS. But normally this wont be the // case with Put. There no need to get all versions but get latest version only. if (!diffCellTsFromOpTs && request == OpType.PUT) { - get.setMaxVersions(1); + get.readVersions(1); } if (LOG.isTraceEnabled()) { LOG.trace("Scanning for cells with " + get); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java index fe645bb469f..9d952d18e1e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestMultiVersions.java @@ -171,7 +171,7 @@ public class TestMultiVersions { assertTrue(Bytes.equals(value, value2)); // Now check getRow with multiple versions get = new Get(row); - get.setMaxVersions(); + get.readAllVersions(); r = table.get(get); assertTrue(r.size() == 2); value = r.getValue(contents, contents); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java index 24c9d78fa8a..3c30ba02e7e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestSerialization.java @@ -300,7 +300,7 @@ public class TestSerialization { Get get = new Get(row); get.addColumn(fam, qf1); get.setTimeRange(ts, ts+1); - get.setMaxVersions(maxVersions); + get.readVersions(maxVersions); ClientProtos.Get getProto = ProtobufUtil.toGet(get); Get desGet = ProtobufUtil.toGet(getProto); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java index 8e8d4ef083e..7f22a089ca2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/TimestampTestBase.java @@ -108,7 +108,7 @@ public class TimestampTestBase { Get get = null; get = new Get(ROW); get.addColumn(FAMILY_NAME, QUALIFIER_NAME); - get.setMaxVersions(3); + get.readVersions(3); Result result = incommon.get(get); Assert.assertEquals(1, result.size()); long time = Bytes.toLong(CellUtil.cloneValue(result.rawCells()[0])); @@ -138,7 +138,7 @@ public class TimestampTestBase { // order. get = new Get(ROW); get.addColumn(FAMILY_NAME, QUALIFIER_NAME); - get.setMaxVersions(tss.length); + get.readVersions(tss.length); Result result = incommon.get(get); Cell [] kvs = result.rawCells(); Assert.assertEquals(kvs.length, tss.length); @@ -154,7 +154,7 @@ public class TimestampTestBase { get = new Get(ROW); get.addColumn(FAMILY_NAME, QUALIFIER_NAME); get.setTimeRange(0, maxStamp); - get.setMaxVersions(kvs.length - 1); + get.readVersions(kvs.length - 1); result = incommon.get(get); kvs = result.rawCells(); Assert.assertEquals(kvs.length, tss.length - 1); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java index d590eacdeba..2c41ed39041 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestFromClientSide.java @@ -1358,7 +1358,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(2); + get.readVersions(2); Result result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[4], STAMPS[5]}, @@ -1399,7 +1399,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(2); + get.readVersions(2); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[4], STAMPS[5]}, @@ -1429,7 +1429,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(); + get.readAllVersions(); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8]}, @@ -1446,7 +1446,7 @@ public class TestFromClientSide { 0, 7); get = new Get(ROW); - get.setMaxVersions(); + get.readAllVersions(); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8]}, @@ -1491,7 +1491,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8], STAMPS[9], STAMPS[11], STAMPS[13], STAMPS[15]}, @@ -1516,7 +1516,7 @@ public class TestFromClientSide { // Test that it's gone get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[8], STAMPS[9], STAMPS[13], STAMPS[15]}, @@ -1566,7 +1566,7 @@ public class TestFromClientSide { Get get = new Get(ROW); get.addColumn(FAMILIES[0], QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long [] {STAMPS[1]}, @@ -1575,7 +1575,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addFamily(FAMILIES[0]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long [] {STAMPS[1]}, @@ -1604,7 +1604,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILIES[1], QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[1], QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3]}, @@ -1613,7 +1613,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addFamily(FAMILIES[1]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[1], QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3]}, @@ -1642,7 +1642,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILIES[2], QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[2], QUALIFIER, new long [] {STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6]}, @@ -1651,7 +1651,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[2], QUALIFIER, new long [] {STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6]}, @@ -1679,7 +1679,7 @@ public class TestFromClientSide { // Try all families get = new Get(ROW); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 9 keys but received " + result.size(), result.size() == 9); @@ -1688,7 +1688,7 @@ public class TestFromClientSide { get.addFamily(FAMILIES[0]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 9 keys but received " + result.size(), result.size() == 9); @@ -1697,7 +1697,7 @@ public class TestFromClientSide { get.addColumn(FAMILIES[0], QUALIFIER); get.addColumn(FAMILIES[1], QUALIFIER); get.addColumn(FAMILIES[2], QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 9 keys but received " + result.size(), result.size() == 9); @@ -1755,7 +1755,7 @@ public class TestFromClientSide { for (int i = 0; i < 1; i++) { Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[i]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); // verify version '1000'/'3000'/'5000' remains for all columns assertNResult(result, ROW, FAMILY, QUALIFIERS[i], @@ -1826,7 +1826,7 @@ public class TestFromClientSide { // 5. check ROW get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[0]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIERS[0], new long [] {ts[4]}, @@ -1835,7 +1835,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[1]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIERS[1], new long [] {ts[2], ts[4]}, @@ -1844,13 +1844,13 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertEquals(0, result.size()); get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[3]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIERS[3], new long [] {ts[2], ts[4]}, @@ -1859,7 +1859,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIERS[4]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIERS[4], new long [] {ts[2]}, @@ -1870,7 +1870,7 @@ public class TestFromClientSide { for (int i = 0; i < 5; i++) { get = new Get(ROW2); get.addColumn(FAMILY, QUALIFIERS[i]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); // verify version '1000'/'3000'/'5000' remains for all columns assertNResult(result, ROW2, FAMILY, QUALIFIERS[i], @@ -1930,7 +1930,7 @@ public class TestFromClientSide { Get get = new Get(ROW); get.addFamily(FAMILIES[0]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long [] {ts[1]}, @@ -1962,7 +1962,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILIES[0], QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long [] {ts[1], ts[2], ts[3]}, @@ -2002,7 +2002,7 @@ public class TestFromClientSide { // the switch to using Scan for Get this is no longer the case. get = new Get(ROW); get.addFamily(FAMILIES[0]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long [] {ts[1], ts[2], ts[3]}, @@ -2047,7 +2047,7 @@ public class TestFromClientSide { get = new Get(ROWS[2]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 4 key but received " + result.size() + ": " + result, result.size() == 4); @@ -2069,7 +2069,7 @@ public class TestFromClientSide { get = new Get(ROWS[0]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 2 keys but received " + result.size(), result.size() == 2); @@ -2093,7 +2093,7 @@ public class TestFromClientSide { get = new Get(ROWS[1]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 2 keys but received " + result.size(), result.size() == 2); @@ -2109,7 +2109,7 @@ public class TestFromClientSide { get = new Get(ROWS[2]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertEquals(1, result.size()); assertNResult(result, ROWS[2], FAMILIES[2], QUALIFIER, @@ -2146,7 +2146,7 @@ public class TestFromClientSide { get = new Get(ROWS[3]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 1 key but received " + result.size(), result.size() == 1); @@ -2154,7 +2154,7 @@ public class TestFromClientSide { get = new Get(ROWS[4]); get.addFamily(FAMILIES[1]); get.addFamily(FAMILIES[2]); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertTrue("Expected 2 keys but received " + result.size(), result.size() == 2); @@ -2688,7 +2688,7 @@ public class TestFromClientSide { throws IOException { Get get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); get.setTimeRange(stamps[start+1], Long.MAX_VALUE); Result result = ht.get(get); assertNResult(result, row, family, qualifier, stamps, values, start+1, end); @@ -2699,7 +2699,7 @@ public class TestFromClientSide { throws IOException { Get get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); get.setTimeRange(stamps[start], stamps[end]+1); Result result = ht.get(get); assertNResult(result, row, family, qualifier, stamps, values, start, end); @@ -2710,7 +2710,7 @@ public class TestFromClientSide { throws IOException { Get get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); assertNResult(result, row, family, qualifier, stamps, values, start, end); } @@ -2754,7 +2754,7 @@ public class TestFromClientSide { Get get = new Get(row); get.addColumn(family, qualifier); get.setTimestamp(stamp); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); assertSingleResult(result, row, family, qualifier, stamp, value); } @@ -2765,7 +2765,7 @@ public class TestFromClientSide { Get get = new Get(row); get.addColumn(family, qualifier); get.setTimestamp(stamp); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); assertEmptyResult(result); } @@ -3557,7 +3557,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(2); + get.readVersions(2); Result result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[4], STAMPS[5]}, @@ -3598,7 +3598,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(2); + get.readVersions(2); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[4], STAMPS[5]}, @@ -3629,7 +3629,7 @@ public class TestFromClientSide { // Ensure maxVersions in query is respected get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(7); + get.readVersions(7); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8]}, @@ -3646,7 +3646,7 @@ public class TestFromClientSide { 0, 6); get = new Get(ROW); - get.setMaxVersions(7); + get.readVersions(7); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8]}, @@ -3691,7 +3691,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8], STAMPS[9], STAMPS[11], STAMPS[13], STAMPS[15]}, @@ -3716,7 +3716,7 @@ public class TestFromClientSide { // Test that it's gone get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); assertNResult(result, ROW, FAMILY, QUALIFIER, new long [] {STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[8], STAMPS[9], STAMPS[13], STAMPS[15]}, @@ -3755,7 +3755,7 @@ public class TestFromClientSide { Get get = new Get(row); get.addColumn(FAMILY, qualifier); - get.setMaxVersions(); + get.readAllVersions(); // Check that the column indeed has the right values at timestamps 1 and // 2 @@ -3805,7 +3805,7 @@ public class TestFromClientSide { Get get = new Get(row); get.addColumn(FAMILY, qualifier); - get.setMaxVersions(); + get.readAllVersions(); // Check that the column indeed has the right values at timestamps 1 and // 2 @@ -3865,7 +3865,7 @@ public class TestFromClientSide { Get get = new Get(row); get.addColumn(FAMILY, qualifier); - get.setMaxVersions(); + get.readAllVersions(); // Check that the column indeed has the right values at timestamps 1 and // 2 @@ -4687,7 +4687,7 @@ public class TestFromClientSide { final long ts = EnvironmentEdgeManager.currentTime(); Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(); + get.readAllVersions(); for (int versions = 1; versions <= numVersions; versions++) { Put put = new Put(ROW); @@ -4723,7 +4723,7 @@ public class TestFromClientSide { final long ts = EnvironmentEdgeManager.currentTime(); final Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(); + get.readAllVersions(); for (int versions = 1; versions <= numVersions; versions++) { Put put = new Put(ROW); @@ -6449,7 +6449,7 @@ public class TestFromClientSide { Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); // verify version 1000,2000,4000 remains for column FAMILY:QUALIFIER assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[0], ts[1], ts[3] }, new byte[][] { @@ -6462,7 +6462,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); // verify version 1000,2000,4000 remains for column FAMILY:QUALIFIER assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[0], ts[1], ts[3] }, new byte[][] { @@ -6496,7 +6496,7 @@ public class TestFromClientSide { Get get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); Result result = ht.get(get); // verify version 1000,2000,3000 remains for column FAMILY:QUALIFIER assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[0], ts[1], ts[2] }, new byte[][] { @@ -6510,7 +6510,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); // verify version 1000 remains for column FAMILY:QUALIFIER assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[0] }, new byte[][] { VALUES[0] }, @@ -6523,7 +6523,7 @@ public class TestFromClientSide { get = new Get(ROW); get.addColumn(FAMILY, QUALIFIER); - get.setMaxVersions(Integer.MAX_VALUE); + get.readVersions(Integer.MAX_VALUE); result = ht.get(get); // verify version 1000,5000 remains for column FAMILY:QUALIFIER assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[0], ts[4] }, new byte[][] { @@ -6569,7 +6569,7 @@ public class TestFromClientSide { Get get = new Get(ROW) .setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a"))) - .setMaxVersions(3); + .readVersions(3); result = table.get(get); // ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3 assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[1] }, new byte[][] { VALUEA }, 0, @@ -6589,7 +6589,7 @@ public class TestFromClientSide { get = new Get(ROW) .setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a"))) - .setMaxVersions(1); + .readVersions(1); result = table.get(get); // ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3 assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[1] }, new byte[][] { VALUEA }, 0, @@ -6609,7 +6609,7 @@ public class TestFromClientSide { get = new Get(ROW) .setFilter(new ValueFilter(CompareOperator.EQUAL, new SubstringComparator("value-a"))) - .setMaxVersions(5); + .readVersions(5); result = table.get(get); // ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3 assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { ts[1] }, new byte[][] { VALUEA }, 0, diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java index d862685faa6..97188abe556 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java @@ -440,7 +440,7 @@ public class TestMultipleTimestamps { byte column[] = Bytes.toBytes("column:" + colIdx); Get get = new Get(row); get.addColumn(cf, column); - get.setMaxVersions(); + get.readAllVersions(); get.setTimeRange(Collections.min(versions), Collections.max(versions)+1); Result result = ht.get(get); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java index d6a066698f3..ff8e8c34b2a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java @@ -207,7 +207,7 @@ public class TestTimestampsFilter { Get g = new Get(Bytes.toBytes("row")); g.setFilter(filter); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(FAMILY, Bytes.toBytes("column2")); g.addColumn(FAMILY, Bytes.toBytes("column4")); @@ -338,7 +338,7 @@ public class TestTimestampsFilter { Get get = new Get(row); get.addColumn(cf, column); get.setFilter(filter); - get.setMaxVersions(); + get.readAllVersions(); Result result = ht.get(get); return result.rawCells(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java index a2664ce6bda..a646b32d453 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestHRegion.java @@ -2632,7 +2632,7 @@ public class TestHRegion { region.put(put); Get get = new Get(row1); - get.setMaxVersions(); + get.readAllVersions(); Result res = region.get(get); // Get 3 versions, the oldest version has gone from user view assertEquals(maxVersions, res.size()); @@ -3976,7 +3976,7 @@ public class TestHRegion { // Get rows Get get = new Get(row); - get.setMaxVersions(); + get.readAllVersions(); Cell[] kvs = region.get(get).rawCells(); // Check if rows are correct @@ -4259,7 +4259,7 @@ public class TestHRegion { Get get = new Get(Incrementer.incRow); get.addColumn(Incrementer.family, Incrementer.qualifier); - get.setMaxVersions(1); + get.readVersions(1); Result res = this.region.get(get); List kvs = res.getColumnCells(Incrementer.family, Incrementer.qualifier); @@ -4349,7 +4349,7 @@ public class TestHRegion { Get get = new Get(Appender.appendRow); get.addColumn(Appender.family, Appender.qualifier); - get.setMaxVersions(1); + get.readVersions(1); Result res = this.region.get(get); List kvs = res.getColumnCells(Appender.family, Appender.qualifier); @@ -4383,7 +4383,7 @@ public class TestHRegion { region.put(put); get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(); + get.readAllVersions(); res = this.region.get(get); kvs = res.getColumnCells(family, qualifier); assertEquals(1, kvs.size()); @@ -4392,7 +4392,7 @@ public class TestHRegion { region.flush(true); get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(); + get.readAllVersions(); res = this.region.get(get); kvs = res.getColumnCells(family, qualifier); assertEquals(1, kvs.size()); @@ -4404,7 +4404,7 @@ public class TestHRegion { region.put(put); get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(); + get.readAllVersions(); res = this.region.get(get); kvs = res.getColumnCells(family, qualifier); assertEquals(1, kvs.size()); @@ -4413,7 +4413,7 @@ public class TestHRegion { region.flush(true); get = new Get(row); get.addColumn(family, qualifier); - get.setMaxVersions(); + get.readAllVersions(); res = this.region.get(get); kvs = res.getColumnCells(family, qualifier); assertEquals(1, kvs.size()); @@ -4734,7 +4734,7 @@ public class TestHRegion { static void assertGet(final HRegion r, final byte[] family, final byte[] k) throws IOException { // Now I have k, get values out and assert they are as expected. - Get get = new Get(k).addFamily(family).setMaxVersions(); + Get get = new Get(k).addFamily(family).readAllVersions(); Cell[] results = r.get(get).rawCells(); for (int j = 0; j < results.length; j++) { byte[] tmp = CellUtil.cloneValue(results[j]); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java index 12a53124f73..6683d845a12 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestKeepDeletes.java @@ -132,7 +132,7 @@ public class TestKeepDeletes { // get something *before* the delete marker Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.setTimeRange(0L, ts+2); Result r = region.get(g); checkResult(r, c0, c0, T2,T1); @@ -256,7 +256,7 @@ public class TestKeepDeletes { region.put(p); Get gOne = new Get(T1); - gOne.setMaxVersions(); + gOne.readAllVersions(); gOne.setTimeRange(0L, ts + 1); Result rOne = region.get(gOne); assertFalse(rOne.isEmpty()); @@ -268,7 +268,7 @@ public class TestKeepDeletes { // "past" get does not see rows behind delete marker Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.setTimeRange(0L, ts+1); Result r = region.get(g); assertTrue(r.isEmpty()); @@ -854,7 +854,7 @@ public class TestKeepDeletes { region.delete(d); Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.setTimeRange(0L, ts-2); Result r = region.get(g); checkResult(r, c0, c0, T1,T0); @@ -946,7 +946,7 @@ public class TestKeepDeletes { long time, byte[]... vals) throws IOException { Get g = new Get(row); g.addColumn(fam, col); - g.setMaxVersions(); + g.readAllVersions(); g.setTimeRange(0L, time); Result r = region.get(g); checkResult(r, fam, col, vals); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java index 13ad7f89e07..0a33c58c763 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinVersions.java @@ -157,12 +157,12 @@ public class TestMinVersions { // and the 3rd, 4th oldest also in the memstore Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); Result r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T3,T2,T1); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T3,T2,T1); @@ -200,12 +200,12 @@ public class TestMinVersions { region.delete(d); Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); Result r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T3); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T3); @@ -216,12 +216,12 @@ public class TestMinVersions { // try again g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T3); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T3); @@ -274,12 +274,12 @@ public class TestMinVersions { checkResult(r, c0, T4); Get g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T4,T3); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T4,T3); @@ -291,12 +291,12 @@ public class TestMinVersions { // now the latest version is in the memstore g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T5,T4); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T5,T4); @@ -355,12 +355,12 @@ public class TestMinVersions { // gets see only available versions // even before compactions g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); // this'll use ScanWildcardColumnTracker checkResult(r, c0, T4,T3); g = new Get(T1); - g.setMaxVersions(); + g.readAllVersions(); g.addColumn(c0, c0); r = region.get(g); // this'll use ExplicitColumnTracker checkResult(r, c0, T4,T3); @@ -440,7 +440,7 @@ public class TestMinVersions { Get g = new Get(T1); g.addColumn(c1,c1); g.setFilter(new TimestampsFilter(tss)); - g.setMaxVersions(); + g.readAllVersions(); Result r = region.get(g); checkResult(r, c1, T2); @@ -448,7 +448,7 @@ public class TestMinVersions { g = new Get(T1); g.addColumn(c0,c0); g.setFilter(new TimestampsFilter(tss)); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); checkResult(r, c0, T2); @@ -460,7 +460,7 @@ public class TestMinVersions { g = new Get(T1); g.addColumn(c1,c1); g.setFilter(new TimestampsFilter(tss)); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); checkResult(r, c1, T2); @@ -468,7 +468,7 @@ public class TestMinVersions { g = new Get(T1); g.addColumn(c0,c0); g.setFilter(new TimestampsFilter(tss)); - g.setMaxVersions(); + g.readAllVersions(); r = region.get(g); checkResult(r, c0, T2); } finally { diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinorCompaction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinorCompaction.java index e53ed363e5d..7b531484a6f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinorCompaction.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestMinorCompaction.java @@ -181,9 +181,9 @@ public class TestMinorCompaction { r.flush(true); } - Result result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).setMaxVersions(100)); + Result result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).readVersions(100)); assertEquals(compactionThreshold, result.size()); - result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).setMaxVersions(100)); + result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).readVersions(100)); assertEquals(compactionThreshold, result.size()); // Now add deletes to memstore and then flush it. That will put us over @@ -193,10 +193,10 @@ public class TestMinorCompaction { r.delete(delete); // Make sure that we have only deleted family2 from secondRowBytes - result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).setMaxVersions(100)); + result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).readVersions(100)); assertEquals(expectedResultsAfterDelete, result.size()); // but we still have firstrow - result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).setMaxVersions(100)); + result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).readVersions(100)); assertEquals(compactionThreshold, result.size()); r.flush(true); @@ -204,10 +204,10 @@ public class TestMinorCompaction { // Let us check again // Make sure that we have only deleted family2 from secondRowBytes - result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).setMaxVersions(100)); + result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).readVersions(100)); assertEquals(expectedResultsAfterDelete, result.size()); // but we still have firstrow - result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).setMaxVersions(100)); + result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).readVersions(100)); assertEquals(compactionThreshold, result.size()); // do a compaction @@ -222,10 +222,10 @@ public class TestMinorCompaction { assertTrue("Was not supposed to be a major compaction", numFiles2 > 1); // Make sure that we have only deleted family2 from secondRowBytes - result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).setMaxVersions(100)); + result = r.get(new Get(secondRowBytes).addColumn(fam2, col2).readVersions(100)); assertEquals(expectedResultsAfterDelete, result.size()); // but we still have firstrow - result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).setMaxVersions(100)); + result = r.get(new Get(firstRowBytes).addColumn(fam1, col1).readVersions(100)); assertEquals(compactionThreshold, result.size()); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestNewVersionBehaviorFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestNewVersionBehaviorFromClientSide.java index 897fc3c00d5..d0bc3737366 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestNewVersionBehaviorFromClientSide.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestNewVersionBehaviorFromClientSide.java @@ -96,7 +96,7 @@ public class TestNewVersionBehaviorFromClientSide { t.delete(new Delete(ROW).addColumns(FAMILY, col1, 2000000)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1000000, value)); TEST_UTIL.getAdmin().flush(t.getName()); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(1, r.size()); assertEquals(1000000, r.rawCells()[0].getTimestamp()); } @@ -112,12 +112,12 @@ public class TestNewVersionBehaviorFromClientSide { t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000003)); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(2, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000002, r.rawCells()[1].getTimestamp()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(2, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000002, r.rawCells()[1].getTimestamp()); @@ -133,13 +133,13 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col1, 1000003, value)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1000004, value)); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000003, r.rawCells()[1].getTimestamp()); assertEquals(1000002, r.rawCells()[2].getTimestamp()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000003, r.rawCells()[1].getTimestamp()); @@ -158,11 +158,11 @@ public class TestNewVersionBehaviorFromClientSide { t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000004)); t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000003)); - Result r = t.get(new Get(ROW).setMaxVersions(1)); + Result r = t.get(new Get(ROW).readVersions(1)); assertEquals(1, r.size()); assertEquals(1000002, r.rawCells()[0].getTimestamp()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(1)); + r = t.get(new Get(ROW).readVersions(1)); assertEquals(1, r.size()); assertEquals(1000002, r.rawCells()[0].getTimestamp()); } @@ -178,13 +178,13 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col1, 1000003, value)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1000004, value)); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000003, r.rawCells()[1].getTimestamp()); assertEquals(1000002, r.rawCells()[2].getTimestamp()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000003, r.rawCells()[1].getTimestamp()); @@ -206,13 +206,13 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col1, 1000004, value)); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000002, r.rawCells()[1].getTimestamp()); assertEquals(1000001, r.rawCells()[2].getTimestamp()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(3, r.size()); assertEquals(1000004, r.rawCells()[0].getTimestamp()); assertEquals(1000002, r.rawCells()[1].getTimestamp()); @@ -236,7 +236,7 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col1, 1500001, value)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1500002, value)); TEST_UTIL.getAdmin().flush(t.getName()); - Result r = t.get(new Get(ROW).setMaxVersions(3)); + Result r = t.get(new Get(ROW).readVersions(3)); assertEquals(4, r.size()); assertEquals(1500002, r.rawCells()[0].getTimestamp()); assertEquals(1500001, r.rawCells()[1].getTimestamp()); @@ -245,7 +245,7 @@ public class TestNewVersionBehaviorFromClientSide { t.delete(new Delete(ROW).addFamilyVersion(FAMILY, 1500001)); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(2, r.size()); assertEquals(1500002, r.rawCells()[0].getTimestamp()); assertEquals(1500002, r.rawCells()[1].getTimestamp()); @@ -255,7 +255,7 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col2, 1000002, value)); t.put(new Put(ROW).addColumn(FAMILY, col3, 1000001, value)); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3)); + r = t.get(new Get(ROW).readVersions(3)); assertEquals(6, r.size()); assertEquals(1500002, r.rawCells()[0].getTimestamp()); assertEquals(1000002, r.rawCells()[1].getTimestamp()); @@ -277,10 +277,10 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col1, 1000006, value)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1000007, value)); t.put(new Put(ROW).addColumn(FAMILY, col1, 1000008, value)); - Result r = t.get(new Get(ROW).setMaxVersions(3).setTimeRange(0, 1000005)); + Result r = t.get(new Get(ROW).readVersions(3).setTimeRange(0, 1000005)); assertEquals(0, r.size()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3).setTimeRange(0, 1000005)); + r = t.get(new Get(ROW).readVersions(3).setTimeRange(0, 1000005)); assertEquals(0, r.size()); } } @@ -300,10 +300,10 @@ public class TestNewVersionBehaviorFromClientSide { t.put(new Put(ROW).addColumn(FAMILY, col3, value)); t.put(new Put(ROW).addColumn(FAMILY, col3, value)); t.put(new Put(ROW).addColumn(FAMILY, col3, value)); - Result r = t.get(new Get(ROW).setMaxVersions(3).addColumn(FAMILY, col2)); + Result r = t.get(new Get(ROW).readVersions(3).addColumn(FAMILY, col2)); assertEquals(3, r.size()); TEST_UTIL.getAdmin().flush(t.getName()); - r = t.get(new Get(ROW).setMaxVersions(3).addColumn(FAMILY, col2)); + r = t.get(new Get(ROW).readVersions(3).addColumn(FAMILY, col2)); assertEquals(3, r.size()); TEST_UTIL.getAdmin().flush(t.getName()); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java index b4dd8c63b4c..85021970edb 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java @@ -193,7 +193,7 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil { @Override public Object run() throws Exception { Get get = new Get(TEST_ROW); - get.setMaxVersions(10); + get.readVersions(10); try(Connection connection = ConnectionFactory.createConnection(conf); Table t = connection.getTable(TEST_TABLE.getTableName())) { return t.get(get).listCells(); @@ -205,7 +205,7 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil { @Override public Object run() throws Exception { Get get = new Get(TEST_ROW); - get.setMaxVersions(10); + get.readVersions(10); try(Connection connection = ConnectionFactory.createConnection(conf); Table t = connection.getTable(TEST_TABLE.getTableName())) { return t.get(get).listCells(); diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java index 34bf5e8705b..d4ac01643ee 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift/ThriftHBaseServiceHandler.java @@ -355,7 +355,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb } else { get.addColumn(family, qualifier); } - get.setMaxVersions(numVersions); + get.readVersions(numVersions); Result result = table.get(get); return ThriftUtilities.cellFromHBase(result.rawCells()); } catch (IOException e) { @@ -402,7 +402,7 @@ public class ThriftHBaseServiceHandler extends HBaseServiceHandler implements Hb get.addColumn(family, qualifier); } get.setTimeRange(0, timestamp); - get.setMaxVersions(numVersions); + get.readVersions(numVersions); Result result = table.get(get); return ThriftUtilities.cellFromHBase(result.rawCells()); } catch (IOException e) { diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java index 2c0250e19e9..7d1fd8441d4 100644 --- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java +++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java @@ -143,7 +143,7 @@ public final class ThriftUtilities { } if (in.isSetMaxVersions()) { - out.setMaxVersions(in.getMaxVersions()); + out.readVersions(in.getMaxVersions()); } if (in.isSetFilterString()) { diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftConnection.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftConnection.java index a11f2e88fd1..d947a86beff 100644 --- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftConnection.java +++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftConnection.java @@ -298,7 +298,7 @@ public class TestThriftConnection { get = new Get(ROW_2); get.addFamily(FAMILYA); - get.setMaxVersions(2); + get.readVersions(2); result = table.get(get); int count = 0; for (Cell kv: result.listCells()) { @@ -357,10 +357,10 @@ public class TestThriftConnection { //Test Versions gets = new ArrayList<>(2); Get g = new Get(ROW_1); - g.setMaxVersions(3); + g.readVersions(3); gets.add(g); Get get2 = new Get(ROW_2); - get2.setMaxVersions(3); + get2.readVersions(3); gets.add(get2); results = table.get(gets); assertNotNull(results);