1
0
Fork 0

Fixing agency pool update (#5327)

This commit is contained in:
Simon 2018-05-14 18:07:47 +02:00 committed by Jan
parent 2975715edf
commit 4f5defc9ea
2 changed files with 8 additions and 13 deletions

View File

@ -1308,7 +1308,7 @@ void AgencyComm::updateEndpoints(arangodb::velocypack::Slice const& current) {
for (const auto& i : VPackObjectIterator(current)) { for (const auto& i : VPackObjectIterator(current)) {
auto const endpoint = Endpoint::unifiedForm(i.value.copyString()); auto const endpoint = Endpoint::unifiedForm(i.value.copyString());
if (std::find(stored.begin(), stored.end(), endpoint) == stored.end()) { if (std::find(stored.begin(), stored.end(), endpoint) == stored.end()) {
LOG_TOPIC(DEBUG, Logger::AGENCYCOMM) LOG_TOPIC(INFO, Logger::AGENCYCOMM)
<< "Adding endpoint " << endpoint << " to agent pool"; << "Adding endpoint " << endpoint << " to agent pool";
AgencyCommManager::MANAGER->addEndpoint(endpoint); AgencyCommManager::MANAGER->addEndpoint(endpoint);
} }
@ -1321,7 +1321,6 @@ void AgencyComm::updateEndpoints(arangodb::velocypack::Slice const& current) {
<< "Removing endpoint " << i << " from agent pool"; << "Removing endpoint " << i << " from agent pool";
AgencyCommManager::MANAGER->removeEndpoint(i); AgencyCommManager::MANAGER->removeEndpoint(i);
} }
} }

View File

@ -303,9 +303,7 @@ void HeartbeatThread::runDBServer() {
<< "Heartbeat: Could not read from agency!"; << "Heartbeat: Could not read from agency!";
} else { } else {
VPackSlice agentPool = VPackSlice agentPool = result.slice()[0].get(".agency");
result.slice()[0].get(
std::vector<std::string>({".agency","pool"}));
updateAgentPool(agentPool); updateAgentPool(agentPool);
VPackSlice shutdownSlice = VPackSlice shutdownSlice =
@ -487,7 +485,7 @@ void HeartbeatThread::runSingleServer() {
} }
VPackSlice response = result.slice()[0]; VPackSlice response = result.slice()[0];
VPackSlice agentPool = response.get(std::vector<std::string>{".agency", "pool"}); VPackSlice agentPool = response.get(".agency");
updateAgentPool(agentPool); updateAgentPool(agentPool);
VPackSlice shutdownSlice = response.get({AgencyCommManager::path(), "Shutdown"}); VPackSlice shutdownSlice = response.get({AgencyCommManager::path(), "Shutdown"});
@ -728,9 +726,7 @@ void HeartbeatThread::runCoordinator() {
<< result.bodyRef() << ", timeout: " << timeout; << result.bodyRef() << ", timeout: " << timeout;
} else { } else {
VPackSlice agentPool = VPackSlice agentPool = result.slice()[0].get(".agency");
result.slice()[0].get(
std::vector<std::string>({".agency","pool"}));
updateAgentPool(agentPool); updateAgentPool(agentPool);
VPackSlice shutdownSlice = result.slice()[0].get( VPackSlice shutdownSlice = result.slice()[0].get(
@ -1182,10 +1178,10 @@ bool HeartbeatThread::sendServerState() {
} }
void HeartbeatThread::updateAgentPool(VPackSlice const& agentPool) { void HeartbeatThread::updateAgentPool(VPackSlice const& agentPool) {
if (agentPool.isObject() && agentPool.hasKey("size") && if (agentPool.isObject() && agentPool.get("pool").isObject() &&
agentPool.get("size").getUInt() > 1) { agentPool.hasKey("size") && agentPool.get("size").getUInt() > 1) {
_agency.updateEndpoints(agentPool); _agency.updateEndpoints(agentPool.get("pool"));
} else { } else {
LOG_TOPIC(TRACE, arangodb::Logger::FIXME) << "Cannot find an agency persisted in RAFT 8|"; LOG_TOPIC(ERR, Logger::AGENCYCOMM) << "Cannot find an agency persisted in RAFT 8|";
} }
} }