]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Add a new transaction OP (collection hint) to ObjectStore.
authorGuang Yang <yguang@yahoo-inc.com>
Mon, 7 Jul 2014 07:37:02 +0000 (07:37 +0000)
committerGuang Yang <yguang@yahoo-inc.com>
Tue, 19 Aug 2014 07:08:51 +0000 (07:08 +0000)
Signed-off-by: Guang Yang (yguang@yahoo-inc.com)
src/os/ObjectStore.h
src/os/Transaction.cc
src/osd/OSD.cc
src/osd/osd_types.h

index 3a0c1412746a3eca78aed122330cd9ace4ad3865..1c11c0960cac93e3c6aa36e22b4bc67e5e0cb675 100644 (file)
@@ -368,6 +368,7 @@ public:
       OP_COLL_MOVE_RENAME = 38,   // oldcid, oldoid, newcid, newoid
 
       OP_SETALLOCHINT = 39,  // cid, oid, object_size, write_size
+      OP_COLL_HINT = 40, // cid, type, bl
     };
 
   private:
@@ -823,6 +824,24 @@ public:
       ::encode(cid, tbl);
       ops++;
     }
+
+    /**
+     * Give the collection a hint.
+     *
+     * @param cid  - collection id.
+     * @param type - hint type.
+     * @param hint - the hint payload, which contains the customized
+     *               data along with the hint type.
+     */
+     void collection_hint(coll_t cid, uint32_t type, const bufferlist& hint) {
+       __u32 op = OP_COLL_HINT;
+       ::encode(op, tbl);
+       ::encode(cid, tbl);
+       ::encode(type, tbl);
+       ::encode(hint, tbl);
+       ops++;
+     }
+
     /// remove the collection, the collection must be empty
     void remove_collection(coll_t cid) {
       __u32 op = OP_RMCOLL;
index 668b8fb54331ac2c12b551ec0b396f88e9b32202..4bf12fa7af543aa684426ad2fa87df22359b1ac6 100644 (file)
@@ -205,6 +205,16 @@ void ObjectStore::Transaction::dump(ceph::Formatter *f)
       }
       break;
 
+    case Transaction::OP_COLL_HINT:
+      {
+        coll_t cid = i.decode_cid();
+        uint32_t type = i.decode_u32();
+        f->dump_string("op_name", "coll_hint");
+        f->dump_stream("collection") << cid;
+        f->dump_unsigned("type", type);
+      }
+      break;
+
     case Transaction::OP_RMCOLL:
       {
        coll_t cid = i.decode_cid();
index a9b40026cb0f50c609f7fa052b17da20e93e33f6..b4149b604717c88166bfa4e804cbbd7a0be141ab 100644 (file)
@@ -157,6 +157,7 @@ CompatSet OSD::get_osd_initial_compat_set() {
   ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_LEVELDBINFO);
   ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_LEVELDBLOG);
   ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_SNAPMAPPER);
+  ceph_osd_feature_incompat.insert(CEPH_OSD_FEATURE_INCOMPAT_HINTS);
   return CompatSet(ceph_osd_feature_compat, ceph_osd_feature_ro_compat,
                   ceph_osd_feature_incompat);
 }
index deb30f480cbc7b130282efc748e630c9ed3b837d..4dab643f137e82d293ce0ee56f4de03022f4b105 100644 (file)
@@ -54,6 +54,7 @@
 #define CEPH_OSD_FEATURE_INCOMPAT_LEVELDBLOG CompatSet::Feature(9, "leveldblog")
 #define CEPH_OSD_FEATURE_INCOMPAT_SNAPMAPPER CompatSet::Feature(10, "snapmapper")
 #define CEPH_OSD_FEATURE_INCOMPAT_SHARDS CompatSet::Feature(11, "sharded objects")
+#define CEPH_OSD_FEATURE_INCOMPAT_HINTS CompatSet::Feature(12, "transaction hints")
 
 
 /// max recovery priority for MBackfillReserve