token_metadata: Move update_host_id to source file

This commit is contained in:
Asias He
2015-06-01 11:33:11 +08:00
parent 40bf00bdb1
commit 05939af7c7
2 changed files with 24 additions and 22 deletions

View File

@@ -138,4 +138,27 @@ void token_metadata::debug_show() {
reporter->arm_periodic(std::chrono::seconds(1));
}
void token_metadata::update_host_id(const UUID& host_id, inet_address endpoint) {
#if 0
assert host_id != null;
assert endpoint != null;
InetAddress storedEp = _endpoint_to_host_id_map.inverse().get(host_id);
if (storedEp != null) {
if (!storedEp.equals(endpoint) && (FailureDetector.instance.isAlive(storedEp))) {
throw new RuntimeException(String.format("Host ID collision between active endpoint %s and %s (id=%s)",
storedEp,
endpoint,
host_id));
}
}
UUID storedId = _endpoint_to_host_id_map.get(endpoint);
// if ((storedId != null) && (!storedId.equals(host_id)))
logger.warn("Changing {}'s host ID from {} to {}", endpoint, storedId, host_id);
#endif
_endpoint_to_host_id_map[endpoint] = host_id;
}
}

View File

@@ -251,28 +251,7 @@ public:
* @param hostId
* @param endpoint
*/
void update_host_id(const UUID& host_id, inet_address endpoint) {
#if 0
assert host_id != null;
assert endpoint != null;
InetAddress storedEp = _endpoint_to_host_id_map.inverse().get(host_id);
if (storedEp != null) {
if (!storedEp.equals(endpoint) && (FailureDetector.instance.isAlive(storedEp))) {
throw new RuntimeException(String.format("Host ID collision between active endpoint %s and %s (id=%s)",
storedEp,
endpoint,
host_id));
}
}
UUID storedId = _endpoint_to_host_id_map.get(endpoint);
// if ((storedId != null) && (!storedId.equals(host_id)))
logger.warn("Changing {}'s host ID from {} to {}", endpoint, storedId, host_id);
#endif
_endpoint_to_host_id_map[endpoint] = host_id;
}
void update_host_id(const UUID& host_id, inet_address endpoint);
#if 0
/** Return the unique host ID for an end-point. */
public UUID getHostId(InetAddress endpoint)