]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
ReplicatedBackend,MOSDRepOp: replace pg_roll_forward_to with mlcod
authorSamuel Just <sjust@redhat.com>
Fri, 13 Dec 2019 20:54:28 +0000 (12:54 -0800)
committerSamuel Just <sjust@redhat.com>
Fri, 20 Dec 2019 01:35:36 +0000 (17:35 -0800)
New clients will ignore the field on header.version <= 2.  New
primaries will send the old variant if there are peers expecting
the old variant.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/include/ceph_features.h
src/messages/MOSDRepOp.h
src/osd/ReplicatedBackend.cc
src/osd/ReplicatedBackend.h

index ecac82ba0085684cee5db805beda61c5ef9c8ba5..714948ae06db27fb51804b380deeb1db567409c5 100644 (file)
@@ -103,6 +103,7 @@ DEFINE_CEPH_FEATURE(15, 1, MONENC)
 DEFINE_CEPH_FEATURE_RETIRED(16, 1, QUERY_T, JEWEL, LUMINOUS)
 
 DEFINE_CEPH_FEATURE(16, 3, SERVER_OCTOPUS)
+DEFINE_CEPH_FEATURE(16, 3, OSD_REPOP_MLCOD)
 DEFINE_CEPH_FEATURE_RETIRED(17, 1, INDEP_PG_MAP, JEWEL, LUMINOUS)
 
 DEFINE_CEPH_FEATURE(17, 3, OS_PERF_STAT_NS)
@@ -244,6 +245,7 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin
         CEPH_FEATURE_CEPHX_V2 | \
         CEPH_FEATURE_OSD_PGLOG_HARDLIMIT | \
         CEPH_FEATUREMASK_SERVER_OCTOPUS | \
+        CEPH_FEATUREMASK_OSD_REPOP_MLCOD | \
         0ULL)
 
 #define CEPH_FEATURES_SUPPORTED_DEFAULT  CEPH_FEATURES_ALL
index b998eedd2a63eec85dae64fdf6c3fb583361ab97..cd8f2a5a575f9d8c74719c94855c1e0d77e0f18c 100644 (file)
@@ -24,7 +24,7 @@
 
 class MOSDRepOp : public MOSDFastDispatchOp {
 private:
-  static constexpr int HEAD_VERSION = 2;
+  static constexpr int HEAD_VERSION = 3;
   static constexpr int COMPAT_VERSION = 1;
 
 public:
@@ -54,8 +54,7 @@ public:
 
   // piggybacked osd/og state
   eversion_t pg_trim_to;   // primary->replica: trim to here
-  eversion_t pg_roll_forward_to;   // primary->replica: trim rollback
-                                    // info to here
+  eversion_t min_last_complete_ondisk; // lower bound on committed version
 
   hobject_t new_temp_oid;      ///< new temp object that we must now start tracking
   hobject_t discard_temp_oid;  ///< previously used temp object that we can now stop tracking
@@ -110,7 +109,15 @@ public:
 
     decode(from, p);
     decode(updated_hit_set_history, p);
-    decode(pg_roll_forward_to, p);
+
+    if (header.version >= 3) {
+      decode(min_last_complete_ondisk, p);
+    } else {
+      /* This field used to mean pg_roll_foward_to, but ReplicatedBackend
+       * simply assumes that we're rolling foward to version. */
+      eversion_t pg_roll_forward_to;
+      decode(pg_roll_forward_to, p);
+    }
     final_decode_needed = false;
   }
 
@@ -137,7 +144,7 @@ public:
     encode(discard_temp_oid, payload);
     encode(from, payload);
     encode(updated_hit_set_history, payload);
-    encode(pg_roll_forward_to, payload);
+    encode(min_last_complete_ondisk, payload);
   }
 
   MOSDRepOp()
@@ -159,6 +166,11 @@ public:
       version(v) {
     set_tid(rtid);
   }
+
+  void set_rollback_to(const eversion_t &rollback_to) {
+    header.version = 2;
+    min_last_complete_ondisk = rollback_to;
+  }
 private:
   ~MOSDRepOp() override {}
 
@@ -171,6 +183,11 @@ public:
       out << " " << poid << " v " << version;
       if (updated_hit_set_history)
         out << ", has_updated_hit_set_history";
+      if (header.version < 3) {
+       out << ", rollback_to(legacy)=" << min_last_complete_ondisk;
+      } else {
+       out << ", mlcod=" << min_last_complete_ondisk;
+      }
     }
     out << ")";
   }
index 8828b38e46b36e72fbf6f4ff3a62645f4be49a36..2f82da28b9977a57b08ec31870f93259add7be0c 100644 (file)
@@ -498,7 +498,7 @@ void ReplicatedBackend::submit_transaction(
     tid,
     reqid,
     trim_to,
-    at_version,
+    min_last_complete_ondisk,
     added.size() ? *(added.begin()) : hobject_t(),
     removed.size() ? *(removed.begin()) : hobject_t(),
     log_entries,
@@ -920,7 +920,7 @@ Message * ReplicatedBackend::generate_subop(
   ceph_tid_t tid,
   osd_reqid_t reqid,
   eversion_t pg_trim_to,
-  eversion_t pg_roll_forward_to,
+  eversion_t min_last_complete_ondisk,
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
   const bufferlist &log_entries,
@@ -956,7 +956,14 @@ Message * ReplicatedBackend::generate_subop(
     wr->pg_stats = get_info().stats;
 
   wr->pg_trim_to = pg_trim_to;
-  wr->pg_roll_forward_to = pg_roll_forward_to;
+
+  if (HAVE_FEATURE(parent->min_peer_features(), OSD_REPOP_MLCOD)) {
+    wr->min_last_complete_ondisk = min_last_complete_ondisk;
+  } else {
+    /* Some replicas need this field to be at_version.  New replicas
+     * will ignore it */
+    wr->set_rollback_to(at_version);
+  }
 
   wr->new_temp_oid = new_temp_oid;
   wr->discard_temp_oid = discard_temp_oid;
@@ -970,7 +977,7 @@ void ReplicatedBackend::issue_op(
   ceph_tid_t tid,
   osd_reqid_t reqid,
   eversion_t pg_trim_to,
-  eversion_t pg_roll_forward_to,
+  eversion_t min_last_complete_ondisk,
   hobject_t new_temp_oid,
   hobject_t discard_temp_oid,
   const vector<pg_log_entry_t> &log_entries,
@@ -1003,7 +1010,7 @@ void ReplicatedBackend::issue_op(
          tid,
          reqid,
          pg_trim_to,
-         pg_roll_forward_to,
+         min_last_complete_ondisk,
          new_temp_oid,
          discard_temp_oid,
          logs,
index 98195ba304ee45cc4dca0b71f4116b864126ba38..1a1d84d28d731b4c2d5916edaa81e0798b738dc3 100644 (file)
@@ -381,7 +381,7 @@ private:
     ceph_tid_t tid,
     osd_reqid_t reqid,
     eversion_t pg_trim_to,
-    eversion_t pg_roll_forward_to,
+    eversion_t min_last_complete_ondisk,
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
     const bufferlist &log_entries,
@@ -395,7 +395,7 @@ private:
     ceph_tid_t tid,
     osd_reqid_t reqid,
     eversion_t pg_trim_to,
-    eversion_t pg_roll_forward_to,
+    eversion_t min_last_complete_ondisk,
     hobject_t new_temp_oid,
     hobject_t discard_temp_oid,
     const vector<pg_log_entry_t> &log_entries,