CXXCBC-462: Fix hanging when specifying a custom metadata collection via the public API & expose errors#532
Conversation
…via the public API & expose errors
dfaf04f to
3a0611c
Compare
|
This question is not related to the changes specific to this PR, but it is related. Why do we "implicitly" create the transactions object when we create a cluster object in the public API? I don't get the sense that is what we need to do in order to support |
The spec doesn't specify this behaviour. It only says "The life-cycle of that Transactions object is now bound to the Cluster it's created from." and it appears to leave the details up to the implementation. However, I agree that it would be better to lazily create the transactions object to avoid spinning up all the transactions infrastructure for users who are not using transactions. A problem here is that I'll need to investigate further if we should actually be doing this |
I agree, this is what we do with buckets, scopes and collections. Lets capture this as a ticket and discuss it separately. Maybe it should go one step further, and not just lazily create transaction object, but defer running background tasks and opening a bucket until first transaction will be scheduled. |
I've filed a ticket for this: CXXCBC-474 |
…via the public API & expose errors (couchbase#532) Co-authored-by: Sergey Avseyev <sergey.avseyev@gmail.com>
Motivation
Specifying a custom metadata collection when calling
cluster::connectresults in the SDK to hang as the constructor ofcore::transactions::transactions, which is called in the callback ofcore.open(running on an IO thread), attempts to open the bucket of the custom metadata (requires an available IO thread) and blocks until that is completed (which means that it does not release its IO thread to be used byopen_bucket). In addition, the constructor throws exceptions when an error occurs in the constructor which are not being handled by either the Public API or the wrappers.Changes
core::transactions::transactions::createmethod to construct the core transactions object, which takes a callback and can be chained with other asynchronous operations. It also returns an appropriate error code via the callback when an error occurs.cluster::connect, handle any errors that occur duringtransactions::createby closing the cluster and surfacing the error via thecluster_connect_handlercluster::connectreturnsbucket_not_foundwhen the specified metadata collection's bucket does not existResults
CleanUpInMultipleBucketsTest) no longer hang when the performer runs with 1 IO thread