mirror of https://gitee.com/bigwinds/arangodb
Fix deadlock.
This commit is contained in:
parent
6c0eb693a1
commit
03ebd5f613
|
@ -1987,17 +1987,19 @@ Result ClusterInfo::createCollectionsCoordinator(std::string const& databaseName
|
|||
TRI_ASSERT(agencyCallbacks.size() == infos.size());
|
||||
for (size_t i = 0; i < infos.size(); ++i) {
|
||||
if (infos[i].state == ClusterCollectionCreationInfo::INIT) {
|
||||
bool wokenUp = false;
|
||||
{
|
||||
// This one has not responded, wait for it.
|
||||
CONDITION_LOCKER(locker, agencyCallbacks[i]->_cv);
|
||||
bool wokenUp = agencyCallbacks[i]->executeByCallbackOrTimeout(interval);
|
||||
if (wokenUp) {
|
||||
// We got woken up by waittime, not by callback.
|
||||
// Let us check if we skipped other callbacks as well
|
||||
for (; i < infos.size(); ++i) {
|
||||
if (infos[i].state == ClusterCollectionCreationInfo::INIT) {
|
||||
agencyCallbacks[i]->refetchAndUpdate(true, false);
|
||||
}
|
||||
wokenUp = agencyCallbacks[i]->executeByCallbackOrTimeout(interval);
|
||||
}
|
||||
if (wokenUp) {
|
||||
++i;
|
||||
// We got woken up by waittime, not by callback.
|
||||
// Let us check if we skipped other callbacks as well
|
||||
for (; i < infos.size(); ++i) {
|
||||
if (infos[i].state == ClusterCollectionCreationInfo::INIT) {
|
||||
agencyCallbacks[i]->refetchAndUpdate(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue