From 6f12bf27cb91bdbc28108c643012116b127e602b Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Fri, 13 Dec 2019 12:54:28 -0800 Subject: [PATCH] ReplicatedBackend,MOSDRepOp: replace pg_roll_forward_to with mlcod 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 --- src/include/ceph_features.h | 2 ++ src/messages/MOSDRepOp.h | 27 ++++++++++++++++++++++----- src/osd/ReplicatedBackend.cc | 17 ++++++++++++----- src/osd/ReplicatedBackend.h | 4 ++-- 4 files changed, 38 insertions(+), 12 deletions(-) diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index ecac82ba008..714948ae06d 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -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 diff --git a/src/messages/MOSDRepOp.h b/src/messages/MOSDRepOp.h index b998eedd2a6..cd8f2a5a575 100644 --- a/src/messages/MOSDRepOp.h +++ b/src/messages/MOSDRepOp.h @@ -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 << ")"; } diff --git a/src/osd/ReplicatedBackend.cc b/src/osd/ReplicatedBackend.cc index 8828b38e46b..2f82da28b99 100644 --- a/src/osd/ReplicatedBackend.cc +++ b/src/osd/ReplicatedBackend.cc @@ -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 &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, diff --git a/src/osd/ReplicatedBackend.h b/src/osd/ReplicatedBackend.h index 98195ba304e..1a1d84d28d7 100644 --- a/src/osd/ReplicatedBackend.h +++ b/src/osd/ReplicatedBackend.h @@ -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 &log_entries, -- 2.39.5