brfrn169 commented on a change in pull request #2630:
URL: https://github.com/apache/hbase/pull/2630#discussion_r528351244



##########
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:
       batchMutate can also be used by mutateRow(), and the case that atomic is 
true is when a client calls mutateRow(). In this case, of course, the results 
are always for the same row, and we need to return the results of 
Increment/Append operations as one Result object. That's why we need to merge 
the cell from different Results. And this logic sets the result to the first 
element of the ResultOrException list. Thanks.




----------------------------------------------------------------
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


Reply via email to