Skip to content

Commit

Permalink
Address review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
apurtell committed Jul 26, 2022
1 parent 2198d96 commit 85026d2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.util.Collections;
import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.mutable.MutableLong;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
Expand All @@ -36,6 +35,7 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience;

import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
import org.apache.hbase.thirdparty.com.google.protobuf.Service;
Expand Down Expand Up @@ -117,13 +117,13 @@ public void getKeyValueCount(RpcController controller, CountRequest request,
scanner = env.getRegion().getScanner(new Scan());
List<Cell> results = new ArrayList<>();
boolean hasMore = false;
MutableLong count = new MutableLong();
long count = 0;
do {
hasMore = scanner.next(results);
results.forEach((r) -> count.increment());
count += Iterables.size(results);
results.clear();
} while (hasMore);
response = CountResponse.newBuilder().setCount(count.longValue()).build();
response = CountResponse.newBuilder().setCount(count).build();
} catch (IOException ioe) {
CoprocessorRpcUtils.setControllerException(controller, ioe);
} finally {
Expand Down

0 comments on commit 85026d2

Please sign in to comment.