Managing Couchbase with SDK 3.1


I’m in the process of upgrading from SDK2 to SDK3 and I’m trying to figure out how to implement this SDK2 code in .NET5 as it seem to be missing from your docs:

           // get total ram allocated
            var info = clusterManager.ClusterInfo();
            StorageTotals storageTotals = info.Value.Pools().StorageTotals;
            long totalMachineRam = storageTotals.Ram.QuotaTotal;

Also, I’ve noticed when using Buckets.CreateBucketAsync to create a bucket that already exist, it doesn’t throw an exception. It also doesn’t seem to return anything to let me know the action was successful unlike in SDK2.

I have also been trying to use
var bucket = CouchbaseConnection.Buckets.GetBucketAsync(bucketName).GetAwaiter().GetResult();

But for an existing bucket I get an exception:

ArgumentNullException: Value cannot be null. (Parameter 'value')
Newtonsoft.Json.Utilities.ValidationUtils.ArgumentNotNull(object value, string parameterName)

Reviewing the Management API RFC, this is something that was not carried over from SDK2 to SDK3. Do you have a specific need for this information?

I create a ticket for this issue.

There is a ticket and a patch for this: It will be released in June with v3.1.6.


Thanks @jmorris

The ticket about the ArgumentNullException seems to be regarding GetAllBucketAsync.
The issue is also with GetBucketAsync and GetUserAsync (at least).
And the ticket is referring to an unavailable node… My node is available. Not sure if you guys diagnosed the problem correctly then…

As for the ClusterInfo method, I just needed to get the total ram available on the machine and with .NET core it seems to be a hassle unlike in .NET Framework, so I was hoping you’ve implemented some server info class

@alon.schachter - NCBC-2551 is for a different method but I believe it should fix the issue for GetBucketAsync as well. Did you try it? What server version are you using?


I’m on Couchbase 6.6 community.
So probably can’t test it until the new sdk is released.

1 Like

@alon.schachter -

Ok, the fix will be in the June SDK release. You can also pull the source directly and build it yourself if its needed earlier.


1 Like