1
0
Fork 0

Small change in getResponsibleServer to silence warnings.

If getResponsibleServer finds an entry _DBServer001 it simply waits
for half a second and checks again in the agency. This is the right
reaction to a planned leader change.
This commit is contained in:
Max Neunhoeffer 2016-06-21 22:55:46 -07:00
parent 4714f539cd
commit 0dc3b7dd45
1 changed files with 11 additions and 1 deletions

View File

@ -2221,7 +2221,17 @@ std::shared_ptr<std::vector<ServerID>> ClusterInfo::getResponsibleServer(
auto it = _shardIds.find(shardID);
if (it != _shardIds.end()) {
return (*it).second;
auto serverList = (*it).second;
if (serverList != nullptr && serverList->size() > 0 &&
(*serverList)[0].size() > 0 && (*serverList)[0][0] == '_') {
// This is a temporary situation in which the leader has already
// resigned, let's wait half a second and try again.
--tries;
LOG(INFO) << "getResponsibleServer: found resigned leader, waiting for half a second...";
usleep(500000);
} else {
return (*it).second;
}
}
}