hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mberto...@apache.org
Subject [5/5] hbase git commit: HBASE-13779 Calling table.exists() before table.get() end up with an empty Result (addendum)
Date Sat, 30 May 2015 00:42:34 GMT
HBASE-13779 Calling table.exists() before table.get() end up with an empty Result (addendum)


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/adbc3dd0
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/adbc3dd0
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/adbc3dd0

Branch: refs/heads/branch-1
Commit: adbc3dd0971336c3e7947215c2ba16600da2788f
Parents: 518a291
Author: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Authored: Fri May 29 17:21:20 2015 -0700
Committer: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
Committed: Fri May 29 17:42:11 2015 -0700

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/client/Get.java     |  6 ++-
 .../org/apache/hadoop/hbase/client/HTable.java  |  2 +-
 .../org/apache/hadoop/hbase/client/TestGet.java | 40 +++++++++++++++++++-
 3 files changed, 45 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/adbc3dd0/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Get.java
----------------------------------------------------------------------
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 32e3114..6ba25db 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
@@ -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();

http://git-wip-us.apache.org/repos/asf/hbase/blob/adbc3dd0/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
index c59be3c..ec675b4 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HTable.java
@@ -842,7 +842,7 @@ public class HTable implements HTableInterface, RegionLocator {
    */
   @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 {

http://git-wip-us.apache.org/repos/asf/hbase/blob/adbc3dd0/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestGet.java
----------------------------------------------------------------------
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 1f8ad49..fdb07d0 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
@@ -41,6 +41,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.util.Base64;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.junit.Assert;
@@ -154,12 +156,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


Mime
View raw message