Commit 9ea69b2a authored by Marc Vef's avatar Marc Vef
Browse files

Ignore self mode to be able to ignore na+sm during psm2

parent 91cb233f
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,8 @@ namespace config {


// writes to dev null instead of chunk space, read is reading /dev/zero
// writes to dev null instead of chunk space, read is reading /dev/zero
constexpr bool limbo_mode = true;
constexpr bool limbo_mode = true;
// ignores self host and will not send RPC to self. Single same node setups will no longer work.
constexpr bool ignore_self = true;


constexpr auto hostfile_path = "./gkfs_hosts.txt";
constexpr auto hostfile_path = "./gkfs_hosts.txt";


+25 −3
Original line number Original line Diff line number Diff line
@@ -197,10 +197,12 @@ void load_hosts() {


    auto local_hostname = gkfs::rpc::get_my_hostname(true);
    auto local_hostname = gkfs::rpc::get_my_hostname(true);
    bool local_host_found = false;
    bool local_host_found = false;
    uint64_t local_host_id = 0;


    std::vector<hermes::endpoint> addrs;
    std::vector<hermes::endpoint> addrs;
    addrs.resize(hosts.size());
    addrs.resize(hosts.size());



    vector<uint64_t> host_ids(hosts.size());
    vector<uint64_t> host_ids(hosts.size());
    // populate vector with [0, ..., host_size - 1]
    // populate vector with [0, ..., host_size - 1]
    ::iota(::begin(host_ids), ::end(host_ids), 0);
    ::iota(::begin(host_ids), ::end(host_ids), 0);
@@ -215,11 +217,28 @@ void load_hosts() {
    ::shuffle(host_ids.begin(), host_ids.end(), g); // Shuffle hosts vector
    ::shuffle(host_ids.begin(), host_ids.end(), g); // Shuffle hosts vector
    // lookup addresses and put abstract server addresses into rpc_addresses
    // lookup addresses and put abstract server addresses into rpc_addresses


    if (gkfs::config::ignore_self) {
        // preconditioner to be able to ignore localhost
        for (const auto& id: host_ids) {
        for (const auto& id: host_ids) {
            const auto& hostname = hosts.at(id).first;
            const auto& hostname = hosts.at(id).first;
        const auto& uri = hosts.at(id).second;
            if (hostname == local_hostname) {
                local_host_found = true;
                local_host_id = id;
                break;
            }
        }
        // put into if
        if (local_host_found) {
            addrs.resize(hosts.size() - 1);
            CTX->local_host_id(0);
            LOG(INFO, "Local host will be ignored with host size - 1.");
        }
    }


        addrs[id] = lookup_endpoint(uri);
    auto addr_cnt = 0;
    for (const auto& id: host_ids) {
        const auto& hostname = hosts.at(id).first;
        const auto& uri = hosts.at(id).second;


        if (!local_host_found && hostname == local_hostname) {
        if (!local_host_found && hostname == local_hostname) {
            LOG(DEBUG, "Found local host: {}", hostname);
            LOG(DEBUG, "Found local host: {}", hostname);
@@ -227,7 +246,10 @@ void load_hosts() {
            local_host_found = true;
            local_host_found = true;
        }
        }


        LOG(DEBUG, "Found peer: {}", addrs[id].to_string());
        addrs[addr_cnt] = lookup_endpoint(uri);

        LOG(DEBUG, "Found peer: {}", addrs[addr_cnt].to_string());
        addr_cnt++;
    }
    }


    if (!local_host_found) {
    if (!local_host_found) {
+0 −2
Original line number Original line Diff line number Diff line
@@ -97,8 +97,6 @@ ChunkStorage::ChunkStorage(string& path, const size_t chunksize) :
        log_->info("{}() Throttle enabled: have '{}' should '{}' in bytes", __func__, throttle_bw_have_,
        log_->info("{}() Throttle enabled: have '{}' should '{}' in bytes", __func__, throttle_bw_have_,
                   throttle_bw_should_);
                   throttle_bw_should_);
    }
    }


    log_->info("{}() Chunk storage initialized with path: '{}'", __func__, root_path_);
    log_->info("{}() Chunk storage initialized with path: '{}'", __func__, root_path_);
}
}