mirror of https://gitee.com/bigwinds/arangodb
fixed r/w deadlock
This commit is contained in:
parent
c460ab97e9
commit
5a3b49a7bc
|
@ -133,18 +133,22 @@ std::string ClusterState::getServerEndpoint (ServerID const& serverID) {
|
||||||
return string("");
|
return string("");
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerID ClusterState::getResponsibleServer (ShardID const& shardID)
|
ServerID ClusterState::getResponsibleServer (ShardID const& shardID) {
|
||||||
{
|
int tries = 0;
|
||||||
READ_LOCKER(lock);
|
|
||||||
map<ShardID,ServerID>::iterator i = shards.find(shardID);
|
while (++tries < 3) {
|
||||||
if (i != shards.end()) {
|
{
|
||||||
return i->second;
|
READ_LOCKER(lock);
|
||||||
}
|
map<ShardID,ServerID>::iterator i = shards.find(shardID);
|
||||||
loadShardInformation();
|
if (i != shards.end()) {
|
||||||
i = shards.find(shardID);
|
return i->second;
|
||||||
if (i != shards.end()) {
|
}
|
||||||
return i->second;
|
}
|
||||||
|
|
||||||
|
// must call loadShardInformation outside the lock
|
||||||
|
loadShardInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ServerID("");
|
return ServerID("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue