Commit d3af07fc authored by David Auer's avatar David Auer
Browse files

Add print all metadata function

parent 72fe4064
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ public:

    void
    iterate_all();

    void
    print_all();
};

} // namespace gkfs::metadata
+15 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#include <global/metadata.hpp>
#include <global/path_util.hpp>

#include <iostream>

extern "C" {
#include <sys/stat.h>
}
@@ -323,6 +325,19 @@ MetadataDB::iterate_all() {
 * see here: https://github.com/facebook/rocksdb/wiki/RocksDB-Tuning-Guide
 * @param options
 */
void
MetadataDB::print_all() {
    std::string key;
    std::string val;
    // Do RangeScan on parent inode
    auto iter = db->NewIterator(rdb::ReadOptions());
    for (iter->SeekToFirst(); iter->Valid(); iter->Next()) {
        key = iter->key().ToString();
        val = iter->value().ToString();
        std::cout << "Key: " << key << " Value: " << val << "\n";
    }
}

void
MetadataDB::optimize_rocksdb_options(rdb::Options& options) {
    options.max_successive_merges = 128;
+3 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@

#include <daemon/daemon.hpp>
#include <daemon/handler/rpc_defs.hpp>
#include <daemon/backend/metadata/db.hpp>

#include <global/rpc/rpc_types.hpp>
#include <iostream>
@@ -65,6 +66,8 @@ hg_return_t rpc_srv_shuffle_start(hg_handle_t handle) {
    }

    margo_destroy(handle);

    GKFS_DATA->mdb()->print_all();
    return HG_SUCCESS;
}