Verified Commit 9493f1d5 authored by Tommaso Tocci's avatar Tommaso Tocci
Browse files

remove_node RPC make data removal optional

remove_node RPC can now be used to remove only the metadentry from the
metadata DB without touching the relative data in the ChunkStorage.
parent 8c3e5271
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -37,7 +37,9 @@ MERCURY_GEN_PROC(rpc_stat_out_t, ((hg_int32_t) (err))

MERCURY_GEN_PROC(rpc_rm_node_in_t,
        ((hg_uint64_t) (fuid))\
        ((hg_const_string_t) (path)))
        ((hg_const_string_t) (path))\
        ((hg_bool_t) (remove_md_only))
)

MERCURY_GEN_PROC(rpc_trunc_in_t,
        ((hg_uint64_t) (fuid))\
+4 −3
Original line number Diff line number Diff line
@@ -180,9 +180,10 @@ static hg_return_t rpc_srv_rm_node(hg_handle_t handle) {
        // Remove metadentry if exists on the node
        // and remove all chunks for that file
        remove_node(in.path);
        if (!in.remove_md_only) {
            // destroys all chunks for the path on this node
            ADAFS_DATA->storage()->destroy_chunk_space(in.fuid);
        out.err = 0;
        }out.err = 0;
    } catch (const NotFoundException& e) {
        /* The metadentry was not found on this node,
         * this is not an error. At least one node involved in this
+1 −0
Original line number Diff line number Diff line
@@ -246,6 +246,7 @@ int rpc_send_rm_node(const std::string& path, const fuid_t fuid, const bool remo
        // fill in
        rpc_in[i].path = path.c_str();
        rpc_in[i].fuid = fuid;
        rpc_in[i].remove_md_only = remove_metadentry_only;
        // create handle
        // if only the metadentry needs to removed send one rpc to metadentry's responsible node
        if (remove_metadentry_only)