Apache9 commented on a change in pull request #2630: URL: https://github.com/apache/hbase/pull/2630#discussion_r528349087
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java ########## @@ -972,11 +1001,44 @@ private void doBatchOp(final RegionActionResult.Builder builder, final HRegion r OperationStatus[] codes = region.batchMutate(mArray, atomic, HConstants.NO_NONCE, HConstants.NO_NONCE); + if (atomic) { + List<ResultOrException> resultOrExceptions = new ArrayList<>(); + List<Result> results = new ArrayList<>(); + for (i = 0; i < codes.length; i++) { + if (codes[i].getResult() != null) { + results.add(codes[i].getResult()); + } + if (i != 0) { + resultOrExceptions.add(getResultOrException( + ClientProtos.Result.getDefaultInstance(), i)); + } + } + + if (results.isEmpty()) { + resultOrExceptions.add(0, getResultOrException( Review comment: I think here we could just call builder.addResultOrException directly to add the first ResultOrException? And then call addAllResultOrException to add the remaining ResultOrExceptions in the list, so we do not need to add a new element in front? ########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java ########## @@ -972,11 +1001,44 @@ private void doBatchOp(final RegionActionResult.Builder builder, final HRegion r OperationStatus[] codes = region.batchMutate(mArray, atomic, HConstants.NO_NONCE, HConstants.NO_NONCE); + if (atomic) { + List<ResultOrException> resultOrExceptions = new ArrayList<>(); + List<Result> results = new ArrayList<>(); + for (i = 0; i < codes.length; i++) { + if (codes[i].getResult() != null) { + results.add(codes[i].getResult()); + } + if (i != 0) { + resultOrExceptions.add(getResultOrException( + ClientProtos.Result.getDefaultInstance(), i)); + } + } + + if (results.isEmpty()) { + resultOrExceptions.add(0, getResultOrException( + ClientProtos.Result.getDefaultInstance(), 0)); + } else { + // Set the result of the Increment/Append operations to the first element of the + // ResultOrException list + List<Cell> cellList = new ArrayList<>(); Review comment: Mind explaining a bit about the logic here? I think batchMutate is for multiple operations? Why here we could merge the cells from different Results? We can make sure they are always for the same row? ---------------------------------------------------------------- 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: us...@infra.apache.org