]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: add feature CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT (1ULL<<47)>>)
authorDong Yuan <yuandong1222@gmail.com>
Wed, 10 Dec 2014 11:56:49 +0000 (11:56 +0000)
committerSage Weil <sage@redhat.com>
Tue, 6 Jan 2015 21:29:41 +0000 (13:29 -0800)
This feature determine whether we use tbl encode for transaction of use
the new map layout.

The primary uses peer_features to determine whether transaction should
use tbl, while the replica just follow the primary.

Change-Id: I92ca6e5b59bd1acde6007ad0dffc085be17accab
Signed-off-by: Dong Yuan <yuandong1222@gmail.com>
src/include/ceph_features.h
src/os/ObjectStore.h
src/osd/ECBackend.cc
src/osd/PGBackend.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedPG.cc
src/osd/ReplicatedPG.h

index a723b97dca48e33e5c585943bbca0d4669b7dab8..0812911455227c018aabd698abf209aa638804a3 100644 (file)
@@ -57,6 +57,7 @@
 #define CEPH_FEATURE_OSD_FADVISE_FLAGS (1ULL<<46)
 #define CEPH_FEATURE_OSD_REPOP         (1ULL<<46)   /* overlap with fadvise */
 #define CEPH_FEATURE_OSD_OBJECT_DIGEST  (1ULL<<46)  /* overlap with fadvise */
+#define CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT (1ULL<<46) /* overlap w/ fadvise */
 #define CEPH_FEATURE_MDS_QUOTA      (1ULL<<47)
 
 #define CEPH_FEATURE_RESERVED2 (1ULL<<61)  /* slow down, we are almost out... */
@@ -139,6 +140,7 @@ static inline unsigned long long ceph_sanitize_features(unsigned long long f) {
         CEPH_FEATURE_OSD_FADVISE_FLAGS |     \
          CEPH_FEATURE_OSD_REPOP |   \
         CEPH_FEATURE_OSD_OBJECT_DIGEST |    \
+         CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT |   \
         CEPH_FEATURE_MDS_QUOTA | \
         0ULL)
 
index f7c1970c7d32662c9d084c39e2c2c6ac38284743..dde987431cd0aa80712b03798665ae948509db40 100644 (file)
@@ -507,9 +507,15 @@ public:
     void set_fadvise_flag(uint32_t flag) {
       data.fadvise_flags = data.fadvise_flags | flag;
     }
-
     uint32_t get_fadvise_flags() { return data.fadvise_flags; }
 
+    void set_use_tbl(bool value) {
+      use_tbl = value;
+    }
+    bool get_use_tbl() {
+      return use_tbl;
+    }
+
     void swap(Transaction& other) {
       std::swap(data, other.data);
       std::swap(on_applied, other.on_applied);
@@ -1506,13 +1512,13 @@ public:
     // etc.
     Transaction() :
       osr(NULL),
-      use_tbl(true),
+      use_tbl(false),
       coll_id(0),
       object_id(0) { }
 
     Transaction(bufferlist::iterator &dp) :
       osr(NULL),
-      use_tbl(true),
+      use_tbl(false),
       coll_id(0),
       object_id(0) {
       decode(dp);
@@ -1520,7 +1526,7 @@ public:
 
     Transaction(bufferlist &nbl) :
       osr(NULL),
-      use_tbl(true),
+      use_tbl(false),
       coll_id(0),
       object_id(0) {
       bufferlist::iterator dp = nbl.begin();
index a984887b1837cc83c1760beac8746409297f48da..ca39c20ae95f58a7f7cd3f6f3dad3f6d6ed77e08 100644 (file)
@@ -1516,6 +1516,7 @@ void ECBackend::start_write(Op *op) {
        i != get_parent()->get_actingbackfill_shards().end();
        ++i) {
     trans[i->shard];
+    trans[i->shard].set_use_tbl(parent->transaction_use_tbl());
   }
   op->t->generate_transactions(
     op->unstable_hash_infos,
index 3a99c53832a3983a06d6c6cef6166d5fd378d511..2b2102a1a605adcedfe71280c95d13142ed33eeb 100644 (file)
 
      virtual uint64_t min_peer_features() const = 0;
 
+     virtual bool transaction_use_tbl() = 0;
+
      virtual void send_message_osd_cluster(
        int peer, Message *m, epoch_t from_epoch) = 0;
      virtual void send_message_osd_cluster(
index 13e0852091255573e67934e12d10591598a4b369..3a76a65e458d760ca309013d4683d040cfec07ed 100644 (file)
@@ -313,9 +313,11 @@ class RPGTransaction : public PGBackend::PGTransaction {
       return coll;
   }
 public:
-  RPGTransaction(coll_t coll, coll_t temp_coll)
+  RPGTransaction(coll_t coll, coll_t temp_coll, bool use_tbl)
     : coll(coll), temp_coll(temp_coll), t(new ObjectStore::Transaction), written(0)
-    {}
+    {
+      t->set_use_tbl(use_tbl);
+    }
 
   /// Yields ownership of contained transaction
   ObjectStore::Transaction *get_transaction() {
@@ -489,7 +491,7 @@ public:
 
 PGBackend::PGTransaction *ReplicatedBackend::get_transaction()
 {
-  return new RPGTransaction(coll, get_temp_coll());
+  return new RPGTransaction(coll, get_temp_coll(), parent->transaction_use_tbl());
 }
 
 class C_OSD_OnOpCommit : public Context {
@@ -570,6 +572,7 @@ void ReplicatedBackend::submit_transaction(
     op_t);
 
   ObjectStore::Transaction local_t;
+  local_t.set_use_tbl(op_t->get_use_tbl());
   if (t->get_temp_added().size()) {
     get_temp_coll(&local_t);
     add_temp_objs(t->get_temp_added());
index 485e6c1a4bee98e4a2d5950be70d29102c1d082b..e897d6c5922a383987b882b67b23b867550d2c15 100644 (file)
@@ -8222,6 +8222,7 @@ void ReplicatedBackend::sub_op_modify_impl(OpRequestRef op)
 
   bufferlist::iterator p = m->get_data().begin();
   ::decode(rm->opt, p);
+  rm->localt.set_use_tbl(rm->opt.get_use_tbl());
 
   if (m->new_temp_oid != hobject_t()) {
     dout(20) << __func__ << " start tracking temp " << m->new_temp_oid << dendl;
index 687455826b3ac983061af8017be462dc7be8510c..53480e0271b91ad05a2d525c95f4e802006c96e2 100644 (file)
@@ -418,6 +418,11 @@ public:
     return get_min_peer_features();
   }
 
+  bool transaction_use_tbl() {
+    uint64_t min_features = get_min_peer_features();
+    return !(min_features & CEPH_FEATURE_OSD_TRANSACTION_MAY_LAYOUT);
+  }
+
   void send_message_osd_cluster(
     int peer, Message *m, epoch_t from_epoch);
   void send_message_osd_cluster(