- couchbase config
host: ip:127.0.0.1 port:17000
buckets: Bucket1 Bucket2 Bucket3
I want to set 3 buckets {set(Bucket1), set(Bucket2), set(Bucket3)} as a transaction.
How should I do to implement?
host: ip:127.0.0.1 port:17000
buckets: Bucket1 Bucket2 Bucket3
I want to set 3 buckets {set(Bucket1), set(Bucket2), set(Bucket3)} as a transaction.
How should I do to implement?
The short answer is 'no'. Couchbase does not support transactions across different documents. As theMayer mentioned, you might avoid the need for transactions by modelling your data differently. However, if you must have it, you can use two phase commit to get part of the transaction functionality (the atomicity and durability, but not isolation or consistency.)
You can read up on 2PC in general here: http://en.wikipedia.org/wiki/Two-phase_commit_protocol and specifically as it relates to Couchbase here: http://docs.couchbase.com/couchbase-devguide-2.5/#performing-two-phase-commits
As of Couchbase Server 6.5 (in beta as of this writing), there is a way to atomically modify multiple documents in a single transaction. Chances are you will want to model this as documents in different collections.