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 <greg@inktank.com>
This commit is contained in:
Greg Farnum 2014-01-24 11:07:13 -08:00
parent 3d4a6739f2
commit 51ffede3e3
4 changed files with 8 additions and 8 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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") {

View File

@ -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);