[
https://issues.apache.org/jira/browse/PHOENIX-6187?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17236788#comment-17236788
]
ASF GitHub Bot commented on PHOENIX-6187:
-----------------------------------------
m2je commented on a change in pull request #921:
URL: https://github.com/apache/phoenix/pull/921#discussion_r528242126
##########
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:
Done
##########
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:
By looking at Hbase's code it does seem that `FAILURE` is not a
retriable state,
[example](https://github.com/apache/hbase/blob/branch-2.1/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java#L3765)
Added a retry for `NOT_RUN` (which if I understand correctly is used when
mutation was never executed)
----------------------------------------------------------------
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:
[email protected]
> Avoid swallowing UPSERT... ON DUPLICATION KEY UPDATE failures
> --------------------------------------------------------------
>
> Key: PHOENIX-6187
> URL: https://issues.apache.org/jira/browse/PHOENIX-6187
> Project: Phoenix
> Issue Type: Bug
> Affects Versions: 5.0.0, 4.15.0
> Reporter: Mehdi Salarkia
> Assignee: Mehdi Salarkia
> Priority: Critical
>
> When there is an UPSERT with an ON DUPLICATE KEY condition, if the region
> mutation response is a failure it gets ignore and silently swallowed
> resulting in silent write failures.
> This is a major issue resulting in client assuming the write was successful
> while it actually was not.
> Also see another report
> [https://lists.apache.org/thread.html/ra229cea951236d9c48d06ec137f415997f0acb0d99078a6c19290c0e%40%3Cdev.phoenix.apache.org%3E]
> Which could be cause by this issue.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)