Commit d0c0e9ff authored by Ramon Nou's avatar Ramon Nou
Browse files

New parameter to remove rootdir at the end

parent f61afc37
Pipeline #2338 passed with stages
in 29 minutes and 33 seconds
......@@ -87,6 +87,8 @@ gkfwd:
-DGKFS_INSTALL_TESTS:BOOL=ON
-DGKFS_ENABLE_FORWARDING:BOOL=ON
-DGKFS_ENABLE_AGIOS:BOOL=ON
-DGKFS_ENABLE_PARALLAX:BOOL=OFF
-DGKFS_ENABLE_ROCKSDB:BOOL=ON
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH}
${CI_PROJECT_DIR}
- make -j$(nproc) install
......
......@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Support for different databases backend
New Docker Images and scripts (0.9.1)
([!110](https://storage.bsc.es/gitlab/hpc/gekkofs/-/merge_requests/110)).
- Added `--clean-rootdir-finish` argument to remove rootdir/metadir at the end.
## [0.9.0] - 2022-02-22
### New
......
......@@ -104,15 +104,12 @@ Options:
Libfabric must have enabled support verbs or psm2.
--auto-sm Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, instead of using the RPC protocol. (Default off)
-c,--clean-rootdir Cleans Rootdir >before< launching the deamon
-f, --clean-rootdir-finish Cleans Rootdir >After< the deamon finishes
--version Print version and exit.
--dbbackend 'rocksdb' (default) or 'parallaxdb' can be specified as
metadata backend, in that case a file in 'metadir' named
rocksdbx is created. Parallaxdb support is experimental.
--keepmd 'parallaxdb' specific, persist the metadata file
(default off, file is deleted at the end)
--reusemd 'parallaxdb' specific, do not recreate the
metadata file, (default re/create)
--kreonsize 'parallaxdb' specific, size of the metadata file in GB. Minimal is 8 GB
(default 8, 8 GB)
--version Print version and exit.
......@@ -239,7 +236,7 @@ Finally, modify `guided_config.txt` to your distribution requirements.
### Metadata Backends
There are two different metadata backends in GekkoFS. The default one uses `rocksdb`, however an alternative based on `PARALLAX` from `FORTH`
is available.
To enable it use the `-DGKFS_ENABLE_PARALLAX:BOOL=ON` option, you can also disable `rocksdb` with `-DGKFS_ENABLE_ROCKSDB:BOOL=ON`.
To enable it use the `-DGKFS_ENABLE_PARALLAX:BOOL=ON` option, you can also disable `rocksdb` with `-DGKFS_ENABLE_ROCKSDB:BOOL=OFF`.
Once it is enabled, `--dbbackend` option will be functional.
......
......@@ -108,6 +108,11 @@ dependencies:
- `AGIOS <https://github.com/francielizanon/agios>`_ (commit c26a654 or
newer) to enable the :code:`GekkoFWD` I/O forwarding mode.
- `PARALLAX` There are two different metadata backends in GekkoFS. The default one uses `rocksdb`, however an alternative based on `PARALLAX` from `FORTH`
is available. To enable it, use the `-DGKFS_ENABLE_PARALLAX:BOOL=ON` option, you can also disable `rocksdb` with `-DGKFS_ENABLE_ROCKSDB:BOOL=OFF`.
Once it is enabled, `--dbbackend` option will be functional.
.. _step_by_step_installation:
Step-by-step installation
......
......@@ -74,6 +74,12 @@ Further options are available
Libfabric must have enabled support verbs or psm2.
--auto-sm Enables intra-node communication (IPCs) via the `na+sm` (shared memory) protocol, instead of using the RPC protocol. (Default off)
-c,--clean-rootdir Cleans Rootdir >before< launching the deamon
-f,--clean-rootdir-finish Cleans Rootdir >after< finishing the deamon
--dbbackend 'rocksdb' (default) or 'parallaxdb' can be specified as
metadata backend, in that case a file in 'metadir' named
rocksdbx is created. Parallaxdb support is experimental.
--kreonsize 'parallaxdb' specific, size of the metadata file in GB. Minimal is 8 GB
(default 8, 8 GB)
--version Print version and exit.
````
......
......@@ -32,7 +32,6 @@
#include <client/preload.hpp>
#include <common/metadata.hpp>
#include <optional>
#include <string>
#include <iostream>
#include <map>
......
......@@ -37,11 +37,13 @@
#include <daemon/backend/exceptions.hpp>
#include <tuple>
#include <daemon/backend/metadata/metadata_backend.hpp>
#ifdef GKFS_ENABLE_ROCKSDB
#include <daemon/backend/metadata/rocksdb_backend.hpp>
#endif
#ifdef GKFS_ENABLE_PARALLAX
#include <daemon/backend/metadata/parallax_backend.hpp>
#endif
namespace rdb = rocksdb;
namespace gkfs::metadata {
......
......@@ -71,9 +71,9 @@ private:
// Database
std::shared_ptr<gkfs::metadata::MetadataDB> mdb_;
std::string dbbackend_;
bool keep_rootdir_ = true;
// Kreon
bool reuse_md_ = false;
bool keep_md_ = false;
unsigned long long size_md_ = 8589934592ull;
// Storage backend
......@@ -206,16 +206,10 @@ public:
blocks_state(bool blocks_state);
bool
kreon_keep_md() const;
void
kreon_keep_md(bool keep_md);
bool
kreon_reuse_md() const;
keep_rootdir() const;
void
kreon_reuse_md(bool reuse_md);
keep_rootdir(bool keep_rootdir_);
unsigned long long
kreon_size_md() const;
......
Destination path is set to "/home/rnou/depsx"
Profile name: direct
Profile version: 0.9.0-experimental
------------------------------------
Downloaded 'https://github.com/pmodels/argobots/archive/v1.0rc1.tar.gz' to 'argobots'
Cloned 'https://github.com/pmem/syscall_intercept.git' to 'syscall_intercept' with commit '[f7cebb7b7e7512a19b78a31ce236ad6ca22636dd]' and flags ''
Cloned 'https://github.com/CARV-ICS-FORTH/kreon.git' to 'kreon' with commit '[889353d39052f1c4b3bb9f95821e935dc5a5565e]' and flags ''
Downloaded 'https://github.com/facebook/rocksdb/archive/v6.2.2.tar.gz' to 'rocksdb'
Cloned 'https://xgitlab.cels.anl.gov/sds/margo.git' to 'margo' with commit '[v0.6.3]' and flags ''
Cloned 'https://github.com/HowardHinnant/date.git' to 'date' with commit '[e7e1482087f58913b80a20b04d5c58d9d6d90155]' and flags ''
Cloned 'https://github.com/mercury-hpc/mercury' to 'mercury' with commit '[41caa143a07ed179a3149cac4af0dc7aa3f946fd]' and flags '--recurse-submodules'
Done
......@@ -58,12 +58,18 @@ struct MetadataDBFactory {
#else
GKFS_METADATA_MOD->log()->error("PARALLAX not compiled");
exit(EXIT_FAILURE);
#endif
} else if(id == "rocksdb") {
#ifdef GKFS_ENABLE_ROCKSDB
return std::make_unique<RocksDBBackend>(path);
#else
GKFS_METADATA_MOD->log()->error("ROCKSDB not compiled");
exit(EXIT_FAILURE);
#endif
}
// Default rocksdb
return std::make_unique<RocksDBBackend>(path);
GKFS_METADATA_MOD->log()->error("No valid metadata backend selected");
exit(EXIT_FAILURE);
}
};
......
......@@ -52,8 +52,6 @@ namespace gkfs::metadata {
*/
ParallaxBackend::~ParallaxBackend() {
par_close(par_db_);
if(GKFS_DATA->kreon_keep_md() == false)
unlink(par_path_.c_str());
}
/**
......@@ -85,23 +83,15 @@ ParallaxBackend::ParallaxBackend(const std::string& path) {
}
// Check size if we want to reuse it
if(GKFS_DATA->kreon_reuse_md()) {
size = lseek(fd, 0, SEEK_END);
if(size == -1) {
printf("[%s:%s:%d] failed to determine volume size exiting...\n",
__FILE__, __func__, __LINE__);
perror("ioctl");
exit(EXIT_FAILURE);
}
}
if(GKFS_DATA->kreon_reuse_md() && size == 0) {
GKFS_METADATA_MOD->log()->error(
"PARALLAX database reused but size is 0");
size = lseek(fd, 0, SEEK_END);
if(size == -1) {
printf("[%s:%s:%d] failed to determine volume size exiting...\n",
__FILE__, __func__, __LINE__);
perror("ioctl");
exit(EXIT_FAILURE);
}
if(GKFS_DATA->kreon_reuse_md() == false) {
if(size == 0) {
size = GKFS_DATA->kreon_size_md();
lseek(fd, size - 1, SEEK_SET);
......@@ -113,12 +103,6 @@ ParallaxBackend::ParallaxBackend(const std::string& path) {
std::string cmd = "kv_format.parallax --device " + par_path_ +
" --max_regions_num 1 ";
system(cmd.c_str());
/*
fd = open(par_path_.c_str(), O_RDONLY);
size = lseek(fd, 0, SEEK_END);
close(fd);
*/
}
par_options_.create_flag = PAR_CREATE_DB;
......
......@@ -211,23 +211,13 @@ FsData::blocks_state(bool blocks_state) {
}
bool
FsData::kreon_keep_md() const {
return keep_md_;
FsData::keep_rootdir() const {
return keep_rootdir_;
}
void
FsData::kreon_keep_md(bool keep_md) {
FsData::keep_md_ = keep_md;
}
bool
FsData::kreon_reuse_md() const {
return reuse_md_;
}
void
FsData::kreon_reuse_md(bool reuse_md) {
FsData::reuse_md_ = reuse_md;
FsData::keep_rootdir(bool keep_rootdir) {
FsData::keep_rootdir_ = keep_rootdir;
}
unsigned long long
......
......@@ -409,6 +409,19 @@ destroy_enviroment() {
GKFS_DATA->spdlogger()->info("{}() Closing metadata DB", __func__);
GKFS_DATA->close_mdb();
// Delete rootdir/metadir if requested
if(!GKFS_DATA->keep_rootdir()) {
GKFS_DATA->spdlogger()->info("{}() Removing RootDir/MetaDir/MetaFile",
__func__);
fs::remove_all(GKFS_DATA->metadir(), ecode);
#ifdef GKFS_ENABLE_PARALLAX
// some metadata backends uses a file instead of a dir.
fs::remove_all(GKFS_DATA->metadir() + "x", ecode);
#endif
fs::remove_all(GKFS_DATA->rootdir(), ecode);
}
}
/**
......@@ -558,6 +571,11 @@ parse_input(const cli_options& opts, const CLI::App& desc) {
fs::remove_all(rootdir_path.native());
GKFS_DATA->spdlogger()->info("{}() Rootdir cleaned.", __func__);
}
if(desc.count("--clean-rootdir-finish")) {
GKFS_DATA->keep_rootdir(false);
}
GKFS_DATA->spdlogger()->debug("{}() Root directory: '{}'", __func__,
rootdir_path.native());
fs::create_directories(rootdir_path);
......@@ -596,12 +614,6 @@ parse_input(const cli_options& opts, const CLI::App& desc) {
} else
GKFS_DATA->dbbackend("rocksdb");
if(desc.count("--keepmd")) {
GKFS_DATA->kreon_keep_md(true);
}
if(desc.count("--reusemd")) {
GKFS_DATA->kreon_reuse_md(true);
}
if(desc.count("--kreonsize")) { // Size in GB
GKFS_DATA->kreon_size_md(stoi(opts.kreonsize));
}
......@@ -661,16 +673,17 @@ main(int argc, const char* argv[]) {
desc.add_flag(
"--clean-rootdir,-c",
"Cleans Rootdir >before< launching the deamon");
desc.add_flag(
"--clean-rootdir-finish,-f",
"Cleans Rootdir >after< the deamon finishes");
desc.add_option(
"--dbbackend,-d", opts.dbbackend,
"Database Backend to use. If not set, rocksdb is used. For parallaxdb, a file called rocksdb with 8GB is needed in metadir");
desc.add_flag("--keepmd", "Kreondb - Keeps metadir (default off)");
desc.add_flag("--reusemd",
"Kreondb - Avoids initializing the metadata file, (default off)");
"Database Backend to use. If not set, rocksdb is used. For parallaxdb, a file called rocksdbx with 8GB will be created in metadir");
desc.add_option("--kreonsize",opts.kreonsize,
"Kreondb - Metatada file size in GB (default 8), "
"parallaxdb - Metatada file size in GB (default 8), "
"used only with new files");
desc.add_flag("--version", "Print version and exit.");
// clang-format on
try {
......
......@@ -251,7 +251,9 @@ class Daemon:
'--rootdir', self.rootdir,
'-l', self._address,
'--metadir', self._metadir,
'--dbbackend', self._database ]
'--dbbackend', self._database]
if self._database == "parallaxdb" :
args.append('--clean-rootdir-finish')
logger.debug(f"spawning daemon")
logger.debug(f"cmdline: {self._cmd} " + " ".join(map(str, args)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment