Commit 0190d1cf authored by Marc Vef's avatar Marc Vef
Browse files

Initial functional checks for communication to expansion thread succeeded

parent c84a5738
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -29,10 +29,15 @@
#ifndef GEKKOFS_COMMON_DEFS_HPP
#define GEKKOFS_COMMON_DEFS_HPP

namespace gkfs {
namespace client {
// This must be equivalent to the line set in the gkfs script
constexpr auto hostsfile_end_str = "#FS_INSTANCE_END";

} // namespace client
namespace rpc {
// These constexpr set the RPC's identity and which handler the receiver end
// should use
namespace gkfs::rpc {

using chnk_id_t = unsigned long;
struct ChunkStat {
    unsigned long chunk_size;
@@ -40,7 +45,6 @@ struct ChunkStat {
    unsigned long chunk_free;
};


namespace tag {

constexpr auto fs_config = "rpc_srv_fs_config";
@@ -103,19 +107,19 @@ constexpr auto all_remote_protocols = {ofi_sockets, ofi_tcp, ofi_verbs,
                                       ucx_rc,      ucx_ud};
#pragma GCC diagnostic pop
} // namespace protocol
} // namespace gkfs::rpc
} // namespace rpc

namespace gkfs::malleable::rpc::tag {
namespace malleable::rpc::tag {
constexpr auto expand_start = "rpc_srv_expand_start";
constexpr auto expand_status = "rpc_srv_expand_status";
constexpr auto expand_finalize = "rpc_srv_expand_finalize";
constexpr auto migrate_metadata = "rpc_srv_migrate_metadata";
constexpr auto migrate_data = "rpc_srv_migrate_data";
} // namespace gkfs::malleable::rpc::tag
} // namespace malleable::rpc::tag

namespace gkfs::config::syscall::stat {
namespace config::syscall::stat {
// Number 512-byte blocks allocated as it is in the linux kernel (struct_stat.h)
constexpr auto st_nblocksize = 512;
} // namespace gkfs::config::syscall::stat

} // namespace config::syscall::stat
} // namespace gkfs
#endif // GEKKOFS_COMMON_DEFS_HPP
+2 −1
Original line number Diff line number Diff line
@@ -43,7 +43,8 @@ wait_for_gkfs_daemons() {
            exit 1
        fi
    done
    echo "# End of current FS instance" >> "${HOSTSFILE}"
    # This must be equivalent to the line set in include/common/common_defs.hpp
    echo "#FS_INSTANCE_END" >> "${HOSTSFILE}"
}
#######################################
# Creates a pid file for a given pid. If pid file exists, we check if its pids are still valid.
+24 −3
Original line number Diff line number Diff line
@@ -28,17 +28,38 @@
*/

#include <client/user_functions.hpp>
#include <client/preload.hpp>
#include <client/rpc/forward_malleability.hpp>
#include <client/logging.hpp>

#include <iostream>

using namespace std;

namespace gkfs::malleable {

int
expand_start(int old_server_conf, int new_server_conf) {
    LOG(INFO, "{}() Expand operation enter", __func__);
    gkfs::malleable::rpc::forward_expand_start(old_server_conf,
    // sanity checks
    if(old_server_conf == new_server_conf) {
        auto err_str =
                "ERR: Old server configuration is the same as the new one";
        cerr << err_str << endl;
        LOG(ERROR, "{}() {}", __func__, err_str);
        return -1;
    }
    if(CTX->hosts().size() != static_cast<uint64_t>(old_server_conf)) {
        auto err_str =
                "ERR: Old server configuration does not match the number of hosts in hostsfile";
        cerr << err_str << endl;
        LOG(ERROR, "{}() {}", __func__, err_str);
        return -1;
    }
    // TODO check that hostsfile contains endmarker
    return gkfs::malleable::rpc::forward_expand_start(old_server_conf,
                                                      new_server_conf);
    return 0;
    //    return 0;
}

int
+5 −5
Original line number Diff line number Diff line
@@ -162,14 +162,14 @@ load_hostfile(const std::string& path) {
    std::smatch match;
    while(getline(lf, line)) {
        // if line starts with #, it indicates the end of current FS instance
        // It is therefore skipped
        if(line[0] == '#')
            continue;
        // Further hosts are not part of the file system instance yet and are
        // therefore skipped The hostfile is ordered, so nothgin below this line
        // can contain valid hosts
        if(line.find(gkfs::client::hostsfile_end_str) != string::npos)
            break;
        if(!regex_match(line, match, line_re)) {

            LOG(ERROR, "Unrecognized line format: [path: '{}', line: '{}']",
                path, line);

            throw runtime_error(
                    fmt::format("unrecognized line format: '{}'", line));
        }
+1 −1
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ MalleableManager::redistribute_metadata() {
    auto percent_interval = estimate_db_size / 1000;
    GKFS_DATA->spdlogger()->info(
            "{}() Starting metadata redistribution for '{}' estimated number of KV pairs...",
            estimate_db_size, __func__);
            __func__, estimate_db_size);
    int migration_err = 0;
    string key, value;
    auto iter =
Loading