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


##########
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java:
##########
@@ -1584,12 +1588,27 @@ public static MutationMetricQueue.MutationMetric 
updateMutationBatchFailureMetri
                 numDeleteMutationsInBatch++;
             }
         }
+
+        long totalFailedMutation = numUpsertMutationsInBatch + 
numDeleteMutationsInBatch;
+        //TODO: this case is something that should not happen
+        //but still if condition makes sese if this ever happens
+        if (totalFailedMutation < numFailedMutations) {
+            LOGGER.warn(
+                    "total failed mutation less than num of failed mutation.  
This is not expected.");
+            totalFailedMutation = numFailedMutations;
+        }
+        
System.out.println(GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue());

Review Comment:
   looks like this was for your debugging purpose, feel free to remove :)



##########
phoenix-core/src/main/java/org/apache/phoenix/execute/MutationState.java:
##########
@@ -1584,12 +1588,27 @@ public static MutationMetricQueue.MutationMetric 
updateMutationBatchFailureMetri
                 numDeleteMutationsInBatch++;
             }
         }
+
+        long totalFailedMutation = numUpsertMutationsInBatch + 
numDeleteMutationsInBatch;
+        //TODO: this case is something that should not happen
+        //but still if condition makes sese if this ever happens
+        if (totalFailedMutation < numFailedMutations) {
+            LOGGER.warn(
+                    "total failed mutation less than num of failed mutation.  
This is not expected.");
+            totalFailedMutation = numFailedMutations;
+        }
+        
System.out.println(GLOBAL_MUTATION_BATCH_FAILED_COUNT.getMetric().getValue());
+
+        GLOBAL_MUTATION_BATCH_FAILED_COUNT.update(
+                allDeletesMutations && !isTransactional ? 
numDeleteMutationsInBatch :
+                        totalFailedMutation);

Review Comment:
   we can extract the logic and keep value in one variable so the same variable 
can be used for both `GLOBAL_MUTATION_BATCH_FAILED_COUNT.update` and 
`MutationMetricQueue.MutationMetric`



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