Skip to content

OptimisticLockingFailureException is not thrown by spring data couchbase [DATACOUCH-633] #944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 12, 2020 · 2 comments
Assignees
Labels
in: core Issues in core support status: duplicate A duplicate of another issue type: bug A general bug

Comments

@spring-projects-issues
Copy link

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

@spring-projects-issues
Copy link
Author

Sahil333 commented

Found the original jira issue for this - DATACOUCH-623

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Oct 12, 2020

Michael Reiche commented

I don't think this is a duplicate of https://jira.spring.io/browse/DATACOUCH-623 .
In that issue, the discussion is that it is not even possible to get a CasMismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core support status: duplicate A duplicate of another issue type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants