Loading include/daemon/backend/metadata/parallax_backend.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <spdlog/spdlog.h> #include <daemon/backend/exceptions.hpp> #include <tuple> #include <cstdio> extern "C" { #include <parallax.h> } Loading Loading @@ -145,12 +146,15 @@ public: * Updates the size on the metadata * Operation. E.g., called before a write() call * @param key * @param size * @param io_size * @param offset * @param append * @throws DBException on failure * @return offset where the write operation should start. This is only used * when append is set */ void increase_size_impl(const std::string& key, size_t size, bool append); off_t increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append); /** * Decreases the size on the metadata Loading include/daemon/backend/metadata/rocksdb_backend.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -131,8 +131,10 @@ public: * Operation. E.g., called before a write() call * @param key * @param io_size * @param offset * @param append * @throws DBException on failure * @return offset where the write operation should start. This is only used * when append is set */ off_t increase_size_impl(const std::string& key, size_t io_size, off_t offset, Loading src/daemon/backend/metadata/parallax_backend.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -331,18 +331,21 @@ ParallaxBackend::update_impl(const std::string& old_key, * @param append * @throws DBException on failure */ void ParallaxBackend::increase_size_impl(const std::string& key, size_t size, bool append) { off_t ParallaxBackend::increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append) { lock_guard<recursive_mutex> lock_guard(parallax_mutex_); off_t out_offset = -1; auto value = get(key); // Decompress string Metadata md(value); if(append) size += md.size(); md.size(size); if(append) { out_offset = md.size(); md.size(md.size() + io_size); } else md.size(offset + io_size); update(key, key, md.serialize()); return out_offset; } /** Loading src/daemon/backend/metadata/rocksdb_backend.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -214,13 +214,9 @@ RocksDBBackend::update_impl(const std::string& old_key, off_t RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append) { off_t res_offset = -1; off_t out_offset = -1; if(append) { auto merge_id = gkfs::metadata::gen_unique_id(key); // GKFS_METADATA_MOD->log()->info("{}() writing to file {} with // merge_id {} io_size {} offset {} append {}", // __func__, key, merge_id, // io_size, offset, append); // no offset needed because new size is current file size + io_size auto uop = IncreaseSizeOperand(io_size, merge_id, append); auto s = db_->Merge(write_opts_, key, uop.serialize()); Loading @@ -231,7 +227,7 @@ RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, get_impl(key); try { // the offset was added during FullMergeV2() call res_offset = out_offset = GKFS_METADATA_MOD->append_offset_reserve_get_and_erase( merge_id); } catch(std::out_of_range& e) { Loading @@ -249,7 +245,7 @@ RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, throw_status_excpt(s); } } return res_offset; return out_offset; } /** Loading Loading
include/daemon/backend/metadata/parallax_backend.hpp +8 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ #include <spdlog/spdlog.h> #include <daemon/backend/exceptions.hpp> #include <tuple> #include <cstdio> extern "C" { #include <parallax.h> } Loading Loading @@ -145,12 +146,15 @@ public: * Updates the size on the metadata * Operation. E.g., called before a write() call * @param key * @param size * @param io_size * @param offset * @param append * @throws DBException on failure * @return offset where the write operation should start. This is only used * when append is set */ void increase_size_impl(const std::string& key, size_t size, bool append); off_t increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append); /** * Decreases the size on the metadata Loading
include/daemon/backend/metadata/rocksdb_backend.hpp +3 −1 Original line number Diff line number Diff line Loading @@ -131,8 +131,10 @@ public: * Operation. E.g., called before a write() call * @param key * @param io_size * @param offset * @param append * @throws DBException on failure * @return offset where the write operation should start. This is only used * when append is set */ off_t increase_size_impl(const std::string& key, size_t io_size, off_t offset, Loading
src/daemon/backend/metadata/parallax_backend.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -331,18 +331,21 @@ ParallaxBackend::update_impl(const std::string& old_key, * @param append * @throws DBException on failure */ void ParallaxBackend::increase_size_impl(const std::string& key, size_t size, bool append) { off_t ParallaxBackend::increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append) { lock_guard<recursive_mutex> lock_guard(parallax_mutex_); off_t out_offset = -1; auto value = get(key); // Decompress string Metadata md(value); if(append) size += md.size(); md.size(size); if(append) { out_offset = md.size(); md.size(md.size() + io_size); } else md.size(offset + io_size); update(key, key, md.serialize()); return out_offset; } /** Loading
src/daemon/backend/metadata/rocksdb_backend.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -214,13 +214,9 @@ RocksDBBackend::update_impl(const std::string& old_key, off_t RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, off_t offset, bool append) { off_t res_offset = -1; off_t out_offset = -1; if(append) { auto merge_id = gkfs::metadata::gen_unique_id(key); // GKFS_METADATA_MOD->log()->info("{}() writing to file {} with // merge_id {} io_size {} offset {} append {}", // __func__, key, merge_id, // io_size, offset, append); // no offset needed because new size is current file size + io_size auto uop = IncreaseSizeOperand(io_size, merge_id, append); auto s = db_->Merge(write_opts_, key, uop.serialize()); Loading @@ -231,7 +227,7 @@ RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, get_impl(key); try { // the offset was added during FullMergeV2() call res_offset = out_offset = GKFS_METADATA_MOD->append_offset_reserve_get_and_erase( merge_id); } catch(std::out_of_range& e) { Loading @@ -249,7 +245,7 @@ RocksDBBackend::increase_size_impl(const std::string& key, size_t io_size, throw_status_excpt(s); } } return res_offset; return out_offset; } /** Loading