ramkrish86 commented on a change in pull request #656: HBASE-23063 Add an
option to enable multiget in parallel
URL: https://github.com/apache/hbase/pull/656#discussion_r328211174
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java
##########
@@ -934,13 +939,61 @@ private Result increment(final HRegion region, final
OperationQuota quota,
builder.addResultOrException(resultOrExceptionBuilder.build());
}
}
+ // do multiget in parallel
+ if (getCtxs != null && !getCtxs.isEmpty()) {
+ doParallelGet(getCtxs, cellsToReturn, builder);
+ }
// Finish up any outstanding mutations
if (!CollectionUtils.isEmpty(mutations)) {
doNonAtomicBatchOp(builder, region, quota, mutations, cellScanner,
spaceQuotaEnforcement);
}
return cellsToReturn;
}
+ private void doParallelGet(List<GetContext> getCtxs, List<CellScannable>
cellsToReturn,
+ RegionActionResult.Builder builder) throws ServiceException {
+ ResultOrException.Builder resultOrExceptionBuilder = null;
+ CountDownLatch latch = new CountDownLatch(getCtxs.size());
+ List<GetActionHandler> handlers = new ArrayList<>(getCtxs.size());
+ for (GetContext getCtx : getCtxs) {
+ GetActionHandler handler = new GetActionHandler(getCtx, latch);
+ this.regionServer.executorService.submit(handler);
+ handlers.add(handler);
+ }
+ try {
+ latch.await();
Review comment:
My concern was since the handler is already submitted to the executor,
before even the await() happens there could be a chance that the countdown()
could be called. Seems calling countDown() without await() is not a problem.
But the reverse could be a problem. Will that happen?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services