added missing methods (stubs) required for snitch implementation
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com> New in v2: - storage_service: add a non-const version of get_token_metadata(). - get_broadcast_address(): check if net::get_messaging_service().local_is_initialized() before calling net::get_local_messaging_service().listen_address(). - get_broadcast_address(): return an inet_address by value. - system_keyspace: introduce db::system_keyspace::endpoint_dc_rack - fb_utilities: use listen_address as broadcast_address for now
This commit is contained in:
@@ -1035,6 +1035,24 @@ utils::UUID set_local_host_id(const utils::UUID& host_id) {
|
||||
// executeInternal(String.format(req, LOCAL, LOCAL), hostId);
|
||||
return host_id;
|
||||
}
|
||||
|
||||
std::unordered_map<gms::inet_address, endpoint_dc_rack>
|
||||
load_dc_rack_info()
|
||||
{
|
||||
std::unordered_map<gms::inet_address, endpoint_dc_rack> result;
|
||||
#if 0 //TODO
|
||||
for (UntypedResultSet.Row row : executeInternal("SELECT peer, data_center, rack from system." + PEERS))
|
||||
{
|
||||
InetAddress peer = row.getInetAddress("peer");
|
||||
if (row.has("data_center") && row.has("rack"))
|
||||
{
|
||||
Map<String, String> dcRack = new HashMap<>();
|
||||
dcRack.put("data_center", row.getString("data_center"));
|
||||
dcRack.put("rack", row.getString("rack"));
|
||||
result.put(peer, dcRack);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
} // namespace system_keyspace
|
||||
} // namespace db
|
||||
|
||||
@@ -23,9 +23,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include "schema.hh"
|
||||
#include "legacy_schema_tables.hh"
|
||||
#include "utils/UUID.hh"
|
||||
#include "gms/inet_address.hh"
|
||||
|
||||
namespace db {
|
||||
namespace system_keyspace {
|
||||
@@ -51,6 +54,16 @@ extern schema_ptr built_indexes(); // TODO (from Cassandra): make private
|
||||
std::vector<schema_ptr> all_tables();
|
||||
void make(database& db);
|
||||
|
||||
// Endpoint Data Center and Rack names
|
||||
struct endpoint_dc_rack {
|
||||
sstring dc;
|
||||
sstring rack;
|
||||
};
|
||||
/**
|
||||
* Return a map of IP addresses containing a map of dc and rack info
|
||||
*/
|
||||
std::unordered_map<gms::inet_address, endpoint_dc_rack> load_dc_rack_info();
|
||||
|
||||
#if 0
|
||||
|
||||
private static volatile Map<UUID, Pair<ReplayPosition, Long>> truncationRecords;
|
||||
|
||||
@@ -1072,6 +1072,11 @@ public:
|
||||
}
|
||||
}
|
||||
#endif
|
||||
void invalidate_cached_rings() {
|
||||
// TODO:
|
||||
//ringVersion++;
|
||||
//cachedTokenMap.set(null);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -68,6 +68,15 @@ public:
|
||||
const locator::token_metadata& get_token_metadata() const {
|
||||
return _token_metadata;
|
||||
}
|
||||
|
||||
locator::token_metadata& get_token_metadata() {
|
||||
return _token_metadata;
|
||||
}
|
||||
|
||||
void gossip_snitch_info() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
private:
|
||||
inet_address get_broadcast_address() {
|
||||
auto& gossiper = gms::get_local_gossiper();
|
||||
|
||||
@@ -24,12 +24,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <experimental/optional>
|
||||
#include "gms/inet_address.hh"
|
||||
#include "message/messaging_service.hh"
|
||||
|
||||
namespace utils {
|
||||
|
||||
using inet_address = gms::inet_address;
|
||||
|
||||
// FIXME: stub
|
||||
class fb_utilities {
|
||||
public:
|
||||
static const int32_t MAX_UNSIGNED_SHORT = 0xFFFF;
|
||||
|
||||
static const inet_address get_broadcast_address() {
|
||||
static std::experimental::optional<inet_address> broadcast_inet_address;
|
||||
#if 0
|
||||
if (_broadcast_inet_address == nullptr)
|
||||
_broadcast_inet_address = DatabaseDescriptor.getBroadcastAddress() == nullptr
|
||||
? getLocalAddress()
|
||||
: DatabaseDescriptor.getBroadcastAddress();
|
||||
#else
|
||||
// TODO: Remove this when database_descriptor is implemented
|
||||
if (!broadcast_inet_address) {
|
||||
if (net::get_messaging_service().local_is_initialized()) {
|
||||
broadcast_inet_address =
|
||||
net::get_local_messaging_service().listen_address();
|
||||
} else {
|
||||
return inet_address("127.0.0.1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return broadcast_inet_address.value();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user