HBASE-23846 Removed deprecated setMaxVersions(int) from Scan

Signed-off-by: Duo Zhang <zhangduo@apache.org>
Signed-off-by: Viraj Jasani <vjasani@apache.org>
This commit is contained in:
Jan Hentschel 2020-03-31 10:18:27 +02:00 committed by GitHub
parent 3d4124c92a
commit fded2b9ddc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 96 additions and 110 deletions

View File

@ -1189,7 +1189,7 @@ public final class BackupSystemTable implements Closeable {
List<String> list = new ArrayList<>();
try (Table table = connection.getTable(tableName)) {
Scan scan = createScanForBackupSetList();
scan.setMaxVersions(1);
scan.readVersions(1);
try (ResultScanner scanner = table.getScanner(scan)) {
Result res;
while ((res = scanner.next()) != null) {
@ -1504,7 +1504,7 @@ public final class BackupSystemTable implements Closeable {
scan.withStartRow(startRow);
scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.SESSIONS_FAMILY);
scan.setMaxVersions(1);
scan.readVersions(1);
return scan;
}
@ -1585,7 +1585,7 @@ public final class BackupSystemTable implements Closeable {
scan.withStartRow(startRow);
scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY);
scan.setMaxVersions(1);
scan.readVersions(1);
return scan;
}
@ -1859,7 +1859,7 @@ public final class BackupSystemTable implements Closeable {
scan.withStartRow(startRow);
scan.withStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY);
scan.setMaxVersions(1);
scan.readVersions(1);
return scan;
}
@ -1894,7 +1894,7 @@ public final class BackupSystemTable implements Closeable {
scan.withStartRow(startRow);
scan.setStopRow(stopRow);
scan.addFamily(BackupSystemTable.META_FAMILY);
scan.setMaxVersions(1);
scan.readVersions(1);
return scan;
}

View File

@ -59,7 +59,7 @@ import org.slf4j.LoggerFactory;
* To only retrieve columns with a specific timestamp, call {@link #setTimestamp(long) setTimestamp}
* .
* <p>
* To limit the number of versions of each column to be returned, call {@link #setMaxVersions(int)}.
* To limit the number of versions of each column to be returned, call {@link #readVersions(int)}.
* <p>
* To limit the maximum number of values returned for each call to next(), call
* {@link #setBatch(int) setBatch}.
@ -341,7 +341,7 @@ public class Scan extends Query {
* @param minStamp minimum timestamp value, inclusive
* @param maxStamp maximum timestamp value, exclusive
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @see #readVersions(int)
* @return this
*/
public Scan setTimeRange(long minStamp, long maxStamp) throws IOException {
@ -356,7 +356,7 @@ public class Scan extends Query {
* defaut.
* @param timestamp version timestamp
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @see #readVersions(int)
* @return this
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
* Use {@link #setTimestamp(long)} instead
@ -374,7 +374,7 @@ public class Scan extends Query {
* defaut.
* @param timestamp version timestamp
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @see #readVersions(int)
* @return this
*/
public Scan setTimestamp(long timestamp) {
@ -516,20 +516,6 @@ public class Scan extends Query {
return this;
}
/**
* Get up to the specified number of versions of each column.
* @param maxVersions maximum versions for each column
* @return this
* @deprecated since 2.0.0 and will be removed in 3.0.0. It is easy to misunderstand with column
* family's max versions, so use {@link #readVersions(int)} instead.
* @see #readVersions(int)
* @see <a href="https://issues.apache.org/jira/browse/HBASE-17125">HBASE-17125</a>
*/
@Deprecated
public Scan setMaxVersions(int maxVersions) {
return readVersions(maxVersions);
}
/**
* Get all available versions.
* @return this

View File

@ -1190,7 +1190,7 @@ public final class ProtobufUtil {
scan.setCacheBlocks(proto.getCacheBlocks());
}
if (proto.hasMaxVersions()) {
scan.setMaxVersions(proto.getMaxVersions());
scan.readVersions(proto.getMaxVersions());
}
if (proto.hasStoreLimit()) {
scan.setMaxResultsPerColumnFamily(proto.getStoreLimit());

View File

@ -705,7 +705,7 @@ public class IntegrationTestBulkLoad extends IntegrationTestBase {
Scan scan = new Scan();
scan.addFamily(CHAIN_FAM);
scan.addFamily(SORT_FAM);
scan.setMaxVersions(1);
scan.readVersions(1);
scan.setCacheBlocks(false);
scan.setBatch(1000);

View File

@ -542,7 +542,7 @@ public class IntegrationTestMTTR {
s.setBatch(2);
s.addFamily(FAMILY);
s.setFilter(new KeyOnlyFilter());
s.setMaxVersions(1);
s.readVersions(1);
rs = table.getScanner(s);
Result result = rs.next();

View File

@ -234,7 +234,7 @@ public class CellCounter extends Configured implements Tool {
// Set Scan Versions
if (conf.get(TableInputFormat.SCAN_MAXVERSIONS) == null) {
// default to all versions unless explicitly set
s.setMaxVersions(Integer.MAX_VALUE);
s.readVersions(Integer.MAX_VALUE);
}
s.setCacheBlocks(false);
// Set RowFilter or Prefix Filter if applicable.

View File

@ -112,7 +112,7 @@ public final class ExportUtils {
// Optional arguments.
// Set Scan Versions
int versions = args.length > 2? Integer.parseInt(args[2]): 1;
s.setMaxVersions(versions);
s.readVersions(versions);
// Set Scan Range
long startTime = args.length > 3? Long.parseLong(args[3]): 0L;
long endTime = args.length > 4? Long.parseLong(args[4]): Long.MAX_VALUE;

View File

@ -192,7 +192,7 @@ public class HashTable extends Configured implements Tool {
scan.setBatch(scanBatch);
}
if (versions >= 0) {
scan.setMaxVersions(versions);
scan.readVersions(versions);
}
if (!isTableStartRow(startRow)) {
scan.withStartRow(startRow);

View File

@ -174,7 +174,7 @@ implements Configurable {
}
if (conf.get(SCAN_MAXVERSIONS) != null) {
scan.setMaxVersions(Integer.parseInt(conf.get(SCAN_MAXVERSIONS)));
scan.readVersions(Integer.parseInt(conf.get(SCAN_MAXVERSIONS)));
}
if (conf.get(SCAN_CACHEDROWS) != null) {

View File

@ -182,7 +182,7 @@ public class VerifyReplication extends Configured implements Tool {
int versions = conf.getInt(NAME+".versions", -1);
LOG.info("Setting number of version inside map as: " + versions);
if (versions >= 0) {
scan.setMaxVersions(versions);
scan.readVersions(versions);
}
TableName tableName = TableName.valueOf(conf.get(NAME + ".tableName"));
sourceConnection = ConnectionFactory.createConnection(conf);
@ -459,7 +459,7 @@ public class VerifyReplication extends Configured implements Tool {
scan.setBatch(batch);
}
if (versions >= 0) {
scan.setMaxVersions(versions);
scan.readVersions(versions);
LOG.info("Number of versions set to " + versions);
}
if(families != null) {

View File

@ -459,7 +459,7 @@ public class MobRefReporter extends Configured implements Tool {
// a full table scan and don't want to impact other clients badly.
scan.setCaching(conf.getInt(HConstants.HBASE_CLIENT_SCANNER_CACHING, 10000));
scan.setCacheBlocks(false);
scan.setMaxVersions(maxVersions);
scan.readVersions(maxVersions);
conf.set(REPORT_JOB_ID, id);
job = Job.getInstance(conf);

View File

@ -134,7 +134,7 @@ public class ScanPerformanceEvaluation extends AbstractHBaseTool {
private Scan getScan() {
Scan scan = new Scan(); // default scan settings
scan.setCacheBlocks(false);
scan.setMaxVersions(1);
scan.readVersions(1);
scan.setScanMetricsEnabled(true);
if (caching != null) {
scan.setCaching(Integer.parseInt(caching));

View File

@ -200,7 +200,7 @@ public class TestTimeRangeMapRed {
private void verify(final Table table) throws IOException {
Scan scan = new Scan();
scan.addColumn(FAMILY_NAME, COLUMN_NAME);
scan.setMaxVersions(1);
scan.readVersions(1);
ResultScanner scanner = table.getScanner(scan);
for (Result r: scanner) {
for (Cell kv : r.listCells()) {

View File

@ -91,7 +91,7 @@ public class ScannerResultGenerator extends ResultGenerator {
}
}
scan.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
scan.setMaxVersions(rowspec.getMaxVersions());
scan.readVersions(rowspec.getMaxVersions());
if (filter != null) {
scan.setFilter(filter);
}

View File

@ -151,7 +151,7 @@ public class TableResource extends ResourceBase {
}
Table hTable = RESTServlet.getInstance().getTable(this.table);
tableScan.setBatch(batchSize);
tableScan.setMaxVersions(maxVersions);
tableScan.readVersions(maxVersions);
tableScan.setTimeRange(startTime, endTime);
if (!startRow.isEmpty()) {
tableScan.withStartRow(Bytes.toBytes(startRow));

View File

@ -349,7 +349,7 @@ public class TestSerialization {
Scan scan = new Scan(startRow, stopRow);
scan.addColumn(fam, qf1);
scan.setTimeRange(ts, ts+1);
scan.setMaxVersions(maxVersions);
scan.readVersions(maxVersions);
ClientProtos.Scan scanProto = ProtobufUtil.toScan(scan);
Scan desScan = ProtobufUtil.toScan(scanProto);

View File

@ -586,7 +586,7 @@ class FromClientSideBase {
int start, int end) throws IOException {
Scan scan = new Scan(row);
scan.addColumn(family, qualifier);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
scan.setTimeRange(stamps[start+1], Long.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
assertNResult(result, row, family, qualifier, stamps, values, start+1, end);
@ -596,7 +596,7 @@ class FromClientSideBase {
byte [] qualifier, long [] stamps, byte [][] values, int start, int end) throws IOException {
Scan scan = new Scan(row);
scan.addColumn(family, qualifier);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
scan.setTimeRange(stamps[start], stamps[end]+1);
Result result = getSingleScanResult(ht, scan);
assertNResult(result, row, family, qualifier, stamps, values, start, end);
@ -606,7 +606,7 @@ class FromClientSideBase {
byte [] qualifier, long [] stamps, byte [][] values, int start, int end) throws IOException {
Scan scan = new Scan(row);
scan.addColumn(family, qualifier);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
assertNResult(result, row, family, qualifier, stamps, values, start, end);
}
@ -636,7 +636,7 @@ class FromClientSideBase {
Scan scan = new Scan(row);
scan.addColumn(family, qualifier);
scan.setTimestamp(stamp);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
assertSingleResult(result, row, family, qualifier, stamp, value);
}
@ -646,7 +646,7 @@ class FromClientSideBase {
Scan scan = new Scan(row);
scan.addColumn(family, qualifier);
scan.setTimestamp(stamp);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
assertNullResult(result);
}

View File

@ -1127,7 +1127,7 @@ public class TestFromClientSide extends FromClientSideBase {
Scan scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(2);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
@ -1164,7 +1164,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(2);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
@ -1258,7 +1258,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8], STAMPS[9],
@ -1285,7 +1285,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[8],
@ -1341,14 +1341,14 @@ public class TestFromClientSide extends FromClientSideBase {
Scan scan = new Scan(ROW);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { STAMPS[1] },
new byte[][] { VALUES[1] }, 0, 0);
scan = new Scan(ROW);
scan.addFamily(FAMILIES[0]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { STAMPS[1] },
new byte[][] { VALUES[1] }, 0, 0);
@ -1373,7 +1373,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILIES[1], QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[1], QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3] },
@ -1381,7 +1381,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addFamily(FAMILIES[1]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[1], QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3] },
@ -1407,7 +1407,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILIES[2], QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[2], QUALIFIER,
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6] },
@ -1415,7 +1415,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[2], QUALIFIER,
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6] },
@ -1445,12 +1445,12 @@ public class TestFromClientSide extends FromClientSideBase {
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
scan.addFamily(FAMILIES[0]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
@ -1458,7 +1458,7 @@ public class TestFromClientSide extends FromClientSideBase {
assertEquals("Expected 9 keys but received " + result.size(), 9, result.size());
scan = new Scan(ROW);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.addColumn(FAMILIES[1], QUALIFIER);
scan.addColumn(FAMILIES[2], QUALIFIER);
@ -1667,7 +1667,7 @@ public class TestFromClientSide extends FromClientSideBase {
Scan scan = new Scan(ROW);
scan.addFamily(FAMILIES[0]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { ts[1] },
new byte[][] { VALUES[1] }, 0, 0);
@ -1695,7 +1695,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { ts[1], ts[2], ts[3] },
new byte[][] { VALUES[1], VALUES[2], VALUES[3] }, 0, 2);
@ -1732,7 +1732,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addFamily(FAMILIES[0]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[] { ts[1], ts[2], ts[3] },
new byte[][] { VALUES[1], VALUES[2], VALUES[3] }, 0, 2);
@ -1795,7 +1795,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROWS[0]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
assertNResult(result, ROWS[0], FAMILIES[1], QUALIFIER, new long[] { ts[0], ts[1] },
@ -1811,7 +1811,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROWS[1]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
@ -1827,7 +1827,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROWS[2]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals(1, result.size());
assertNResult(result, ROWS[2], FAMILIES[2], QUALIFIER, new long[] { ts[2] },
@ -1865,7 +1865,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROWS[3]);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
ResultScanner scanner = ht.getScanner(scan);
result = scanner.next();
assertEquals("Expected 1 key but received " + result.size(), 1, result.size());

View File

@ -561,7 +561,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
Scan scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(2);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
@ -598,7 +598,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(2);
scan.readVersions(2);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER, new long[] { STAMPS[4], STAMPS[5] },
new byte[][] { VALUES[4], VALUES[5] }, 0, 1);
@ -626,7 +626,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(7);
scan.readVersions(7);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8] },
@ -642,7 +642,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
VALUES[8] }, 0, 6);
scan = new Scan(ROW);
scan.setMaxVersions(7);
scan.readVersions(7);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8] },
@ -689,7 +689,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7], STAMPS[8], STAMPS[9],
@ -716,7 +716,7 @@ public class TestFromClientSide4 extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[8],

View File

@ -1465,7 +1465,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
// then if we decrease the number of versions, but keep the scan raw, we should see exactly
// that number of versions
versions = 2;
s.setMaxVersions(versions);
s.readVersions(versions);
try (ResultScanner scanner = table.getScanner(s)) {
int count = 0;
for (Result r : scanner) {
@ -1480,7 +1480,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
// finally, if we turn off raw scanning, but max out the number of versions, we should go back
// to seeing just three
versions = 3;
s.setMaxVersions(versions);
s.readVersions(versions);
try (ResultScanner scanner = table.getScanner(s)) {
int count = 0;
for (Result r : scanner) {
@ -1830,7 +1830,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
Scan scan = new Scan(ROW);
scan.setReversed(true);
scan.addFamily(FAMILIES[0]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
Result result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[]{ts[1]},
new byte[][]{VALUES[1]}, 0, 0);
@ -1852,7 +1852,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(ROW);
scan.setReversed(true);
scan.addColumn(FAMILIES[0], QUALIFIER);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[]{ts[1],
ts[2], ts[3]}, new byte[][]{VALUES[1], VALUES[2], VALUES[3]}, 0, 2);
@ -1881,7 +1881,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan = new Scan(ROW);
scan.setReversed(true);
scan.addFamily(FAMILIES[0]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILIES[0], QUALIFIER, new long[]{ts[1],
ts[2], ts[3]}, new byte[][]{VALUES[1], VALUES[2], VALUES[3]}, 0, 2);
@ -1928,7 +1928,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
assertNResult(result, ROWS[0], FAMILIES[1], QUALIFIER, new long[]{ts[0],
@ -1938,7 +1938,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
@ -1946,7 +1946,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
result = getSingleScanResult(ht, scan);
assertEquals(1, result.size());
assertNResult(result, ROWS[2], FAMILIES[2], QUALIFIER,
@ -1971,7 +1971,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan.setReversed(true);
scan.addFamily(FAMILIES[1]);
scan.addFamily(FAMILIES[2]);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
ResultScanner scanner = ht.getScanner(scan);
result = scanner.next();
assertEquals("Expected 2 keys but received " + result.size(), 2, result.size());
@ -2399,7 +2399,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
Scan scan =
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL,
new SubstringComparator("value-a")))
.setMaxVersions(3);
.readVersions(3);
ResultScanner scanner = table.getScanner(scan);
Result result = scanner.next();
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
@ -2420,7 +2420,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan =
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL,
new SubstringComparator("value-a")))
.setMaxVersions(1);
.readVersions(1);
scanner = table.getScanner(scan);
result = scanner.next();
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3
@ -2442,7 +2442,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
scan =
new Scan().setFilter(new ValueFilter(CompareOperator.EQUAL,
new SubstringComparator("value-a")))
.setMaxVersions(5);
.readVersions(5);
scanner = table.getScanner(scan);
result = scanner.next();
// ts[0] has gone from user view. Only read ts[2] which value is less or equal to 3

View File

@ -195,7 +195,7 @@ public class TestMultipleTimestamps {
TEST_UTIL.flush(tableName);
Scan scan = new Scan();
scan.setMaxVersions(10);
scan.readVersions(10);
ResultScanner scanner = ht.getScanner(scan);
while (true) {
Result r = scanner.next();
@ -460,7 +460,7 @@ public class TestMultipleTimestamps {
byte column[] = Bytes.toBytes("column:" + colIdx);
scan.addColumn(cf, column);
}
scan.setMaxVersions(maxVersions);
scan.readVersions(maxVersions);
scan.setTimeRange(Collections.min(Arrays.asList(versions)),
Collections.max(Arrays.asList(versions))+1);
ResultScanner scanner = ht.getScanner(scan);

View File

@ -203,7 +203,7 @@ public class TestOpenTableInCoprocessor {
*/
private int getKeyValueCount(Table table) throws IOException {
Scan scan = new Scan();
scan.setMaxVersions(Integer.MAX_VALUE - 1);
scan.readVersions(Integer.MAX_VALUE - 1);
ResultScanner results = table.getScanner(scan);
int count = 0;

View File

@ -187,7 +187,7 @@ public class TestDependentColumnFilter {
Scan scan = new Scan();
scan.setFilter(filter);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
verifyScan(scan, 2, 8);
@ -195,7 +195,7 @@ public class TestDependentColumnFilter {
filter = new DependentColumnFilter(FAMILIES[0], QUALIFIER, true);
scan = new Scan();
scan.setFilter(filter);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
verifyScan(scan, 2, 3);
@ -204,7 +204,7 @@ public class TestDependentColumnFilter {
CompareOperator.EQUAL, new BinaryComparator(MATCH_VAL));
scan = new Scan();
scan.setFilter(filter);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
/*
* expecting to get the following 3 cells
@ -221,7 +221,7 @@ public class TestDependentColumnFilter {
CompareOperator.EQUAL, new BinaryComparator(MATCH_VAL));
scan = new Scan();
scan.setFilter(filter);
scan.setMaxVersions(Integer.MAX_VALUE);
scan.readVersions(Integer.MAX_VALUE);
/*
* expecting to get the following 1 cell

View File

@ -122,7 +122,7 @@ public class TestDefaultMobStoreFlusher {
//Scan
Scan scan = new Scan();
scan.addColumn(family, qf1);
scan.setMaxVersions(4);
scan.readVersions(4);
ResultScanner scanner = table.getScanner(scan);
//Compare

View File

@ -120,7 +120,7 @@ public class TestMobDataBlockEncoding {
admin.flush(TableName.valueOf(TN));
Scan scan = new Scan();
scan.setMaxVersions(4);
scan.readVersions(4);
MobTestUtil.assertCellsValue(table, scan, value, 3);
}
}

View File

@ -131,7 +131,7 @@ public class TestMobStoreScanner {
*/
public void setScan(Scan scan, boolean reversed, boolean mobScanRaw) {
scan.setReversed(reversed);
scan.setMaxVersions(4);
scan.readVersions(4);
if(mobScanRaw) {
scan.setAttribute(MobConstants.MOB_SCAN_RAW, Bytes.toBytes(Boolean.TRUE));
}

View File

@ -122,7 +122,7 @@ public class TestBlocksScanned {
Scan scan = new Scan().withStartRow(Bytes.toBytes("aaa")).withStopRow(Bytes.toBytes("aaz"))
.setReadType(Scan.ReadType.PREAD);
scan.addColumn(FAMILY, COL);
scan.setMaxVersions(1);
scan.readVersions(1);
InternalScanner s = r.getScanner(scan);
List<Cell> results = new ArrayList<>();

View File

@ -612,7 +612,7 @@ public class TestHRegion {
region.flush(true);
Scan scan = new Scan();
scan.setMaxVersions(3);
scan.readVersions(3);
// open the first scanner
RegionScanner scanner1 = region.getScanner(scan);
@ -663,7 +663,7 @@ public class TestHRegion {
region.flush(true);
Scan scan = new Scan();
scan.setMaxVersions(3);
scan.readVersions(3);
// open the first scanner
RegionScanner scanner1 = region.getScanner(scan);
@ -3142,7 +3142,7 @@ public class TestHRegion {
Scan scan = new Scan(row1);
scan.addColumn(fam1, qf1);
scan.setMaxVersions(MAX_VERSIONS);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -3199,7 +3199,7 @@ public class TestHRegion {
Scan scan = new Scan(row1);
scan.addColumn(fam1, qf1);
scan.addColumn(fam1, qf2);
scan.setMaxVersions(MAX_VERSIONS);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -3276,7 +3276,7 @@ public class TestHRegion {
scan.addColumn(fam1, qf1);
scan.addColumn(fam1, qf2);
int versions = 3;
scan.setMaxVersions(versions);
scan.readVersions(versions);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -3331,7 +3331,7 @@ public class TestHRegion {
Scan scan = new Scan(row1);
scan.addFamily(fam1);
scan.setMaxVersions(MAX_VERSIONS);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -3386,7 +3386,7 @@ public class TestHRegion {
Scan scan = new Scan(row1);
scan.addFamily(fam1);
scan.setMaxVersions(MAX_VERSIONS);
scan.readVersions(MAX_VERSIONS);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -3502,7 +3502,7 @@ public class TestHRegion {
Scan scan = new Scan(row1);
int versions = 3;
scan.setMaxVersions(versions);
scan.readVersions(versions);
List<Cell> actual = new ArrayList<>();
InternalScanner scanner = region.getScanner(scan);
@ -5218,7 +5218,7 @@ public class TestHRegion {
region.put(put);
Scan scan = new Scan(rowC);
scan.setMaxVersions(5);
scan.readVersions(5);
scan.setReversed(true);
InternalScanner scanner = region.getScanner(scan);
List<Cell> currRow = new ArrayList<>();
@ -5274,7 +5274,7 @@ public class TestHRegion {
Scan scan = new Scan(rowD);
List<Cell> currRow = new ArrayList<>();
scan.setReversed(true);
scan.setMaxVersions(5);
scan.readVersions(5);
InternalScanner scanner = region.getScanner(scan);
boolean hasNext = scanner.next(currRow);
assertEquals(2, currRow.size());
@ -5604,7 +5604,7 @@ public class TestHRegion {
region.put(put);
// scan range = ["row4", min), skip the max "row5"
Scan scan = new Scan(row4);
scan.setMaxVersions(5);
scan.readVersions(5);
scan.setBatch(3);
scan.setReversed(true);
InternalScanner scanner = region.getScanner(scan);

View File

@ -956,7 +956,7 @@ public class TestKeepDeletes {
Scan s = new Scan();
s.setRaw(true);
// use max versions from the store(s)
s.setMaxVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
s.readVersions(region.getStores().iterator().next().getScanInfo().getMaxVersions());
InternalScanner scan = region.getScanner(s);
List<Cell> kvs = new ArrayList<>();
int res = 0;

View File

@ -311,7 +311,7 @@ public class TestScannerWithBulkload {
private Scan createScan() {
Scan scan = new Scan();
scan.setMaxVersions(3);
scan.readVersions(3);
return scan;
}

View File

@ -214,7 +214,7 @@ public class TestSeekOptimizations {
scan.addColumn(FAMILY_BYTES, Bytes.toBytes(qualStr));
qualSet.add(qualStr);
}
scan.setMaxVersions(maxVersions);
scan.readVersions(maxVersions);
scan.withStartRow(rowBytes(startRow));
// Adjust for the fact that for multi-row queries the end row is exclusive.

View File

@ -105,7 +105,7 @@ public class TestWideScanner extends HBaseTestCase {
scan.addFamily(A);
scan.addFamily(B);
scan.addFamily(C);
scan.setMaxVersions(100);
scan.readVersions(100);
scan.setBatch(batch);
InternalScanner s = r.getScanner(scan);
int total = 0;

View File

@ -750,7 +750,7 @@ public abstract class TestVisibilityLabels {
table.put(put);
Scan s = new Scan();
s.setMaxVersions(1);
s.readVersions(1);
s.setAuthorizations(new Authorizations(SECRET));
ResultScanner scanner = table.getScanner(s);
Result result = scanner.next();

View File

@ -530,7 +530,7 @@ public final class ThriftUtilities {
out.setCaching(in.getCaching());
}
if (in.isSetMaxVersions()) {
out.setMaxVersions(in.getMaxVersions());
out.readVersions(in.getMaxVersions());
}
if (in.isSetColumns()) {

View File

@ -740,7 +740,7 @@ public class TestThriftConnection {
filterList.addFilter(prefixFilter);
filterList.addFilter(columnValueFilter);
Scan scan = new Scan();
scan.setMaxVersions(2);
scan.readVersions(2);
scan.setFilter(filterList);
ResultScanner scanner = table.getScanner(scan);
Iterator<Result> iterator = scanner.iterator();