Skip to content

Commit

Permalink
HBASE-22277 Removed deprecated methods from Get
Browse files Browse the repository at this point in the history
  • Loading branch information
HorizonNet committed Apr 30, 2019
1 parent 70296a2 commit 2c7fdb3
Show file tree
Hide file tree
Showing 26 changed files with 144 additions and 200 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1405,7 +1405,7 @@ private Put createPutForBackupInfo(BackupInfo context) throws IOException {
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;
}

Expand Down Expand Up @@ -1440,7 +1440,7 @@ private BackupInfo resultToBackupInfo(Result res) throws IOException {
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;
}

Expand All @@ -1463,7 +1463,7 @@ private Put createPutForStartCode(String startCode, String rootPath) {
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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* {@link #setTimestamp(long) setTimestamp}.
* <p>
* To limit the number of versions of each column to be returned, execute
* {@link #setMaxVersions(int) setMaxVersions}.
* {@link #readVersions(int) readVersions}.
* <p>
* To add a filter, call {@link #setFilter(Filter) setFilter}.
*/
Expand Down Expand Up @@ -160,26 +160,6 @@ public Get setCheckExistenceOnly(boolean checkExistenceOnly) {
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.
* <p>
Expand Down Expand Up @@ -227,18 +207,6 @@ public Get setTimeRange(long minStamp, long maxStamp) throws IOException {
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
Expand All @@ -260,30 +228,6 @@ public Get setTimestamp(long timestamp) {
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public static Get toGet(final ClientProtos.Get proto) throws IOException {
get.setCacheBlocks(proto.getCacheBlocks());
}
if (proto.hasMaxVersions()) {
get.setMaxVersions(proto.getMaxVersions());
get.readVersions(proto.getMaxVersions());
}
if (proto.hasStoreLimit()) {
get.setMaxResultsPerColumnFamily(proto.getStoreLimit());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ public static Get toGet(final ClientProtos.Get proto) throws IOException {
get.setCacheBlocks(proto.getCacheBlocks());
}
if (proto.hasMaxVersions()) {
get.setMaxVersions(proto.getMaxVersions());
get.readVersions(proto.getMaxVersions());
}
if (proto.hasStoreLimit()) {
get.setMaxResultsPerColumnFamily(proto.getStoreLimit());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void TestGetRowFromGetCopyConstructor() throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testGetToScan() throws Exception {
.setIsolationLevel(IsolationLevel.READ_COMMITTED)
.setLoadColumnFamiliesOnDemand(false)
.setMaxResultsPerColumnFamily(1000)
.setMaxVersions(9999)
.readVersions(9999)
.setRowOffsetPerColumnFamily(5)
.setTimeRange(0, 13)
.setAttribute("att_v0", Bytes.toBytes("att_v0"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,11 @@ public void testSimpleCase() throws Throwable {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public RowResultGenerator(final String tableName, final RowSpec rowspec,
}
}
get.setTimeRange(rowspec.getStartTime(), rowspec.getEndTime());
get.setMaxVersions(rowspec.getMaxVersions());
get.readVersions(rowspec.getMaxVersions());
if (filter != null) {
get.setFilter(filter);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public void testGet() throws IOException {

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()) {
Expand Down Expand Up @@ -279,7 +279,7 @@ public void testMultiGet() throws Exception {
//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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3087,7 +3087,7 @@ public void prepareDeleteTimestamps(Mutation mutation, Map<byte[], List<Cell>> f
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ private boolean checkCoveringPermission(User user, OpType request, RegionCoproce
// 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<byte[], ? extends Collection<?>> entry: familyMap.entrySet()) {
Expand Down Expand Up @@ -527,7 +527,7 @@ private boolean checkCoveringPermission(User user, OpType request, RegionCoproce
// 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void testGetRowVersions() throws Exception {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ private HRegionInfo createRandomRegion(final String name) {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ private static void assertOnlyLatest(final Table incommon, final long currentTim
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]));
Expand Down Expand Up @@ -138,7 +138,7 @@ public static void assertVersions(final Table incommon, final long [] tss)
// 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);
Expand All @@ -154,7 +154,7 @@ public static void assertVersions(final Table incommon, final long [] tss)
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);
Expand Down
Loading

0 comments on commit 2c7fdb3

Please sign in to comment.