1

I have a use case in which there are three documents and I want to update them transactionally i.e. if any of them fails then other too should not get updated in the database. I was looking for an option but didn't find one in JavaSDK. So is there any way in which I can perform this operation transactionally. I am using the CAS value for handling the concurrency. Please provide me a way to handle this operation concurrently.

Couchbase Version: 4.0 Java SDK: 2.1.6

Any help is appreciated.!

Shivansh
  • 3,454
  • 23
  • 46

3 Answers3

5

Couchbase is a NoSQL database, where there is a tradeoff between ACID properties of traditional RDBMS and performance and scalability.

The only atomicity that couchbase can enforce is at the level of a single document.

There could be writings around the web on how to implement a transaction system with Couchbase, but that is clearly not something supported off-the-shelf, by design. It is a very complicated endeavour that I wouldn't recommend.

Try to model your documents differently first, so that the mutation can occur on a single document (where CAS could then be used).

Simon Baslé
  • 27,105
  • 5
  • 69
  • 70
0

this doc (from couchbase) seems relevant: Providing transactional logic

FuzzyAmi
  • 7,543
  • 6
  • 45
  • 79
  • Yeah it seems correct but with this I do have a serious issue in mind same as this guy. https://forums.couchbase.com/t/question-about-two-phase-commit/4424 – Shivansh Feb 04 '16 at 12:04
0

Couchbase now supports full ACID distribution transactions in the beta release of Couchbase Server 6.5. Please see this blog post for more details and links to the documentation.

Graham Pople
  • 416
  • 4
  • 8