Fix per-txn MDB_NOMETASYNC, MDB_NOSYNC.

Fallout from 4d02c741b1. The flags
were ignored: mdb_txn_renew0/begin cleared and/or did not set them.
vl32b
Hallvard Furuseth 10 years ago
parent 54516639ac
commit 8adee9464f
  1. 6
      libraries/liblmdb/mdb.c

@ -2735,9 +2735,9 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret)
return EACCES; return EACCES;
if (parent) { if (parent) {
/* Nested transactions: Max 1 child, write txns only, no writemap */ /* Nested transactions: Max 1 child, write txns only, no writemap */
flags |= parent->mt_flags;
if (parent->mt_child || if (parent->mt_child ||
((flags | parent->mt_flags) & (flags & (MDB_RDONLY|MDB_WRITEMAP|MDB_TXN_ERROR)))
(MDB_RDONLY|MDB_WRITEMAP|MDB_TXN_ERROR)))
{ {
return (parent->mt_flags & MDB_TXN_RDONLY) ? EINVAL : MDB_BAD_TXN; return (parent->mt_flags & MDB_TXN_RDONLY) ? EINVAL : MDB_BAD_TXN;
} }
@ -2794,7 +2794,6 @@ ok:
parent->mt_child = txn; parent->mt_child = txn;
txn->mt_parent = parent; txn->mt_parent = parent;
txn->mt_numdbs = parent->mt_numdbs; txn->mt_numdbs = parent->mt_numdbs;
txn->mt_flags = parent->mt_flags;
txn->mt_dbxs = parent->mt_dbxs; txn->mt_dbxs = parent->mt_dbxs;
memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db)); memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db));
/* Copy parent's mt_dbflags, but clear DB_NEW */ /* Copy parent's mt_dbflags, but clear DB_NEW */
@ -2822,6 +2821,7 @@ ok:
if (txn != env->me_txn0) if (txn != env->me_txn0)
free(txn); free(txn);
} else { } else {
txn->mt_flags |= flags; /* for txn==me_txn0, no effect otherwise */
*ret = txn; *ret = txn;
DPRINTF(("begin txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", DPRINTF(("begin txn %"Z"u%c %p on mdbenv %p, root page %"Z"u",
txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w', txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w',

Loading…
Cancel
Save