mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-21 15:19:34 -05:00
More copyfd2 tweaks
This commit is contained in:
parent
6043103c13
commit
03f0ecb001
1 changed files with 6 additions and 4 deletions
|
|
@ -8087,7 +8087,6 @@ again:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
my->mc_wlen[toggle] = wsize;
|
|
||||||
if (rc) {
|
if (rc) {
|
||||||
my->mc_status = rc;
|
my->mc_status = rc;
|
||||||
pthread_mutex_unlock(&my->mc_mutex[toggle]);
|
pthread_mutex_unlock(&my->mc_mutex[toggle]);
|
||||||
|
|
@ -8100,6 +8099,7 @@ again:
|
||||||
my->mc_olen[toggle] = 0;
|
my->mc_olen[toggle] = 0;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
|
my->mc_wlen[toggle] = 0;
|
||||||
toggle ^= 1;
|
toggle ^= 1;
|
||||||
}
|
}
|
||||||
return (THREAD_RET)0;
|
return (THREAD_RET)0;
|
||||||
|
|
@ -8117,8 +8117,6 @@ mdb_env_cthr_toggle(mdb_copy *my)
|
||||||
pthread_mutex_unlock(&my->mc_mutex[toggle]);
|
pthread_mutex_unlock(&my->mc_mutex[toggle]);
|
||||||
return my->mc_status;
|
return my->mc_status;
|
||||||
}
|
}
|
||||||
my->mc_wlen[toggle] = 0;
|
|
||||||
my->mc_olen[toggle] = 0;
|
|
||||||
my->mc_toggle = toggle;
|
my->mc_toggle = toggle;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -8134,6 +8132,10 @@ mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags)
|
||||||
int rc, toggle;
|
int rc, toggle;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
/* Empty DB, nothing to do */
|
||||||
|
if (*pg == P_INVALID)
|
||||||
|
return MDB_SUCCESS;
|
||||||
|
|
||||||
mc.mc_snum = 1;
|
mc.mc_snum = 1;
|
||||||
mc.mc_top = 0;
|
mc.mc_top = 0;
|
||||||
mc.mc_txn = txn;
|
mc.mc_txn = txn;
|
||||||
|
|
@ -8307,6 +8309,7 @@ mdb_env_copyfd2(MDB_env *env, HANDLE fd)
|
||||||
my.mc_env = env;
|
my.mc_env = env;
|
||||||
my.mc_fd = fd;
|
my.mc_fd = fd;
|
||||||
pthread_mutex_lock(&my.mc_mutex[0]);
|
pthread_mutex_lock(&my.mc_mutex[0]);
|
||||||
|
THREAD_CREATE(thr, mdb_env_copythr, &my);
|
||||||
|
|
||||||
/* Do the lock/unlock of the reader mutex before starting the
|
/* Do the lock/unlock of the reader mutex before starting the
|
||||||
* write txn. Otherwise other read txns could block writers.
|
* write txn. Otherwise other read txns could block writers.
|
||||||
|
|
@ -8365,7 +8368,6 @@ mdb_env_copyfd2(MDB_env *env, HANDLE fd)
|
||||||
}
|
}
|
||||||
my.mc_wlen[0] = env->me_psize * 2;
|
my.mc_wlen[0] = env->me_psize * 2;
|
||||||
my.mc_txn = txn;
|
my.mc_txn = txn;
|
||||||
THREAD_CREATE(thr, mdb_env_copythr, &my);
|
|
||||||
rc = mdb_env_cwalk(&my, &txn->mt_dbs[1].md_root, 0);
|
rc = mdb_env_cwalk(&my, &txn->mt_dbs[1].md_root, 0);
|
||||||
if (rc == MDB_SUCCESS && my.mc_wlen[my.mc_toggle])
|
if (rc == MDB_SUCCESS && my.mc_wlen[my.mc_toggle])
|
||||||
rc = mdb_env_cthr_toggle(&my);
|
rc = mdb_env_cthr_toggle(&my);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue