mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-30 22:47:16 +08:00
lmdb: Fix per-txn MDB_NOMETASYNC, MDB_NOSYNC.
Fallout from 4d02c741b120786df1b87ee9ed49c1d3f9bc7522. The flags were ignored: mdb_txn_renew0/begin cleared and/or did not set them. Change-Id: Ic7dab1e9a4cf3754e05a3c3df6a10e0efa48af5c
This commit is contained in:
parent
c4097ec898
commit
dba429d608
6
mdb.c
6
mdb.c
@ -3127,9 +3127,9 @@ mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret)
|
||||
return EACCES;
|
||||
if (parent) {
|
||||
/* Nested transactions: Max 1 child, write txns only, no writemap */
|
||||
flags |= parent->mt_flags;
|
||||
if (parent->mt_child ||
|
||||
((flags | parent->mt_flags) &
|
||||
(MDB_RDONLY|MDB_WRITEMAP|MDB_TXN_ERROR)))
|
||||
(flags & (MDB_RDONLY|MDB_WRITEMAP|MDB_TXN_ERROR)))
|
||||
{
|
||||
return (parent->mt_flags & MDB_TXN_RDONLY) ? EINVAL : MDB_BAD_TXN;
|
||||
}
|
||||
@ -3187,7 +3187,6 @@ ok:
|
||||
parent->mt_child = txn;
|
||||
txn->mt_parent = parent;
|
||||
txn->mt_numdbs = parent->mt_numdbs;
|
||||
txn->mt_flags = parent->mt_flags;
|
||||
txn->mt_dbxs = parent->mt_dbxs;
|
||||
memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db));
|
||||
/* Copy parent's mt_dbflags, but clear DB_NEW */
|
||||
@ -3215,6 +3214,7 @@ ok:
|
||||
if (txn != env->me_txn0)
|
||||
free(txn);
|
||||
} else {
|
||||
txn->mt_flags |= flags; /* for txn==me_txn0, no effect otherwise */
|
||||
*ret = txn;
|
||||
DPRINTF(("begin txn %"Z"u%c %p on mdbenv %p, root page %"Z"u",
|
||||
txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w',
|
||||
|
Loading…
x
Reference in New Issue
Block a user