HBASE-23845 Removed deprecated setMaxVersions from Scan (#1208)

Signed-off-by: Duo Zhang <zhangduo@apache.org>
This commit is contained in:
Jan Hentschel 2020-03-29 11:46:49 +02:00 committed by GitHub
parent 3f2489467f
commit aaae46c976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 39 additions and 53 deletions

View File

@ -59,8 +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)
* setMaxVersions}.
* To limit the number of versions of each column to be returned, call {@link #setMaxVersions(int)}.
* <p>
* To limit the maximum number of values returned for each call to next(), call
* {@link #setBatch(int) setBatch}.
@ -341,7 +340,7 @@ public class Scan extends Query {
* returned, up the number of versions beyond the default.
* @param minStamp minimum timestamp value, inclusive
* @param maxStamp maximum timestamp value, exclusive
* @see #setMaxVersions()
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @return this
*/
@ -356,7 +355,7 @@ public class Scan extends Query {
* and you want all versions returned, up the number of versions beyond the
* defaut.
* @param timestamp version timestamp
* @see #setMaxVersions()
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @return this
* @deprecated As of release 2.0.0, this will be removed in HBase 3.0.0.
@ -374,7 +373,7 @@ public class Scan extends Query {
* and you want all versions returned, up the number of versions beyond the
* defaut.
* @param timestamp version timestamp
* @see #setMaxVersions()
* @see #readAllVersions()
* @see #setMaxVersions(int)
* @return this
*/
@ -517,19 +516,6 @@ public class Scan extends Query {
return this;
}
/**
* Get all available versions.
* @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 #readAllVersions()} instead.
* @see #readAllVersions()
* @see <a href="https://issues.apache.org/jira/browse/HBASE-17125">HBASE-17125</a>
*/
@Deprecated
public Scan setMaxVersions() {
return readAllVersions();
}
/**
* Get up to the specified number of versions of each column.
* @param maxVersions maximum versions for each column

View File

@ -374,7 +374,7 @@ public class TestImportExport {
assertTrue(runImport(args));
Scan s = new Scan();
s.setMaxVersions();
s.readAllVersions();
s.setRaw(true);
ResultScanner scanner = t.getScanner(s);
Result r = scanner.next();
@ -448,7 +448,7 @@ public class TestImportExport {
assertTrue(runImport(args));
Scan s = new Scan();
s.setMaxVersions();
s.readAllVersions();
s.setRaw(true);
ResultScanner importedTScanner = importT.getScanner(s);

View File

@ -182,7 +182,7 @@ public class TestTimeRangeMapRed {
Scan scan = new Scan();
scan.addColumn(FAMILY_NAME, COLUMN_NAME);
scan.setTimeRange(MINSTAMP, MAXSTAMP);
scan.setMaxVersions();
scan.readAllVersions();
TableMapReduceUtil.initTableMapperJob(TABLE_NAME,
scan, ProcessTimeRangeMapper.class, Text.class, Text.class, job);
job.waitForCompletion(true);

View File

@ -148,7 +148,7 @@ public class TestPartialResultsFromClientSide {
public void testExpectedValuesOfPartialResults(boolean reversed) throws Exception {
Scan partialScan = new Scan();
partialScan.setMaxVersions();
partialScan.readAllVersions();
// Max result size of 1 ensures that each RPC request will return a single cell. The scanner
// will need to reconstruct the results into a complete result before returning to the caller
partialScan.setMaxResultSize(1);

View File

@ -192,7 +192,7 @@ public class TestFromClientSide extends FromClientSideBase {
Scan s = new Scan(T1);
s.setTimeRange(0, ts + 3);
s.setMaxVersions();
s.readAllVersions();
ResultScanner scanner = h.getScanner(s);
Cell[] kvs = scanner.next().rawCells();
assertArrayEquals(T2, CellUtil.cloneValue(kvs[0]));
@ -201,7 +201,7 @@ public class TestFromClientSide extends FromClientSideBase {
s = new Scan(T1);
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
scanner = h.getScanner(s);
kvs = scanner.next().rawCells();
assertTrue(PrivateCellUtil.isDeleteFamily(kvs[0]));
@ -1192,7 +1192,7 @@ public class TestFromClientSide extends FromClientSideBase {
scan = new Scan(ROW);
scan.addColumn(FAMILY, QUALIFIER);
scan.setMaxVersions();
scan.readAllVersions();
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7],
@ -1210,7 +1210,7 @@ public class TestFromClientSide extends FromClientSideBase {
VALUES[8] }, 0, 7);
scan = new Scan(ROW);
scan.setMaxVersions();
scan.readAllVersions();
result = getSingleScanResult(ht, scan);
assertNResult(result, ROW, FAMILY, QUALIFIER,
new long[] { STAMPS[1], STAMPS[2], STAMPS[3], STAMPS[4], STAMPS[5], STAMPS[6], STAMPS[7],

View File

@ -1448,7 +1448,7 @@ public class TestFromClientSide5 extends FromClientSideBase {
int versions = 4;
Scan s = new Scan(row);
// get all the possible versions
s.setMaxVersions();
s.readAllVersions();
s.setRaw(true);
try (ResultScanner scanner = table.getScanner(s)) {

View File

@ -199,7 +199,7 @@ public class TestScannersFromClientSide {
// without batch
scan = new Scan().withStartRow(ROW);
scan.setMaxVersions();
scan.readAllVersions();
scanner = ht.getScanner(scan);
// c4:4, c5:5, c6:6, c7:7
@ -213,7 +213,7 @@ public class TestScannersFromClientSide {
// with batch
scan = new Scan().withStartRow(ROW);
scan.setMaxVersions();
scan.readAllVersions();
scan.setBatch(2);
scanner = ht.getScanner(scan);

View File

@ -356,7 +356,7 @@ public class TestTimestampsFilter {
Filter filter = new TimestampsFilter(versions);
Scan scan = new Scan(startRow, endRow);
scan.setFilter(filter);
scan.setMaxVersions();
scan.readAllVersions();
ResultScanner scanner = ht.getScanner(scan);
return scanner.next(endRowIdx - startRowIdx + 1);
}

View File

@ -114,7 +114,7 @@ public class TestColumnPrefixFilter {
ColumnPrefixFilter filter;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
for (String s: prefixMap.keySet()) {
filter = new ColumnPrefixFilter(Bytes.toBytes(s));
@ -183,7 +183,7 @@ public class TestColumnPrefixFilter {
ColumnPrefixFilter filter;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
for (String s: prefixMap.keySet()) {
filter = new ColumnPrefixFilter(Bytes.toBytes(s));

View File

@ -226,7 +226,7 @@ public class TestColumnRangeFilter {
ColumnRangeFilter filter;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
for (StringRange s : rangeMap.keySet()) {
filter = new ColumnRangeFilter(s.getStart() == null ? null : Bytes.toBytes(s.getStart()),
s.isStartInclusive(), s.getEnd() == null ? null : Bytes.toBytes(s.getEnd()),

View File

@ -104,7 +104,7 @@ public class TestFilterListOrOperatorWithBlkCnt {
generateRows(numRows, ht, family, qf, value);
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
long blocksStart = getBlkAccessCount();
List<RowRange> ranges1 = new ArrayList<>();
@ -154,7 +154,7 @@ public class TestFilterListOrOperatorWithBlkCnt {
private List<Cell> getScanResult(byte[] startRow, byte[] stopRow, Table ht) throws IOException {
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
if(!Bytes.toString(startRow).isEmpty()) {
scan.withStartRow(startRow);
}

View File

@ -116,7 +116,7 @@ public class TestMultipleColumnPrefixFilter {
MultipleColumnPrefixFilter filter;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
byte [][] filter_prefix = new byte [2][];
filter_prefix[0] = new byte [] {'p'};
filter_prefix[1] = new byte [] {'q'};
@ -194,7 +194,7 @@ public class TestMultipleColumnPrefixFilter {
MultipleColumnPrefixFilter filter;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
byte [][] filter_prefix = new byte [2][];
filter_prefix[0] = new byte [] {'p'};
filter_prefix[1] = new byte [] {'q'};
@ -244,7 +244,7 @@ public class TestMultipleColumnPrefixFilter {
MultipleColumnPrefixFilter multiplePrefixFilter;
Scan scan1 = new Scan();
scan1.setMaxVersions();
scan1.readAllVersions();
byte [][] filter_prefix = new byte [1][];
filter_prefix[0] = new byte [] {'p'};
@ -257,7 +257,7 @@ public class TestMultipleColumnPrefixFilter {
ColumnPrefixFilter singlePrefixFilter;
Scan scan2 = new Scan();
scan2.setMaxVersions();
scan2.readAllVersions();
singlePrefixFilter = new ColumnPrefixFilter(Bytes.toBytes("p"));
scan2.setFilter(singlePrefixFilter);

View File

@ -149,7 +149,7 @@ public class TestColumnSeeking {
for (int i = 0; i < numberOfTests + 1; i++) {
Collection<KeyValue> kvSet;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
if (i < numberOfTests) {
if (columnLists[i].isEmpty()) continue; // HBASE-7700
kvSet = kvMaps[i].values();
@ -264,7 +264,7 @@ public class TestColumnSeeking {
for (int i = 0; i < numberOfTests + 1; i++) {
Collection<KeyValue> kvSet;
Scan scan = new Scan();
scan.setMaxVersions();
scan.readAllVersions();
if (i < numberOfTests) {
if (columnLists[i].isEmpty()) continue; // HBASE-7700
kvSet = kvMaps[i].values();

View File

@ -3432,7 +3432,7 @@ public class TestHRegion {
region.put(put);
Scan scan = new Scan(row3, row4);
scan.setMaxVersions();
scan.readAllVersions();
scan.addColumn(family, col1);
InternalScanner s = region.getScanner(scan);

View File

@ -217,7 +217,7 @@ public class TestKeepDeletes {
// scan still returns delete markers and deletes rows
Scan s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
InternalScanner scan = region.getScanner(s);
List<Cell> kvs = new ArrayList<>();
scan.next(kvs);
@ -231,7 +231,7 @@ public class TestKeepDeletes {
// KEEP_DELETED_CELLS)
s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
scan = region.getScanner(s);
kvs = new ArrayList<>();
scan.next(kvs);
@ -275,7 +275,7 @@ public class TestKeepDeletes {
// "past" scan does not see rows behind delete marker
Scan s = new Scan();
s.setMaxVersions();
s.readAllVersions();
s.setTimeRange(0L, ts+1);
InternalScanner scanner = region.getScanner(s);
List<Cell> kvs = new ArrayList<>();
@ -306,7 +306,7 @@ public class TestKeepDeletes {
Scan s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
s.addColumn(c0, c0);
try {
@ -352,7 +352,7 @@ public class TestKeepDeletes {
Scan s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
InternalScanner scan = region.getScanner(s);
List<Cell> kvs = new ArrayList<>();
scan.next(kvs);
@ -370,7 +370,7 @@ public class TestKeepDeletes {
// verify that raw scans honor the passed timerange
s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
s.setTimeRange(0, 1);
scan = region.getScanner(s);
kvs = new ArrayList<>();
@ -381,7 +381,7 @@ public class TestKeepDeletes {
// filter new delete markers
s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
s.setTimeRange(0, ts+2);
scan = region.getScanner(s);
kvs = new ArrayList<>();
@ -396,7 +396,7 @@ public class TestKeepDeletes {
// filter old delete markers
s = new Scan();
s.setRaw(true);
s.setMaxVersions();
s.readAllVersions();
s.setTimeRange(ts+3, ts+5);
scan = region.getScanner(s);
kvs = new ArrayList<>();

View File

@ -339,20 +339,20 @@ public class TestNewVersionBehaviorFromClientSide {
t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000004));
t.delete(new Delete(ROW).addColumn(FAMILY, col1, 1000003));
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).setMaxVersions())) {
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).readAllVersions())) {
Result r = scannner.next();
assertNull(scannner.next());
assertEquals(6, r.size());
}
TEST_UTIL.getAdmin().flush(t.getName());
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).setMaxVersions())) {
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).readAllVersions())) {
Result r = scannner.next();
assertNull(scannner.next());
assertEquals(6, r.size());
}
TEST_UTIL.getAdmin().majorCompact(t.getName());
Threads.sleep(5000);
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).setMaxVersions())) {
try (ResultScanner scannner = t.getScanner(new Scan().setRaw(true).readAllVersions())) {
Result r = scannner.next();
assertNull(scannner.next());
assertEquals(1, r.size());