You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2019/12/26 19:18:02 UTC

[hbase] branch branch-2.2 updated: HBASE-23238: Remove 'static'ness of cell counter in LimitKVsReturnFilter (addendum) (#963)

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

stack 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 0f331be  HBASE-23238: Remove 'static'ness of cell counter in LimitKVsReturnFilter (addendum) (#963)
0f331be is described below

commit 0f331bebbd07d51cec73576d5bf828e689a58fbe
Author: Bharath Vissapragada <bh...@apache.org>
AuthorDate: Thu Dec 26 11:10:39 2019 -0800

    HBASE-23238: Remove 'static'ness of cell counter in LimitKVsReturnFilter (addendum) (#963)
    
    Having it as static means the test cannot be parameterized (ran into
    this issue in HBASE-23305). That happens because the field is not
    reset between parameterized runs.
---
 .../hadoop/hbase/client/TestScannersFromClientSide.java | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
index 579db5c..ad73f89 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
@@ -1010,7 +1010,7 @@ public class TestScannersFromClientSide {
       Result result;
       int expectedKvNumber = 6;
       int returnedKvNumber = 0;
-      while((result = rs.next()) != null){
+      while((result = rs.next()) != null) {
         returnedKvNumber += result.listCells().size();
       }
       rs.close();
@@ -1020,24 +1020,24 @@ public class TestScannersFromClientSide {
 
   public static class LimitKVsReturnFilter extends FilterBase {
 
-    private static int total = 0;
+    private int cellCount = 0;
 
     @Override
     public ReturnCode filterCell(Cell v) throws IOException {
-      if(total>=6) {
-        total++;
+      if (cellCount >= 6) {
+        cellCount++;
         return ReturnCode.SKIP;
       }
-      total++;
+      cellCount++;
       return ReturnCode.INCLUDE;
     }
 
     @Override
     public boolean filterAllRemaining() throws IOException {
-      if(total<7) {
+      if (cellCount < 7) {
         return false;
       }
-      total++;
+      cellCount++;
       return true;
     }
 
@@ -1047,9 +1047,8 @@ public class TestScannersFromClientSide {
     }
 
     public static LimitKVsReturnFilter parseFrom(final byte [] pbBytes)
-      throws DeserializationException {
+        throws DeserializationException {
       return new LimitKVsReturnFilter();
     }
   }
-
 }