Open a collection inside a write transaction
I'm getting this error:
MDBX_BUSY: Another write transaction is running, or environment is already used while opening with MDBX_EXCLUSIVE flag
Is there a workaround for this?
Strangely, the readme for libmdbx lists this as a feature:
Nested write transactions.
..yet the error message implies write transactions cannot be nested.
The docs for libmdbx say otherwise (emphasis mine):
A transaction and its cursors must only be used by a single thread, and a thread may only have a single transaction at a time.
https://erthink.github.io/libmdbx/group__c__transactions.html#ga9621bd463ec9efb2373f25dfb016938a
Ah, the devil is in the details. The parent argument to mdbx_txn_begin is what "nested write transactions" refers to. In other words, the nesting must be explicit.
If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent. Transactions may be nested to any level. A parent transaction and its cursors may not issue any other operations than mdbx_txn_commit and mdbx_txn_abort() while it has active child transactions.