mirror of https://gitee.com/bigwinds/arangodb
Fix another deadlock.
This commit is contained in:
parent
c9b2884def
commit
f075ba8ae6
|
@ -120,17 +120,22 @@ void ClusterState::loadShardInformation () {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ClusterState::getServerEndpoint (ServerID const& serverID) {
|
std::string ClusterState::getServerEndpoint (ServerID const& serverID) {
|
||||||
READ_LOCKER(lock);
|
int tries = 0;
|
||||||
map<ServerID,string>::iterator i = serverAddresses.find(serverID);
|
|
||||||
if (i != serverAddresses.end()) {
|
while (++tries < 3) {
|
||||||
return i->second;
|
{
|
||||||
|
READ_LOCKER(lock);
|
||||||
|
map<ServerID,string>::iterator i = serverAddresses.find(serverID);
|
||||||
|
if (i != serverAddresses.end()) {
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// must call loadServerInformation outside the lock
|
||||||
|
loadServerInformation();
|
||||||
}
|
}
|
||||||
loadServerInformation();
|
|
||||||
i = serverAddresses.find(serverID);
|
return std::string("");
|
||||||
if (i != serverAddresses.end()) {
|
|
||||||
return i->second;
|
|
||||||
}
|
|
||||||
return string("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerID ClusterState::getResponsibleServer (ShardID const& shardID) {
|
ServerID ClusterState::getResponsibleServer (ShardID const& shardID) {
|
||||||
|
|
Loading…
Reference in New Issue