diff --git a/arangod/Cluster/ServerState.cpp b/arangod/Cluster/ServerState.cpp index b5950b0b92..b325cd7c65 100644 --- a/arangod/Cluster/ServerState.cpp +++ b/arangod/Cluster/ServerState.cpp @@ -87,6 +87,10 @@ const std::vector ServerState::RoleStr ({ "NONE", "SNGL", "PRMR", "SCND", "CRDN", "AGNT" }); +const std::vector ServerState::RoleStrReadable ({ + "none", "single", "dbserver", "secondary", "coordinator", "agent" + }); + std::string ServerState::roleToString(ServerState::RoleEnum role) { switch (role) { case ROLE_UNDEFINED: @@ -247,8 +251,6 @@ bool ServerState::unregister() { bool ServerState::registerWithRole(ServerState::RoleEnum role, std::string const& myAddress) { - setLocalInfo(RoleStr.at(role) + ":" + myAddress); - if (!getId().empty()) { LOG_TOPIC(INFO, Logger::CLUSTER) << "Registering with role and localinfo. Supplied id is being ignored"; @@ -257,9 +259,12 @@ bool ServerState::registerWithRole(ServerState::RoleEnum role, AgencyComm comm; AgencyCommResult result; - std::string localInfoEncoded = StringUtils::urlEncode(getLocalInfo()); + std::string localInfoEncoded = StringUtils::replace( + StringUtils::urlEncode(getLocalInfo()),"%2E","."); result = comm.getValues("Target/MapLocalToID/" + localInfoEncoded); + LOG(WARN) << "Target/MapLocalToID/" + localInfoEncoded; + std::string id; bool found = true; if (!result.successful()) { @@ -272,6 +277,8 @@ bool ServerState::registerWithRole(ServerState::RoleEnum role, found = false; } else { id = idSlice.copyString(); + LOG(WARN) << "Have ID: " + id; + } } if (!found) { diff --git a/arangod/Cluster/ServerState.h b/arangod/Cluster/ServerState.h index b43f00b026..1a8dea5475 100644 --- a/arangod/Cluster/ServerState.h +++ b/arangod/Cluster/ServerState.h @@ -43,6 +43,7 @@ class ServerState { }; static const std::vector RoleStr; + static const std::vector RoleStrReadable; /// @brief an enum describing the possible states a server can have enum StateEnum {