Is the 2.0 developer preview Java client supposed to support CAS values?

I wanted to see what happens when replace fails due to CAS value, so I executed a fast batch of several dozens of replace requests for the same document, but all with the same CAS value.

The expected result was that only the first would succeed, but instead, all replace operations work.

I then tried to manually tamper with the CAS value (just in case) and indeed when doing that the replace operations still work.

Slowing things down with a debugger also confirms this behavior.
So is the first developer preview supposed to support this?

I see here: https://github.com/couchbase/couchbase-java-client/blob/master/src/main/... (line 100) that the CAS value is not even sent, so perhaps this is intentional (for now).

1 Answer

« Back to question.

Hi,

as designed, the only method which respects the CAS is replace. For insert it doesn't make sense and we opted out for doing it on upsert as well, since with replace + cas you can explicitly say "please update this doc in a CAS safe manner".

Let me know if that aligns with your findings and if not please raise a JCBC ticket - thanks!