virajjasani commented on code in PR #1884:
URL: https://github.com/apache/phoenix/pull/1884#discussion_r1618076149


##########
phoenix-core-server/src/main/java/org/apache/phoenix/hbase/index/IndexRegionObserver.java:
##########
@@ -1308,6 +1345,19 @@ public void 
postBatchMutateIndispensably(ObserverContext<RegionCoprocessorEnviro
       try {
           if (success) {
               context.currentPhase = BatchMutatePhase.POST;
+              for (int i = 0; i < miniBatchOp.size(); i++) {
+                  BatchMutateContext.UpdateStatus updateStatus = 
context.getUpdateStatus(i);
+                  if 
(BatchMutateContext.UpdateStatus.UPDATE.equals(updateStatus)) {
+                      byte[] retVal = PInteger.INSTANCE.toBytes(1);
+                      Cell cell = PhoenixKeyValueUtil.newKeyValue(
+                              miniBatchOp.getOperation(i).getRow(),
+                              EMPTY_BYTE_ARRAY, EMPTY_BYTE_ARRAY, 0, retVal, 0,
+                              retVal.length);
+                      Result result = Result.create(new 
ArrayList<>(Arrays.asList(cell)));
+                      miniBatchOp.setOperationStatus(i,
+                              new OperationStatus(OperationStatusCode.SUCCESS, 
result));
+                  }
+              }

Review Comment:
   While that is true, i was thinking of two cases:
   
   1. If there is a bug at server side, and the client starts receiving null 
Result object always, we would not know the difference b/ server returning null 
object by intention vs the buggy behavior causing override to what server is 
supposed to send.
   2. In future, when we need to introduce JDBC API returning Result object 
with values, we anyways need to incorporate this logic.
   
   How about we do this: keep the above code same, but wrap it within if 
condition: 
   `if(context.hasAtomic && miniBatchOp.size() == 1)`



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to