]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: encode canonical full osdmap based on osdmap flags
authorSage Weil <sage@redhat.com>
Fri, 30 Sep 2016 22:02:39 +0000 (18:02 -0400)
committerSage Weil <sage@redhat.com>
Mon, 3 Oct 2016 13:59:30 +0000 (09:59 -0400)
If the JEWEL or KRAKEN flags aren't set, encode the full map without
those features.  This ensure that older OSDs in the cluster will be able
to correctly encode the full map with a matching CRC.  At least, that is
true as long as the encoding changes are guarded by those feature bits.
That appears to be true currently, and we plan to ensure that it is true
in the future as well.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 001575995a4391505ab4dab5fafbb0d8e3959523..9b2354cbc477c2a96339e0d577750c52568024ec 100644 (file)
@@ -1225,8 +1225,21 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
   {
     tmp.deepish_copy_from(osdmap);
     tmp.apply_incremental(pending_inc);
+
+    // determine appropriate features
+    uint64_t features = mon->quorum_features;
+    if (!tmp.test_flag(CEPH_OSDMAP_REQUIRE_JEWEL)) {
+      dout(10) << __func__ << " encoding without feature SERVER_JEWEL" << dendl;
+      features &= ~CEPH_FEATURE_SERVER_JEWEL;
+    }
+    if (!tmp.test_flag(CEPH_OSDMAP_REQUIRE_KRAKEN)) {
+      dout(10) << __func__ << " encoding without feature SERVER_KRAKEN" << dendl;
+      features &= ~CEPH_FEATURE_SERVER_KRAKEN;
+    }
+    dout(10) << __func__ << " encoding full map with " << features << dendl;
+
     bufferlist fullbl;
-    ::encode(tmp, fullbl, mon->quorum_features | CEPH_FEATURE_RESERVED);
+    ::encode(tmp, fullbl, features | CEPH_FEATURE_RESERVED);
     pending_inc.full_crc = tmp.get_crc();
 
     // include full map in the txn.  note that old monitors will