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.
This commit is contained in:
parent
56f9db98d1
commit
94346d8623
|
@ -863,7 +863,7 @@ public class TestScannersFromClientSide {
|
||||||
Result result;
|
Result result;
|
||||||
int expectedKvNumber = 6;
|
int expectedKvNumber = 6;
|
||||||
int returnedKvNumber = 0;
|
int returnedKvNumber = 0;
|
||||||
while((result = rs.next()) != null){
|
while((result = rs.next()) != null) {
|
||||||
returnedKvNumber += result.listCells().size();
|
returnedKvNumber += result.listCells().size();
|
||||||
}
|
}
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -873,24 +873,24 @@ public class TestScannersFromClientSide {
|
||||||
|
|
||||||
public static class LimitKVsReturnFilter extends FilterBase {
|
public static class LimitKVsReturnFilter extends FilterBase {
|
||||||
|
|
||||||
private static int total = 0;
|
private int cellCount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ReturnCode filterCell(Cell v) throws IOException {
|
public ReturnCode filterCell(Cell v) throws IOException {
|
||||||
if(total>=6) {
|
if (cellCount >= 6) {
|
||||||
total++;
|
cellCount++;
|
||||||
return ReturnCode.SKIP;
|
return ReturnCode.SKIP;
|
||||||
}
|
}
|
||||||
total++;
|
cellCount++;
|
||||||
return ReturnCode.INCLUDE;
|
return ReturnCode.INCLUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean filterAllRemaining() throws IOException {
|
public boolean filterAllRemaining() throws IOException {
|
||||||
if(total<7) {
|
if (cellCount < 7) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
total++;
|
cellCount++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,9 +900,8 @@ public class TestScannersFromClientSide {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LimitKVsReturnFilter parseFrom(final byte [] pbBytes)
|
public static LimitKVsReturnFilter parseFrom(final byte [] pbBytes)
|
||||||
throws DeserializationException {
|
throws DeserializationException {
|
||||||
return new LimitKVsReturnFilter();
|
return new LimitKVsReturnFilter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue