diff --git a/.gitignore b/.gitignore index a846ad14829e07c0baada638c54dca62e342bbca..8f57cf301ed50d337ffe96005a8b132119213fde 100644 --- a/.gitignore +++ b/.gitignore @@ -95,3 +95,4 @@ builds/ # Allow users to provide their own CMake presets CMakeUserPresets.json +gkfs/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 37fe10b50db480a93ccd76ac420cc40f9d8dcba9..900ab19aa103f51627942bba7dd6e83cdcf74e24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Export extra user library functions ([!227](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/227)) - Update CLI11 and fmt to avoid cmake errors ([!231])(https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/231)) - Update CLI11 in modules ([!232](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/232)). + - Faster initialization relaying on host_files information instead of server RPC ([!242](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/242)) ### Fixed - Dup3 is supported if O_CLOEXEC is not used (i.e. hexdump) ([!228](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/228)) diff --git a/src/client/preload.cpp b/src/client/preload.cpp index 7f22669e1568531efd550167d3ab2593eb40c340..2950de7a8a42ec042bbe5ccbc5aae1b84fb87d6e 100644 --- a/src/client/preload.cpp +++ b/src/client/preload.cpp @@ -329,13 +329,14 @@ init_environment() { } } - 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."); - } + // 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."); + // } // Initialize random number generator and seed for replica selection // in case of failure, a new replica will be selected if(CTX->get_replicas() > 0) { diff --git a/src/client/preload_util.cpp b/src/client/preload_util.cpp index 74c319bf5b3154d30d0b08dffe3cab98e306a911..c518caa1bcf15e1921bff93822b4041fe5c44424 100644 --- a/src/client/preload_util.cpp +++ b/src/client/preload_util.cpp @@ -166,8 +166,10 @@ load_hostfile(const std::string& path) { path, strerror(errno))); } vector> hosts; - const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", - regex::ECMAScript | regex::optimize); + 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; @@ -185,9 +187,25 @@ 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( @@ -564,4 +582,4 @@ lookup_proxy_addr() { CTX->proxy_host(addr); } -} // namespace gkfs::utils \ No newline at end of file +} // namespace gkfs::utils diff --git a/src/daemon/malleability/malleable_manager.cpp b/src/daemon/malleability/malleable_manager.cpp index 6af7ba34bc1200f1d897c423b5cde350e5211124..184ee44d73b1e653b5deb2f7c2a4a9e70b795197 100644 --- a/src/daemon/malleability/malleable_manager.cpp +++ b/src/daemon/malleability/malleable_manager.cpp @@ -75,8 +75,10 @@ MalleableManager::load_hostfile(const std::string& path) { path, strerror(errno))); } vector> hosts; - const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", - regex::ECMAScript | regex::optimize); + 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; diff --git a/src/daemon/util.cpp b/src/daemon/util.cpp index 7b7165628532f082726d704363fd607adcccc78b..c2e53781dc44a4323c83b57b573f08b2b42d492c 100644 --- a/src/daemon/util.cpp +++ b/src/daemon/util.cpp @@ -47,6 +47,7 @@ #include #include #include +#include using namespace std; @@ -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( diff --git a/src/proxy/util.cpp b/src/proxy/util.cpp index ac963ba8c22e53340e99947017789583f52c4ced..f1542949a0f3fd8da7a2597915bf7f75c82871bb 100644 --- a/src/proxy/util.cpp +++ b/src/proxy/util.cpp @@ -56,8 +56,10 @@ load_hostfile(const std::string& lfpath) { lfpath, strerror(errno))); } vector> hosts; - const regex line_re("^(\\S+)\\s+(\\S+)\\s*(\\S*)$", - regex::ECMAScript | regex::optimize); + 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; @@ -255,4 +257,4 @@ connect_to_hosts(const vector>& hosts) { } } -} // namespace gkfs::util \ No newline at end of file +} // namespace gkfs::util