OptimisticLockingFailureException is not thrown by spring data couchbase [DATACOUCH-633] #944
Labels
in: core
Issues in core support
status: duplicate
A duplicate of another issue
type: bug
A general bug
Sahil333 opened DATACOUCH-633 and commented
I am trying to migrate my application from spring boot 2.2.6 to 2.3.6. This update also updates the spring-data-couchbase 3.2.6 to 4.0.2. The earlier version was throwing OptimisticLockingFailureException but with this upgrade, the exception is never thrown. I am using the debugger to stop the execution just before persisting, then changing the data manually in couchbase UI and continue the execution. The exception is thrown in spring-data-couchbase 3.2.6 but not in 4.0.2
I tried to catch DataIntegrityViolationException as well, as done in CouchbaseExceptionTranslator
if (ex instanceof CasMismatchException || ex instanceof ConcurrentModificationException
|| ex instanceof ReplicaNotConfiguredException || ex instanceof DurabilityLevelNotAvailableException
|| ex instanceof DurabilityImpossibleException || ex instanceof DurabilityAmbiguousException) {
return new DataIntegrityViolationException(ex.getMessage(), ex);
}
but no luck. It seems it never sets the cas options in upsert operation and that's why sdk never throws CasMisMatchException
private UpsertOptions buildUpsertOptions() {
final UpsertOptions options = UpsertOptions.upsertOptions();
if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE)
{ options.durability(persistTo, replicateTo); }
else if (durabilityLevel != DurabilityLevel.NONE)
{ options.durability(durabilityLevel); }
return options;
}
Affects: 4.0.4 (Neumann SR4)
Reference URL: https://stackoverflow.com/questions/64322221/optimisticlockingfailureexception-is-not-thrown-by-spring-data-couchbase
The text was updated successfully, but these errors were encountered: