I’m currently extending a propriatary API to support transactions to our NoSQL databases. One of the implementation is using the Libcouchbase C SDK 3.3.1.
The goal is to implicitly collect operations to these databases, and if a certain threshold is reached to preempt these, in order to avoid high single operation network I/O. Some tests at our sides point to a 2-4x improvement in processing speed (only limited by serialization), so we’re quite excited.
What I had issues with, is the handling boundaries for the scheduling commands, using the functions from the advanced scheduling section.
Long story short - our API sometimes (meaning I fixed some issues) had called
lcb_sched_enter multiple times without closing with
lcb_sched_flush - but we aren’t using async operations).
We basically wrap the C API over our C++ API, which is using RAII to ensure the lifetimes are ‘correct’. But the above mentioned functions don’t return a
lcb_STATUS or something else to observe the status of a ‘transaction’.
My main concern is that it’s not guaranteed (that the above mentioned functions are created pairwise) by the Libcouchbase C API itself and I miss some ‘special cases’ that I’m not aware of (yet).
In our case this lead to a OOM errors in the Libcouchbase API (to many scheduled operations) and a lot of
Of course it’s possible to manually wrap some sort of logic to avoid this (and I probably end up doing this), but a standard approach for the SDK would be appreciated.
For example, a call to
lcb_sched_enter might implicitly check for the pair and close it, the functions return an error code or these functions simply opt out (if not created pairwise, etc.).
In general a function to observe the size of a transaction would be appreciated as well.
Or maybe I’m missing something. In either case some feedback and/or advice on the advanced scheduling topic would be appreciated.