1
0
Fork 0

local databases lookups up 2 keys in agency with checks on both

This commit is contained in:
Kaveh Vahedipour 2016-11-03 15:34:41 +01:00
parent f54f0e5db1
commit d35c6d6dce
1 changed files with 6 additions and 10 deletions

View File

@ -2156,8 +2156,7 @@ void ClusterInfo::loadCurrentCoordinators() {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
static std::string const prefixCurrentDBServers = "Current/DBServers"; static std::string const prefixCurrentDBServers = "Current/DBServers";
static std::string const prefixTargetCleaned = "Target/CleanedOutServers"; static std::string const prefixTarget = "Target";
static std::string const prefixTargetFailed = "Target/FailedServers";
void ClusterInfo::loadCurrentDBServers() { void ClusterInfo::loadCurrentDBServers() {
++_DBServersProt.wantedVersion; // Indicate that after *NOW* somebody has to ++_DBServersProt.wantedVersion; // Indicate that after *NOW* somebody has to
@ -2172,10 +2171,9 @@ void ClusterInfo::loadCurrentDBServers() {
// Now contact the agency: // Now contact the agency:
AgencyCommResult result = _agency.getValues(prefixCurrentDBServers); AgencyCommResult result = _agency.getValues(prefixCurrentDBServers);
AgencyCommResult failed = _agency.getValues(prefixTargetFailed); AgencyCommResult target = _agency.getValues(prefixTarget);
AgencyCommResult cleaned = _agency.getValues(prefixTargetCleaned);
if (result.successful()) { if (result.successful() && target.successful()) {
velocypack::Slice currentDBServers; velocypack::Slice currentDBServers;
velocypack::Slice failedDBServers; velocypack::Slice failedDBServers;
velocypack::Slice cleanedDBServers; velocypack::Slice cleanedDBServers;
@ -2185,14 +2183,12 @@ void ClusterInfo::loadCurrentDBServers() {
result.slice()[0].get(std::vector<std::string>( result.slice()[0].get(std::vector<std::string>(
{AgencyComm::prefix(), "Current", "DBServers"})); {AgencyComm::prefix(), "Current", "DBServers"}));
} }
if (!failed.slice().isNone()) { if (!target.slice().isNone()) {
failedDBServers = failedDBServers =
failed.slice()[0].get(std::vector<std::string>( target.slice()[0].get(std::vector<std::string>(
{AgencyComm::prefix(), "Target", "FailedServers"})); {AgencyComm::prefix(), "Target", "FailedServers"}));
}
if (!cleaned.slice().isNone()) {
cleanedDBServers = cleanedDBServers =
cleaned.slice()[0].get(std::vector<std::string>( target.slice()[0].get(std::vector<std::string>(
{AgencyComm::prefix(), "Target", "CleanedOutServers"})); {AgencyComm::prefix(), "Target", "CleanedOutServers"}));
} }
if (currentDBServers.isObject() && failedDBServers.isObject()) { if (currentDBServers.isObject() && failedDBServers.isObject()) {