WaitUntilReadyAsync no longer detects state change properly

We periodically use WaitUntilReadyAsync in our code to detect if the cluster is healthy. This check stopped working after some recent changes. It will work for the initial connection, but once it’s been established it will always report as Online even if you shut the service completely off.

It seems like the bug was introduced in https://review.couchbase.org/c/couchbase-net-client/+/189638/12/src/Couchbase/Core/Configuration/Server/BucketConfig.cs#324

BucketConfig was changed to have a default name “CLUSTER” instead of null. This causes CreatePingReportAsync to call ClusterContext.GetNodes with bucketName = “CLUSTER” and always return an empty enumeration instead of a list of nodes.

Also, while debugging I noticed that ClusterContext.BootstrapGlobalAsync is calling AddNode twice and wanted to point that out as well. It causes the global node to be inserted into the Nodes list more than once. (https://review.couchbase.org/c/couchbase-net-client/+/189638/12/src/Couchbase/Core/ClusterContext.cs#375)

1 Like

Hi @dredmond -

Thanks for reporting. I created a ticket which will either be in 3.4.9 or 3.4.10, I am not sure at the moment.

I made it a minor issue, but may change that once I check it out. Also, thanks for pointing out the other issue although the ClusterNodeCollection shouldn’t let the add be successful because of a hash collision if the node was added twice. I’ll look into that as well!

Thanks,
Jeff

1 Like

Thanks for taking a look.