Skip to content

Commit 3ff21ec

Browse files
bharathvGuanghao Zhang
authored andcommitted
HBASE-23238: Remove 'static'ness of cell counter in LimitKVsReturnFilter (addendum) (apache#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.
1 parent f657191 commit 3ff21ec

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ public void testScannerWithPartialResults() throws Exception {
10111011
Result result;
10121012
int expectedKvNumber = 6;
10131013
int returnedKvNumber = 0;
1014-
while((result = rs.next()) != null){
1014+
while((result = rs.next()) != null) {
10151015
returnedKvNumber += result.listCells().size();
10161016
}
10171017
rs.close();
@@ -1021,24 +1021,24 @@ public void testScannerWithPartialResults() throws Exception {
10211021

10221022
public static class LimitKVsReturnFilter extends FilterBase {
10231023

1024-
private static int total = 0;
1024+
private int cellCount = 0;
10251025

10261026
@Override
10271027
public ReturnCode filterCell(Cell v) throws IOException {
1028-
if(total>=6) {
1029-
total++;
1028+
if (cellCount >= 6) {
1029+
cellCount++;
10301030
return ReturnCode.SKIP;
10311031
}
1032-
total++;
1032+
cellCount++;
10331033
return ReturnCode.INCLUDE;
10341034
}
10351035

10361036
@Override
10371037
public boolean filterAllRemaining() throws IOException {
1038-
if(total<7) {
1038+
if (cellCount < 7) {
10391039
return false;
10401040
}
1041-
total++;
1041+
cellCount++;
10421042
return true;
10431043
}
10441044

@@ -1048,9 +1048,8 @@ public String toString() {
10481048
}
10491049

10501050
public static LimitKVsReturnFilter parseFrom(final byte [] pbBytes)
1051-
throws DeserializationException {
1051+
throws DeserializationException {
10521052
return new LimitKVsReturnFilter();
10531053
}
10541054
}
1055-
10561055
}

0 commit comments

Comments
 (0)