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

Attachment: OpenPGP_0x1716A1B35E826596.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to