C SDK 3.3.4 using "txid" in lcb_cmdquery_option() for transactions


Trying to implement a transaction library using the libcouchbase C SDK, where I use “BEGIN WORK” to get the transaction ID followed by my DML statements where I pass the txid returned from BEGIN.

I use the below options for lcb_CMDQUERY to set the txid and other details like timeout.
lcb_cmdquery_option(cmd, “pretty”, strlen(“pretty”), “true”, strlen(“true”));
lcb_cmdquery_option(cmd, “txtimeout”, strlen(“txtimeout”), “"3s"”, strlen(“"3s"”));
lcb_cmdquery_option(cmd, “txid”, strlen(“txid”), txid.c_str(), txid.size());

However I observed that lcb_cmdquery_option option for txid returns the error LCB_ERR_INVALID_ARGUMENT.

Although this is intermittent, it works sometimes, but doesn’t work most of the times. I checked the txid it is passing the correct one, example "“d81c5329-5713-4fe8-a8f4-ac95b232d42b”.

Is there a different way to use transactions in the C SDK?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

“Transactions are not available directly via the C SDK. Although our C++ Distributed ACID Transactions are built upon the C SDK it doesn’t expose any C symbols explicitly. Applications built using C SDK and C++ Transactions can run in parallel without interfering with each other — more details on our C++ Distributed Transactions pages.”