From: Howard Chu Date: Mon, 7 Jul 2014 00:47:25 +0000 (-0700) Subject: Compacting copy doesn't need to snapshot metas X-Git-Tag: OPENLDAP_REL_ENG_2_4_40~127^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1ac5147fc175907f0c657ce8416c70242eb91fd5;p=openldap Compacting copy doesn't need to snapshot metas --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index bdc11b5a09..e0465d4795 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -8338,29 +8338,12 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) my.mc_toggle = 0; my.mc_env = env; my.mc_fd = fd; + THREAD_CREATE(thr, mdb_env_copythr, &my); - /* Do the lock/unlock of the reader mutex before starting the - * write txn. Otherwise other read txns could block writers. - */ rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); if (rc) return rc; - if (env->me_txns) { - /* We must start the actual read txn after blocking writers */ - mdb_txn_reset0(txn, "reset-stage1"); - - /* Temporarily block writers until we snapshot the meta pages */ - LOCK_MUTEX_W(env); - - rc = mdb_txn_renew0(txn); - if (rc) { - UNLOCK_MUTEX_W(env); - goto leave; - } - } - - THREAD_CREATE(thr, mdb_env_copythr, &my); mp = (MDB_page *)my.mc_wbuf[0]; memset(mp, 0, 2*env->me_psize); mp->mp_pgno = 0; @@ -8410,7 +8393,7 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) pthread_cond_wait(&my.mc_cond, &my.mc_mutex); pthread_mutex_unlock(&my.mc_mutex); THREAD_FINISH(thr); -leave: + mdb_txn_abort(txn); #ifdef _WIN32 CloseHandle(my.mc_cond);