From: Jay Freeman (saurik) Date: Sun, 23 Dec 2012 09:32:48 +0000 (+0000) Subject: When closing the MDB DBI, do it in a transaction. X-Git-Url: https://git.saurik.com/redis.git/commitdiff_plain/6caa0c10ef630ec583deb63d0b04cc01f8256d5d?ds=sidebyside When closing the MDB DBI, do it in a transaction. --- diff --git a/src/migrate.c b/src/migrate.c index 6d8aad7f..05a48a22 100644 --- a/src/migrate.c +++ b/src/migrate.c @@ -255,7 +255,15 @@ socket_rd_err: void stopKeyArchive(void) { redisAssert(env != NULL); - mdb_dbi_close(env, dbi); + MDB_txn *txn; + int ret = mdb_txn_begin(env, NULL, 0, &txn); + if (ret != 0) + mdb_txn_abort(txn); + else { + mdb_dbi_close(env, dbi); + mdb_txn_commit(txn); + } + mdb_env_close(env); env = NULL;