1
0
Fork 0

Take out getTargetServerEndpoint.

This used Target/MapIDToEndpoint which is now gone.
This commit is contained in:
Max Neunhoeffer 2016-05-04 11:10:42 +02:00
parent b13b12960b
commit 1b0b9ae5df
4 changed files with 3 additions and 98 deletions

View File

@ -2372,42 +2372,6 @@ std::vector<ServerID> ClusterInfo::getCurrentDBServers() {
return result;
}
////////////////////////////////////////////////////////////////////////////////
/// @brief lookup the server's endpoint by scanning Target/MapIDToEnpdoint for
/// our id
////////////////////////////////////////////////////////////////////////////////
static std::string const prefixTargetServerEndpoint = "Target/MapIDToEndpoint/";
std::string ClusterInfo::getTargetServerEndpoint(ServerID const& serverID) {
AgencyCommResult result;
// fetch value at Target/MapIDToEndpoint
{
AgencyCommLocker locker("Target", "READ");
if (locker.successful()) {
result = _agency.getValues2(prefixTargetServerEndpoint + serverID, false);
}
}
if (result.successful()) {
result.parse(prefixTargetServerEndpoint, false);
// check if we can find ourselves in the list returned by the agency
std::map<std::string, AgencyCommResultEntry>::const_iterator it =
result._values.find(serverID);
if (it != result._values.end()) {
VPackSlice const slice = it->second._vpack->slice();
return arangodb::basics::VelocyPackHelper::getStringValue(slice, "");
}
}
// not found
return "";
}
////////////////////////////////////////////////////////////////////////////////
/// @brief find the servers who are responsible for a shard (one leader
/// and multiple followers)

View File

@ -773,13 +773,6 @@ class ClusterInfo {
std::vector<ServerID> getCurrentDBServers();
//////////////////////////////////////////////////////////////////////////////
/// @brief lookup the server's endpoint by scanning Target/MapIDToEnpdoint for
/// our id
//////////////////////////////////////////////////////////////////////////////
std::string getTargetServerEndpoint(ServerID const&);
//////////////////////////////////////////////////////////////////////////////
/// @brief find the servers who are responsible for a shard (one leader
/// and possibly multiple followers).

View File

@ -190,16 +190,6 @@ void ServerState::findAndSetRoleBlocking() {
////////////////////////////////////////////////////////////////////////////////
void ServerState::flush() {
{
WRITE_LOCKER(writeLocker, _lock);
if (_id.empty()) {
return;
}
_address = ClusterInfo::instance()->getTargetServerEndpoint(_id);
}
findAndSetRoleBlocking();
}
@ -484,32 +474,8 @@ void ServerState::setDescription(std::string const& description) {
////////////////////////////////////////////////////////////////////////////////
std::string ServerState::getAddress() {
std::string id;
{
READ_LOCKER(readLocker, _lock);
if (!_address.empty()) {
return _address;
}
id = _id;
}
// address not yet set
if (id.empty()) {
return "";
}
// fetch and set the address
std::string const address =
ClusterInfo::instance()->getTargetServerEndpoint(id);
{
WRITE_LOCKER(writeLocker, _lock);
_address = address;
}
return address;
READ_LOCKER(readLocker, _lock);
return _address;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -125,25 +125,6 @@ function ClusterEnabledSuite () {
assertEqual("myself", ss.id());
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test address
////////////////////////////////////////////////////////////////////////////////
testAddress : function () {
assertTrue(agency.set("Target/MapIDToEndpoint/myself", "tcp://127.0.0.1:8529"));
assertTrue(agency.set("Plan/Coordinators/myself", "none"));
assertTrue(agency.set("Plan/DBServers/myself", "other"));
ss.setId("myself");
ss.flush();
assertEqual("tcp://127.0.0.1:8529", ss.address());
assertTrue(agency.set("Target/MapIDToEndpoint/myself", "tcp://127.0.0.1:8530"));
ss.flush();
assertEqual("tcp://127.0.0.1:8530", ss.address());
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test isCluster
////////////////////////////////////////////////////////////////////////////////
@ -399,6 +380,7 @@ function ClusterEnabledSuite () {
last = id;
}
}
};
}