I setup a .net core API to read/write to the db:
If I do not have the db accessible/running
_bucketProvider.GetBucketAsync() will return the bucket not found error. Once the db is accessible/running
_bucketProvider.GetBucketAsync() will continue to serve the bucket not found error.
So if the NamedBucketProvider is ever triggered during initial creation and the db isn’t present for some reason the provider is never able to talk to couchbase once the db server is available. The only way to resolve is to restart the API.
You are 100% correct, it seems like our performance optimization bit us in this particular edge case. I’ve filed a bug: https://issues.couchbase.com/browse/NCBC-3206
In the meantime, the workaround would be to register a custom implementation of IBucketProvider. You can base it on this implementation and just drop the ConcurrentDictionary cache: couchbase-net-client/BucketProvider.cs at master · couchbase/couchbase-net-client · GitHub
Just make sure you register the implementation before you call
AddCouchbase and it should take precedence over the default implementation.
Awesome, this worked perfectly, I had to update my Couchbase.Extensions.DependencyInjection from 3.2.8 to 3.3.0 since it seemed it was caching the cluster in the provider too… but with the update to 3.3.0 I saw different exceptions so the clusterprovider must of handled that better. In the end this solved my need. Thanks for the help!