mon/OSDMonitor: fix osdmap encode feature logic

If we are encoding a full map based on an old Incremental that does not
encode the features, fall back to the quorum features or (barring that)
all features.  Do *not* do no features or else we will end up with
encode_client_old which does not even include the extended info and will
cause the mon to crash when decoding.

This was observed when upgading a 0.76 cluster to 0.77 (all mons stopped,
upgraded, and then started)

Reported-by: Aaron Ten Clay <aarontc@aarontc.com>
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2014-02-23 18:23:55 -08:00
parent bcc18d4877
commit 14ea8157eb

View File

@ -203,9 +203,17 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
if (t == NULL)
t = new MonitorDBStore::Transaction;
// write out the full map for all past epochs
// Write out the full map for all past epochs. Encode the full
// map with the same features as the incremental. If we don't
// know, use the quorum features. If we don't know those either,
// encode with all features.
uint64_t f = inc.encode_features;
if (!f)
f = mon->quorum_features;
if (!f)
f = -1;
bufferlist full_bl;
osdmap.encode(full_bl, inc.encode_features);
osdmap.encode(full_bl, f);
tx_size += full_bl.length();
put_version_full(t, osdmap.epoch, full_bl);