From: Sage Weil Date: Wed, 13 Feb 2019 13:29:45 +0000 (-0600) Subject: message/MMonMgrReport: conditionally reencode PGMapDigest X-Git-Tag: v13.2.5~4^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=cb544b0b358dbfe5cc639b9740aee994d84aa0b1;p=ceph.git message/MMonMgrReport: conditionally reencode PGMapDigest The encoding changed between luminous and mimic. Reencode the structure if the target doesn't have all the features. Fixes: http://tracker.ceph.com/issues/38295 Signed-off-by: Sage Weil (cherry picked from commit e4ae368ff7a5396194f8bdd5692429af5457998b) Conflicts: src/CMakeLists.txt src/messages/MMonMgrReport.h - mimic has msgr V1 - do not check SERVER_NAUTILUS on mimic - use begin() instead of cbegin() on mimic --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b56a5f745e61..772da92f29ee 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -468,6 +468,7 @@ set(libcommon_files mon/MonClient.cc mon/MonMap.cc mgr/MgrClient.cc + mon/PGMap.cc msg/simple/Accepter.cc msg/DispatchQueue.cc msg/Message.cc diff --git a/src/messages/MMonMgrReport.h b/src/messages/MMonMgrReport.h index 72bbfe0a72ab..99893e27de61 100644 --- a/src/messages/MMonMgrReport.h +++ b/src/messages/MMonMgrReport.h @@ -19,6 +19,7 @@ #include "include/types.h" #include "include/health.h" #include "mon/health_check.h" +#include "mon/PGMap.h" class MMonMgrReport : public PaxosServiceMessage { @@ -48,6 +49,22 @@ public: paxos_encode(); encode(health_checks, payload); encode(service_map_bl, payload); + + if (!HAVE_FEATURE(features, SERVER_MIMIC)) { + // PGMapDigest had a backwards-incompatible change between + // luminous and mimic, and conditionally encodes based on + // provided features, so reencode the one in our data payload. + // The mgr isn't able to do this at the time the encoded + // PGMapDigest is constructed because we don't know which mon we + // will target. Note that this only triggers if the user + // upgrades ceph-mgr before ceph-mon (tsk tsk). + PGMapDigest digest; + auto p = data.begin(); + decode(digest, p); + bufferlist bl; + encode(digest, bl, features); + data.swap(bl); + } } void decode_payload() override { bufferlist::iterator p = payload.begin(); diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt index c8e2edbd7116..3f89769863ae 100644 --- a/src/mon/CMakeLists.txt +++ b/src/mon/CMakeLists.txt @@ -18,7 +18,6 @@ set(lib_mon_srcs ConfigMonitor.cc Elector.cc HealthMonitor.cc - PGMap.cc ConfigKeyService.cc ../mds/MDSAuthCaps.cc ../mgr/mgr_commands.cc