Loading src/client/preload.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -329,13 +329,13 @@ init_environment() { } } LOG(INFO, "Retrieving file system configuration..."); // LOG(INFO, "Retrieving file system configuration..."); if(!gkfs::rpc::forward_get_fs_config()) { exit_error_msg( EXIT_FAILURE, "Unable to fetch file system configurations from daemon process through RPC."); } // if(!gkfs::rpc::forward_get_fs_config()) { // exit_error_msg( // EXIT_FAILURE, // "Unable to fetch file system configurations from daemon process through RPC."); // } // Initialize random number generator and seed for replica selection // in case of failure, a new replica will be selected if(CTX->get_replicas() > 0) { Loading src/client/preload_util.cpp +26 −5 Original line number Diff line number Diff line Loading @@ -166,8 +166,10 @@ load_hostfile(const std::string& path) { path, strerror(errno))); } vector<pair<string, string>> hosts; const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", const regex line_re( "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$", regex::ECMAScript | regex::optimize); string line; string host; string uri; Loading @@ -185,9 +187,28 @@ load_hostfile(const std::string& path) { throw runtime_error( fmt::format("unrecognized line format: '{}'", line)); } host = match[1]; uri = match[2]; // match[3] that is the proxy (not used here) hosts.emplace_back(host, uri); // info will be repeated line per line: CTX->mountdir(match[4]); LOG(INFO, "Mountdir: '{}'", CTX->mountdir()); CTX->fs_conf()->rootdir = match[5]; CTX->fs_conf()->atime_state = match[6] == '1'; CTX->fs_conf()->mtime_state = match[7] == '1'; CTX->fs_conf()->ctime_state = match[8] == '1'; CTX->fs_conf()->link_cnt_state = match[9] == '1'; CTX->fs_conf()->blocks_state = match[10] == '1'; // convert match[11] and match[12] to unsigned integers. CTX->fs_conf()->uid = std::stoi(match[11]); CTX->fs_conf()->gid = std::stoi(match[12]); } if(hosts.empty()) { throw runtime_error( Loading src/daemon/util.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ #include <iostream> #include <limits> #include <thread> #include <unistd.h> using namespace std; Loading Loading @@ -114,6 +115,16 @@ populate_hosts_file() { auto line_out = fmt::format("{} {}", hostname, daemon_addr); if(!proxy_addr.empty()) line_out = fmt::format("{} {}", line_out, proxy_addr); if(proxy_addr.empty()) line_out = fmt::format("{} {}", line_out, "NOPROXY"); line_out = fmt::format( "{} {} {} {} {} {} {} {} {} {}", line_out, GKFS_DATA->mountdir(), GKFS_DATA->rootdir(), (int) GKFS_DATA->atime_state(), (int) GKFS_DATA->mtime_state(), (int) GKFS_DATA->ctime_state(), (int) GKFS_DATA->link_cnt_state(), (int) GKFS_DATA->blocks_state(), getuid(), getgid()); // Constants for retry mechanism const int MAX_RETRIES = 5; // Maximum number of retry attempts const std::chrono::milliseconds RETRY_DELAY( Loading src/proxy/util.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ load_hostfile(const std::string& lfpath) { lfpath, strerror(errno))); } vector<pair<string, string>> hosts; const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", const regex line_re( "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$", regex::ECMAScript | regex::optimize); string line; string host; string uri; Loading Loading
src/client/preload.cpp +6 −6 Original line number Diff line number Diff line Loading @@ -329,13 +329,13 @@ init_environment() { } } LOG(INFO, "Retrieving file system configuration..."); // LOG(INFO, "Retrieving file system configuration..."); if(!gkfs::rpc::forward_get_fs_config()) { exit_error_msg( EXIT_FAILURE, "Unable to fetch file system configurations from daemon process through RPC."); } // if(!gkfs::rpc::forward_get_fs_config()) { // exit_error_msg( // EXIT_FAILURE, // "Unable to fetch file system configurations from daemon process through RPC."); // } // Initialize random number generator and seed for replica selection // in case of failure, a new replica will be selected if(CTX->get_replicas() > 0) { Loading
src/client/preload_util.cpp +26 −5 Original line number Diff line number Diff line Loading @@ -166,8 +166,10 @@ load_hostfile(const std::string& path) { path, strerror(errno))); } vector<pair<string, string>> hosts; const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", const regex line_re( "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$", regex::ECMAScript | regex::optimize); string line; string host; string uri; Loading @@ -185,9 +187,28 @@ load_hostfile(const std::string& path) { throw runtime_error( fmt::format("unrecognized line format: '{}'", line)); } host = match[1]; uri = match[2]; // match[3] that is the proxy (not used here) hosts.emplace_back(host, uri); // info will be repeated line per line: CTX->mountdir(match[4]); LOG(INFO, "Mountdir: '{}'", CTX->mountdir()); CTX->fs_conf()->rootdir = match[5]; CTX->fs_conf()->atime_state = match[6] == '1'; CTX->fs_conf()->mtime_state = match[7] == '1'; CTX->fs_conf()->ctime_state = match[8] == '1'; CTX->fs_conf()->link_cnt_state = match[9] == '1'; CTX->fs_conf()->blocks_state = match[10] == '1'; // convert match[11] and match[12] to unsigned integers. CTX->fs_conf()->uid = std::stoi(match[11]); CTX->fs_conf()->gid = std::stoi(match[12]); } if(hosts.empty()) { throw runtime_error( Loading
src/daemon/util.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ #include <iostream> #include <limits> #include <thread> #include <unistd.h> using namespace std; Loading Loading @@ -114,6 +115,16 @@ populate_hosts_file() { auto line_out = fmt::format("{} {}", hostname, daemon_addr); if(!proxy_addr.empty()) line_out = fmt::format("{} {}", line_out, proxy_addr); if(proxy_addr.empty()) line_out = fmt::format("{} {}", line_out, "NOPROXY"); line_out = fmt::format( "{} {} {} {} {} {} {} {} {} {}", line_out, GKFS_DATA->mountdir(), GKFS_DATA->rootdir(), (int) GKFS_DATA->atime_state(), (int) GKFS_DATA->mtime_state(), (int) GKFS_DATA->ctime_state(), (int) GKFS_DATA->link_cnt_state(), (int) GKFS_DATA->blocks_state(), getuid(), getgid()); // Constants for retry mechanism const int MAX_RETRIES = 5; // Maximum number of retry attempts const std::chrono::milliseconds RETRY_DELAY( Loading
src/proxy/util.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -56,8 +56,10 @@ load_hostfile(const std::string& lfpath) { lfpath, strerror(errno))); } vector<pair<string, string>> hosts; const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", const regex line_re( "^(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)$", regex::ECMAScript | regex::optimize); string line; string host; string uri; Loading