From 51ffede3e31c3c32f96cf87ddaeb221327c7f2a4 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 24 Jan 2014 11:07:13 -0800 Subject: [PATCH] mon: do not use CEPH_FEATURES_ALL for things that touch the disk We want to encode with our quorum_features instead. Remaining uses of CEPH_FEATURES_ALL are: 1) when the Elector is sharing its supported features 2) in a MonMap function which is used by monmaptool 3) In the Monitor for winning a standalone election, for ephemeral data, and for doing mkfs (when we necessarily don't have quorum_features). 4) When doing ceph-mon --inject-monmap (we don't persist the quorum_features to disk, so we can't use them here). 5) in MMonElection, for doing the default monmap encoding (which is re-encoded later if the final features don't match CEPH_FEATURES_ALL). 6) As the default encode features for the OSDMap (the monitor always supplies quorum_features instead). Signed-off-by: Greg Farnum --- src/messages/MMonElection.h | 2 +- src/mon/Monitor.cc | 4 ++-- src/mon/MonmapMonitor.cc | 2 +- src/mon/OSDMonitor.cc | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/messages/MMonElection.h b/src/messages/MMonElection.h index f1ef1dd792a..e3ccbf3eeb1 100644 --- a/src/messages/MMonElection.h +++ b/src/messages/MMonElection.h @@ -75,7 +75,7 @@ public: } void encode_payload(uint64_t features) { - if (monmap_bl.length() && (features & CEPH_FEATURE_MONENC) == 0) { + if (monmap_bl.length() && (features != CEPH_FEATURES_ALL)) { // reencode old-format monmap MonMap t; t.decode(monmap_bl); diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 205d4908b64..35d880c4559 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -868,7 +868,7 @@ void Monitor::sync_obtain_latest_monmap(bufferlist &bl) dout(1) << __func__ << " obtained monmap e" << latest_monmap.epoch << dendl; - latest_monmap.encode(bl, CEPH_FEATURES_ALL); + latest_monmap.encode(bl, quorum_features); } void Monitor::sync_reset_requester() @@ -2514,7 +2514,7 @@ void Monitor::try_send_message(Message *m, const entity_inst_t& to) dout(10) << "try_send_message " << *m << " to " << to << dendl; bufferlist bl; - encode_message(m, CEPH_FEATURES_ALL, bl); // fixme: assume peers have all features we do. + encode_message(m, quorum_features, bl); messenger->send_message(m, to); diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index 61d85ae96c6..6b4abd58c07 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -203,7 +203,7 @@ bool MonmapMonitor::preprocess_command(MMonCommand *m) assert(p != NULL); if (prefix == "mon getmap") { - p->encode(rdata, CEPH_FEATURES_ALL); + p->encode(rdata, m->get_connection()->get_features()); r = 0; ss << "got monmap epoch " << p->get_epoch(); } else if (prefix == "mon dump") { diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 520f508c153..2171a81b552 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -103,7 +103,7 @@ void OSDMonitor::create_initial() newmap.created = newmap.modified = ceph_clock_now(g_ceph_context); // encode into pending incremental - newmap.encode(pending_inc.fullmap); + newmap.encode(pending_inc.fullmap, mon->quorum_features); } void OSDMonitor::update_from_paxos(bool *need_bootstrap) @@ -203,7 +203,7 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap) // write out the full map for all past epochs bufferlist full_bl; - osdmap.encode(full_bl); + osdmap.encode(full_bl, mon->quorum_features); tx_size += full_bl.length(); put_version_full(t, osdmap.epoch, full_bl); @@ -555,7 +555,7 @@ void OSDMonitor::encode_pending(MonitorDBStore::Transaction *t) // encode assert(get_last_committed() + 1 == pending_inc.epoch); - ::encode(pending_inc, bl, CEPH_FEATURES_ALL); + ::encode(pending_inc, bl, mon->quorum_features); /* put everything in the transaction */ put_version(t, pending_inc.epoch, bl); @@ -2118,7 +2118,7 @@ bool OSDMonitor::preprocess_command(MMonCommand *m) } rdata.append(ds); } else if (prefix == "osd getmap") { - p->encode(rdata); + p->encode(rdata, m->get_connection()->get_features()); ss << "got osdmap epoch " << p->get_epoch(); } else if (prefix == "osd getcrushmap") { p->crush->encode(rdata);