mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Compacting copy doesn't need to snapshot metas
This commit is contained in:
parent
61f7ec9bfa
commit
1ac5147fc1
1 changed files with 2 additions and 19 deletions
|
|
@ -8338,29 +8338,12 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd)
|
||||||
my.mc_toggle = 0;
|
my.mc_toggle = 0;
|
||||||
my.mc_env = env;
|
my.mc_env = env;
|
||||||
my.mc_fd = fd;
|
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);
|
rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
|
||||||
if (rc)
|
if (rc)
|
||||||
return 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];
|
mp = (MDB_page *)my.mc_wbuf[0];
|
||||||
memset(mp, 0, 2*env->me_psize);
|
memset(mp, 0, 2*env->me_psize);
|
||||||
mp->mp_pgno = 0;
|
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_cond_wait(&my.mc_cond, &my.mc_mutex);
|
||||||
pthread_mutex_unlock(&my.mc_mutex);
|
pthread_mutex_unlock(&my.mc_mutex);
|
||||||
THREAD_FINISH(thr);
|
THREAD_FINISH(thr);
|
||||||
leave:
|
|
||||||
mdb_txn_abort(txn);
|
mdb_txn_abort(txn);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
CloseHandle(my.mc_cond);
|
CloseHandle(my.mc_cond);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue