CAS result StatusCode
Hi,
Can someone point me to what StatusCode 2 mean?
I'm trying a simple Cas operation and it always return false with statuscode 2
If i pass cas 0 (no cas) the operation succeeds;
I'm using Couchbase Server 2.0 Developer Preview 3 with .Net Client;
Sample Code:
//Get with CAS
var key = "someKey";
var getCasResult = couchClient.GetWithCas(key);
ulong cas = getCasResult.Cas;
//Deserialize and do some testing
var test = getCasResult.Result.FromJSON();
test.DoSomeThing();
//Serialize back and try to store
var json = test.ToJSON();
var updateResult = couchClient.Cas(Enyim.Caching.Memcached.StoreMode.Set, key, json, cas);
updateResult gives me False with StatusCode = 2 :(
Status code 2 is EEXISTS. This means that the cas value that you gave doesn't match the one on the server. Can you confirm that the cas value you specified matches the one on the server. If it doesn't we can investigate to see whether or not this is a bug.
mikew,
With the same object i got 2 different CAS values
Using CouchbaseClient 1.0 (membase client):
Document _rev: "114237-000003f6726112200000057112010000"
Got CAS value: 4357015802400
Using couchbase-net-client-0.9.1 (CouchBase Server Server 2.0 client)
Document _rev: "114237-000003f6726112200000057112010000"
Got CAS value: 1918964726
Trying to make an update using the 1918964726 CAS value fails, but i tried passing the 4357015802400 previously obtained with the membase client and got a sucess update
There is a major bug in CouchbaseClient 1.0.0, please upgrade to 1.0.1 if you have not already done so (I'm unsure exactly which version 1.0 is). With that said, can you post your code for the .NET client so I can send it over to our .NET guy?
[TestMethod]
public void CasOperation()
{
//Using couchbase-net-client-0.9.1
//Got from http://files.couchbase.com/developer-previews/clients/couchbase-server-2...
var client = new CouchbaseClient();
//Simple object to test
var testObject = "I used to make CAS operations";
//Store
var storeResult = client.Store(Enyim.Caching.Memcached.StoreMode.Set, "CasOperationTest", testObject);
Assert.IsTrue(storeResult);
//Get with CAS
var getCasResult = client.GetWithCas("CasOperationTest");
Assert.IsTrue(getCasResult.StatusCode == 0);
Assert.IsNotNull(getCasResult.Result);
//New object to replace current
var newObject = "But then i took an arrow to the knee";
var casSetResult = client.Cas(Enyim.Caching.Memcached.StoreMode.Replace, "CasOperationTest", newObject, getCasResult.Cas);
Assert.IsTrue(casSetResult.Result); // <======= FAILS
client.Dispose();
}
Hi Nosralla,
Currently, the only stable .NET client version is 1.0.1, which was released a couple of weeks ago. It supports (as you noted) only server version 1.8. I am however in the process of working on a version of the client to support 2.0. That will be happening over the next couple of weeks.
I did verify that I am seeing the same issue w/ pre 1.0.1 clients. The problem seems to be with the dependency Enyim.Caching as it existing in versions <= 0.9.2. Unfortunately, the earlier build processes for Couchbase.dll used ILMerge to create a single dependency, so a hot-swap of Enyim.Caching isn't possible.
Please let me know if you have any questions.
-- John
It's been two weeks. "the next couple of weeks".
Yes, I'm anxious, as we are developing a new product using Couchbase developer preview.
Any status report on a newer .Net client to support 2.0 is welcome.
Thanks.
After switching the version of the C# Client library i found that using the Couchbase Server 2 Dev Preview (C# Client V0.9.1) the CAS operation never works....
The exact same code if i use the Membase C# Client (V1.0) the CAS operation suceeds...but then i have no way to query my Views......