HBASE-13779 Calling table.exists() before table.get() end up with an empty Result (addendum)
This commit is contained in:
parent
e0cf811b33
commit
749dda6aca
|
@ -99,7 +99,11 @@ public class Get extends Query
|
|||
*/
|
||||
public Get(Get get) {
|
||||
this(get.getRow());
|
||||
this.filter = get.getFilter();
|
||||
// from Query
|
||||
this.setFilter(get.getFilter());
|
||||
this.setReplicaId(get.getReplicaId());
|
||||
this.setConsistency(get.getConsistency());
|
||||
// from Get
|
||||
this.cacheBlocks = get.getCacheBlocks();
|
||||
this.maxVersions = get.getMaxVersions();
|
||||
this.storeLimit = get.getMaxResultsPerColumnFamily();
|
||||
|
|
|
@ -684,7 +684,7 @@ public class HTable implements HTableInterface {
|
|||
*/
|
||||
@Override
|
||||
public Result get(final Get get) throws IOException {
|
||||
return get(get, false);
|
||||
return get(get, get.isCheckExistenceOnly());
|
||||
}
|
||||
|
||||
private Result get(Get get, final boolean checkExistenceOnly) throws IOException {
|
||||
|
|
|
@ -40,6 +40,8 @@ import org.apache.hadoop.hbase.filter.FilterList;
|
|||
import org.apache.hadoop.hbase.filter.KeyOnlyFilter;
|
||||
import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
|
||||
import org.apache.hadoop.hbase.protobuf.generated.ClientProtos;
|
||||
import org.apache.hadoop.hbase.security.access.Permission;
|
||||
import org.apache.hadoop.hbase.security.visibility.Authorizations;
|
||||
import org.apache.hadoop.hbase.testclassification.ClientTests;
|
||||
import org.apache.hadoop.hbase.testclassification.SmallTests;
|
||||
import org.apache.hadoop.hbase.util.Base64;
|
||||
|
@ -155,12 +157,48 @@ public class TestGet {
|
|||
Set<byte[]> qualifiers = get.getFamilyMap().get(family);
|
||||
Assert.assertEquals(1, qualifiers.size());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void TestGetRowFromGetCopyConstructor() throws Exception {
|
||||
Get get = new Get(ROW);
|
||||
get.setFilter(null);
|
||||
get.setAuthorizations(new Authorizations("foo"));
|
||||
get.setACL("u", new Permission(Permission.Action.READ));
|
||||
get.setConsistency(Consistency.TIMELINE);
|
||||
get.setReplicaId(2);
|
||||
get.setIsolationLevel(IsolationLevel.READ_UNCOMMITTED);
|
||||
get.setCheckExistenceOnly(true);
|
||||
get.setClosestRowBefore(true);
|
||||
get.setTimeRange(3, 4);
|
||||
get.setMaxVersions(11);
|
||||
get.setMaxResultsPerColumnFamily(10);
|
||||
get.setRowOffsetPerColumnFamily(11);
|
||||
get.setCacheBlocks(true);
|
||||
|
||||
Get copyGet = new Get(get);
|
||||
assertEquals(0, Bytes.compareTo(get.getRow(), copyGet.getRow()));
|
||||
|
||||
// from OperationWithAttributes
|
||||
assertEquals(get.getId(), copyGet.getId());
|
||||
|
||||
// from Query class
|
||||
assertEquals(get.getFilter(), copyGet.getFilter());
|
||||
assertTrue(get.getAuthorizations().toString().equals(copyGet.getAuthorizations().toString()));
|
||||
assertTrue(Bytes.equals(get.getACL(), copyGet.getACL()));
|
||||
assertEquals(get.getConsistency(), copyGet.getConsistency());
|
||||
assertEquals(get.getReplicaId(), copyGet.getReplicaId());
|
||||
assertEquals(get.getIsolationLevel(), copyGet.getIsolationLevel());
|
||||
|
||||
// from Get class
|
||||
assertEquals(get.isCheckExistenceOnly(), copyGet.isCheckExistenceOnly());
|
||||
assertEquals(get.isClosestRowBefore(), copyGet.isClosestRowBefore());
|
||||
assertTrue(get.getTimeRange().equals(copyGet.getTimeRange()));
|
||||
assertEquals(get.isClosestRowBefore(), copyGet.isClosestRowBefore());
|
||||
assertEquals(get.getMaxVersions(), copyGet.getMaxVersions());
|
||||
assertEquals(get.getMaxResultsPerColumnFamily(), copyGet.getMaxResultsPerColumnFamily());
|
||||
assertEquals(get.getRowOffsetPerColumnFamily(), copyGet.getRowOffsetPerColumnFamily());
|
||||
assertEquals(get.getCacheBlocks(), copyGet.getCacheBlocks());
|
||||
assertEquals(get.getId(), copyGet.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue