Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

CAS result StatusCode

7 replies [Last post]
  • Login or register to post comments
Mon, 01/23/2012 - 20:17
Nosralla
Offline
Joined: 09/02/2011
Groups: None

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 :(

Top
  • Login or register to post comments
Tue, 01/24/2012 - 18:43
Nosralla
Offline
Joined: 09/02/2011
Groups: None

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......

Top
  • Login or register to post comments
Wed, 02/01/2012 - 12:09
mikew
Offline
Joined: 03/14/2011
Groups:

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.

Top
  • Login or register to post comments
Tue, 02/07/2012 - 18:28
Nosralla
Offline
Joined: 09/02/2011
Groups: None

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

Top
  • Login or register to post comments
Tue, 02/07/2012 - 18:51
mikew
Offline
Joined: 03/14/2011
Groups:

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?

Top
  • Login or register to post comments
Tue, 02/07/2012 - 20:21
Nosralla
Offline
Joined: 09/02/2011
Groups: None

[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();
}

Top
  • Login or register to post comments
Wed, 02/08/2012 - 16:15
john
Offline
Joined: 01/05/2012
Groups: None

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

Top
  • Login or register to post comments
Wed, 02/22/2012 - 14:39
ChssAddct
Offline
Joined: 09/19/2011
Groups: None

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.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker