wait on DB resize whilst client(s) are being read
This catches a missed case of the trusted thread (i.e. downstream client) reading.
This commit is contained in:
parent
ff323609b9
commit
08fa5c12fb
|
@ -470,6 +470,9 @@ database_resize(void)
|
|||
log_warn("Cannot cannot acquire lock");
|
||||
return rc;
|
||||
}
|
||||
pthread_mutex_lock(&mutex_clients);
|
||||
while (clients_reading)
|
||||
pthread_cond_wait(&cond_clients, &mutex_clients);
|
||||
if ((rc = mdb_env_set_mapsize(env, DB_INIT_SIZE)) != 0)
|
||||
{
|
||||
err = mdb_strerror(rc);
|
||||
|
@ -492,6 +495,9 @@ database_resize(void)
|
|||
log_warn("Cannot cannot acquire lock");
|
||||
return rc;
|
||||
}
|
||||
pthread_mutex_lock(&mutex_clients);
|
||||
while (clients_reading)
|
||||
pthread_cond_wait(&cond_clients, &mutex_clients);
|
||||
if ((rc = mdb_env_set_mapsize(env, ns)) != 0)
|
||||
{
|
||||
err = mdb_strerror(rc);
|
||||
|
@ -503,6 +509,7 @@ database_resize(void)
|
|||
}
|
||||
return 0;
|
||||
unlock:
|
||||
pthread_mutex_unlock(&mutex_clients);
|
||||
pthread_rwlock_unlock(&rwlock_tx);
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue