Two clients connecting to one cluster / race conditions


Let’s assume two Couchbase clients connecting to the same cluster.
If I now call “getAndLock” on a document from one client, will the other client also see the document as locked immediately or could there be a situation where the other client could still get the lock on that document, too?

Imo this boils down to: Where does Couchbase cache its data? On client side or on cluster side? If the lock is at first only held on client side and later forwarded to the cluster side, then we might have the problem as above.

Thanks for clarifying!

For the record: I’m using Java SDK 2.1.3 and the server is 3.0.2


@SebastianF no it’s not possible that two clients posses the same lock, since its an “atomic” operation, like a cas update. One response will get the result with a good cas, and the other will get an error (TemporaryLockFailureException).

The information of the write lock is handled on the server side, the client just receives the response according to the procotol.


Exactly how I hoped and thought. Thx!