]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: add merge_delete
authorManali Kulkarni <Manali.Kulkarni@sandisk.com>
Tue, 27 Sep 2016 14:20:56 +0000 (10:20 -0400)
committerSage Weil <sage@redhat.com>
Tue, 27 Sep 2016 15:56:43 +0000 (11:56 -0400)
Signed-off-by: Manali Kulkarni <Manali.Kulkarni@sandisk.com>
src/os/ObjectStore.h

index f714e771c89f82b7672653a99577cbdc60dbcfcf..36bbd125d857ab09d95ad66d0dedffc49851d563 100644 (file)
@@ -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 <src offset, dest offset, len>
     };
 
     // 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<string,bufferlist>& aset) {
         ::decode(aset, data_bl_p);
       }
+      void decode_move_info(vector<boost::tuple<uint64_t, uint64_t, uint64_t >>& 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<boost::tuple<uint64_t, uint64_t, uint64_t>>& 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) {