1
0
Fork 0

Fix another deadlock.

This commit is contained in:
Max Neunhoeffer 2013-12-27 09:13:09 +01:00
parent c9b2884def
commit f075ba8ae6
1 changed files with 15 additions and 10 deletions

View File

@ -120,17 +120,22 @@ void ClusterState::loadShardInformation () {
}
std::string ClusterState::getServerEndpoint (ServerID const& serverID) {
READ_LOCKER(lock);
map<ServerID,string>::iterator i = serverAddresses.find(serverID);
if (i != serverAddresses.end()) {
return i->second;
int tries = 0;
while (++tries < 3) {
{
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);
if (i != serverAddresses.end()) {
return i->second;
}
return string("");
return std::string("");
}
ServerID ClusterState::getResponsibleServer (ShardID const& shardID) {