From: Manali Kulkarni Date: Tue, 27 Sep 2016 14:20:56 +0000 (-0400) Subject: os/ObjectStore: add merge_delete X-Git-Tag: v11.1.0~652^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e15cdb32423244ee23cfce9e4049ff8c25cc6fd8;p=ceph.git os/ObjectStore: add merge_delete Signed-off-by: Manali Kulkarni --- diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index f714e771c89f..36bbd125d857 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -411,6 +411,7 @@ public: OP_COLL_HINT = 40, // cid, type, bl OP_TRY_RENAME = 41, // oldcid, oldoid, newoid + OP_MERGE_DELETE = 42, //move tempobj to base object. cid, oid, newoid, vector of tuple }; // Transaction hint type @@ -690,6 +691,7 @@ public: case OP_CLONERANGE2: case OP_CLONE: + case OP_MERGE_DELETE: assert(op->cid < cm.size()); assert(op->oid < om.size()); assert(op->dest_oid < om.size()); @@ -1001,6 +1003,9 @@ public: void decode_attrset(map& aset) { ::decode(aset, data_bl_p); } + void decode_move_info(vector>& move_info) { + ::decode(move_info, data_bl_p); + } void decode_attrset_bl(bufferlist *pbl) { decode_str_str_map_to_bl(data_bl_p, pbl); } @@ -1367,6 +1372,28 @@ public: } data.ops++; } + + /* + * Move source object to base object. + * Data portion is only copied from source object to base object. + * The copy is done according to the move_info vector of tuple, which + * has information of src_offset, dest_offset and length. + * Finally, the source object is deleted. + */ + void move_ranges_destroy_src( + const coll_t& cid, + const ghobject_t& src_oid, + ghobject_t oid, + const vector>& move_info) { + Op* _op = _get_next_op(); + _op->op = OP_MERGE_DELETE; + _op->cid = _get_coll_id(cid); + _op->oid = _get_object_id(src_oid); + _op->dest_oid = _get_object_id(oid); + ::encode(move_info, data_bl); + data.ops++; + } + /// Create the collection void create_collection(const coll_t& cid, int bits) { if (use_tbl) {