mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Merge remote-tracking branch 'origin/mdb.master'
This commit is contained in:
commit
96bf741367
@ -2078,14 +2078,6 @@ mdb_txn_renew0(MDB_txn *txn)
|
||||
pid_t pid = env->me_pid;
|
||||
pthread_t tid = pthread_self();
|
||||
|
||||
LOCK_MUTEX_R(env);
|
||||
for (i=0; i<env->me_txns->mti_numreaders; i++)
|
||||
if (env->me_txns->mti_readers[i].mr_pid == 0)
|
||||
break;
|
||||
if (i == env->me_maxreaders) {
|
||||
UNLOCK_MUTEX_R(env);
|
||||
return MDB_READERS_FULL;
|
||||
}
|
||||
if (!(env->me_flags & MDB_LIVE_READER)) {
|
||||
rc = mdb_reader_pid(env, Pidset, pid);
|
||||
if (rc) {
|
||||
@ -2094,6 +2086,15 @@ mdb_txn_renew0(MDB_txn *txn)
|
||||
}
|
||||
env->me_flags |= MDB_LIVE_READER;
|
||||
}
|
||||
|
||||
LOCK_MUTEX_R(env);
|
||||
for (i=0; i<env->me_txns->mti_numreaders; i++)
|
||||
if (env->me_txns->mti_readers[i].mr_pid == 0)
|
||||
break;
|
||||
if (i == env->me_maxreaders) {
|
||||
UNLOCK_MUTEX_R(env);
|
||||
return MDB_READERS_FULL;
|
||||
}
|
||||
env->me_txns->mti_readers[i].mr_pid = pid;
|
||||
env->me_txns->mti_readers[i].mr_tid = tid;
|
||||
if (i >= env->me_txns->mti_numreaders)
|
||||
@ -8091,11 +8092,13 @@ int mdb_reader_check(MDB_env *env, int *dead)
|
||||
if (mdb_pid_insert(pids, pid) == 0) {
|
||||
if (mdb_reader_pid(env, Pidcheck, pid)) {
|
||||
LOCK_MUTEX_R(env);
|
||||
for (j=i; j<rdrs; j++)
|
||||
if (mr[j].mr_pid == pid) {
|
||||
mr[j].mr_pid = 0;
|
||||
count++;
|
||||
}
|
||||
if (mdb_reader_pid(env, Pidcheck, pid)) {
|
||||
for (j=i; j<rdrs; j++)
|
||||
if (mr[j].mr_pid == pid) {
|
||||
mr[j].mr_pid = 0;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
UNLOCK_MUTEX_R(env);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user