From c7274b7dbe3ae9754eda76c729fa8085b68a3e8b Mon Sep 17 00:00:00 2001 From: Subhashni Balakrishnan Date: Thu, 31 Jan 2019 14:50:57 -0800 Subject: [PATCH] Code gardening and fix to existing behavior for JCBC-1175 When multiple threads are using queue remove, dont use set the result value from subdoc fetch for path not found so only one thread succeeds, this was the existing behavior, full doc to sub doc altered this, so reverting back to old behavior. Change-Id: I06340005b30c5c6277fe3e4591b65ddb8cadbbe5 Reviewed-on: http://review.couchbase.org/104351 Tested-by: Subhashni Balakrishnan Reviewed-by: Matt Ingenthron --- .../com/couchbase/client/java/CouchbaseAsyncBucket.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java b/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java index d13063db..39df45fc 100644 --- a/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java +++ b/src/main/java/com/couchbase/client/java/CouchbaseAsyncBucket.java @@ -1963,8 +1963,8 @@ public DocumentFragment call(E element) { return ResultMappingUtils.convertToSubDocumentResult(ResponseStatus.SUCCESS, mutationOperation, element); } }); - } else if (throwable instanceof MultiMutationException && throwable.getCause() instanceof PathNotFoundException) { - return Observable.just(ResultMappingUtils.convertToSubDocumentResult(ResponseStatus.SUCCESS, mutationOperation, null)); + } else if (throwable.getCause() instanceof PathNotFoundException) { + return Observable.just(ResultMappingUtils.convertToSubDocumentResult(ResponseStatus.NOT_EXISTS, mutationOperation, null)); } else { return Observable.error(throwable); } @@ -1986,6 +1986,8 @@ public E call(DocumentFragment documentFragment) { } else { return (E) val; } + } else if (status == ResponseStatus.NOT_EXISTS) { + return null; } else { throw new CouchbaseException(status.toString()); }