You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by GitBox <gi...@apache.org> on 2020/10/22 22:15:09 UTC

[GitHub] [phoenix] gjacoby126 commented on a change in pull request #921: PHOENIX-6187 Avoid swallowing UPSERT... ON DUPLICATION KEY UPDATE failures

gjacoby126 commented on a change in pull request #921:
URL: https://github.com/apache/phoenix/pull/921#discussion_r510488491



##########
File path: phoenix-core/src/main/java/org/apache/phoenix/hbase/index/Indexer.java
##########
@@ -311,7 +311,17 @@ public Result preIncrementAfterRowLock(final ObserverContext<RegionCoprocessorEn
           if (!mutations.isEmpty()) {
               Region region = e.getEnvironment().getRegion();
               // Otherwise, submit the mutations directly here
-                region.batchMutate(mutations.toArray(new Mutation[0]));
+              OperationStatus[] batchMutationStatus = region.batchMutate(

Review comment:
       Please also add to IndexRegionObserver, which is the coproc the new global index framework uses. 

##########
File path: phoenix-core/src/main/java/org/apache/phoenix/util/ServerUtil.java
##########
@@ -118,6 +122,33 @@ else if (cause == null || cause instanceof IOException) {
         }
     }
 
+    /**
+     * Converts a batch operation status into an IOException if the operation failed partially or completely. In cases
+     * of multiple failures, non-retriable errors are prioritized. If any part of the batch operation failed in a way
+     * that isn't retriable, an instance of the corresponding DoNotRetryIOException subtype is returned, even if other
+     * retriable errors are present. If all parts were completed successfully, null will be returned.
+     */
+    public static IOException createIOException(OperationStatus[] batchOperationStatus) {
+        IOException retriableException = null;
+        for (int i = 0; i < batchOperationStatus.length; i++) {
+            OperationStatus status = batchOperationStatus[i];
+            switch (status.getOperationStatusCode()) {
+                case SUCCESS:
+                    break;
+                case BAD_FAMILY:
+                    return new NoSuchColumnFamilyException(status.getExceptionMsg());
+                case SANITY_CHECK_FAILURE:
+                    return new FailedSanityCheckException(status.getExceptionMsg());
+                case STORE_TOO_BUSY:
+                    retriableException = new RegionTooBusyException(status.getExceptionMsg());
+                    break;
+                default:
+                    return new DoNotRetryIOException(status.getExceptionMsg());

Review comment:
       What about OperationStatus case FAILURE? There are other retriable exceptions other than RegionTooBusyException, aren't there? 




----------------------------------------------------------------
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:
users@infra.apache.org