Hi there, I am trying to create a nested RW transaction under a RO transaction in LMDB v0.9.33:
int nested_op (MDB_env *env, MDB_txn *th) { MDB_txn *ptxn, *txn; if (th) ptxn = th; else mdb_txn_begin (env, NULL, MDB_RDONLY, &ptxn); return mdb_txn_begin (env, ptxn, 0, &txn); }
(rc checks skipped in example)
th can be NULL or an existing open transaction. It may be RW or RO.
If I run this code, the second mdb_txn_begin call fails with EINVAL. If I set the parent in that call to NULL, it succeeds.
I verified that env is healthy and I can open other transactions in it; in fact, the first mdb_txn_begin succeeds. According to the manual, I should be able to do this. Is the sample code correct?
Thanks, Stefano
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Stefano Cossu wrote:
Hi there, I am trying to create a nested RW transaction under a RO transaction in LMDB v0.9.33:
Please re-read what you just wrote and think for even a second.
You have a read-only transaction. And you're trying to create a nested read-write transaction under it. Which would make the entire transaction no longer read-only.
No. That is not what "read-only" means.
- -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/
openldap-technical@openldap.org