You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by an...@apache.org on 2021/03/08 08:35:02 UTC

[hbase] branch branch-2.2 updated: HBASE-25644 Scan#setSmall blindly sets ReadType as PREAD

This is an automated email from the ASF dual-hosted git repository.

anoopsamjohn pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 09a82b6  HBASE-25644 Scan#setSmall blindly sets ReadType as PREAD
09a82b6 is described below

commit 09a82b6bfa22fd8fa8d7bb3788d4b0bfbf8d423a
Author: Anoop Sam John <an...@gmail.com>
AuthorDate: Mon Mar 8 12:44:07 2021 +0530

    HBASE-25644 Scan#setSmall blindly sets ReadType as PREAD
    
    Signed-off-by: zhangduo <zh...@apache.org>
    Signed-off-by: Ramkrishna <ra...@apache.org>
---
 .../src/main/java/org/apache/hadoop/hbase/client/Scan.java   |  4 +++-
 .../test/java/org/apache/hadoop/hbase/client/TestScan.java   | 12 ++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
index f8488de..36b408f 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/Scan.java
@@ -1021,7 +1021,9 @@ public class Scan extends Query {
   @Deprecated
   public Scan setSmall(boolean small) {
     this.small = small;
-    this.readType = ReadType.PREAD;
+    if (small) {
+      this.readType = ReadType.PREAD;
+    }
     return this;
   }
 
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
index d0715cf..c653f7b 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/client/TestScan.java
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hbase.client;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -292,4 +293,15 @@ public class TestScan {
     assertTrue("Make sure copy constructor adds all the fields in the copied object",
       EqualsBuilder.reflectionEquals(scan, scanCopy));
   }
+
+  @Test
+  public void testScanReadType() throws Exception {
+    Scan scan = new Scan();
+    assertFalse(scan.isSmall());
+    assertEquals(ReadType.DEFAULT, scan.getReadType());
+    Scan copyScan = new Scan(scan);
+    copyScan.setSmall(scan.isSmall());
+    assertFalse(copyScan.isSmall());
+    assertEquals(ReadType.DEFAULT, copyScan.getReadType());
+  }
 }