Full_Name: Hallvard B Furuseth
Version: master, af3a23a1ec93220be392a8ea6372475b7357c171
OS: Linux x86_64
URL:
Submission from: (NULL) (195.1.106.125)
Submitted by: hallvard
A write transaction can overwrite env->me_metas[]->mm_dbs, me_numdbs
and me_dbxs while another txn is copying them in mdb_txn_renew0(),
resulting in an inconsistent copy.
'#define LAZY_LOCKS 0' fixes it. Without it, test054 dumps core with
this patch:
diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c
index b714119..5e22827 100644
--- a/libraries/libmdb/mdb.c
+++ b/libraries/libmdb/mdb.c
@@ -1519,2 +1519,4 @@ mdb_txn_renew0(MDB_txn *txn)
memcpy(txn->mt_dbs, env->me_metas[txn->mt_toggle]->mm_dbs, 2 *
sizeof(MDB_db));
+ if ((rand() & 1)) usleep(100000);
+ assert(!memcmp(txn->mt_dbs, env->me_metas[txn->mt_toggle]->mm_dbs, 2 *
sizeof(MDB_db)));
if (txn->mt_numdbs > 2)
I'm sleeping for write transactions only since that's when the
inconsistent copy is written back to disk.