From 6335bf791003e9e33b2f738ab3da06f3c626537a Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 26 Sep 2017 15:49:11 +0800 Subject: [PATCH] messages/MOSDPGTemp: add `forced` field the monitor is supposed to bypass some checks if `forced` is true. Signed-off-by: Kefu Chai --- src/messages/MOSDPGTemp.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/messages/MOSDPGTemp.h b/src/messages/MOSDPGTemp.h index 3ea7a211c7f..1cdaed9b2c2 100644 --- a/src/messages/MOSDPGTemp.h +++ b/src/messages/MOSDPGTemp.h @@ -23,9 +23,15 @@ class MOSDPGTemp : public PaxosServiceMessage { public: epoch_t map_epoch = 0; map > pg_temp; + bool forced = false; - MOSDPGTemp(epoch_t e) : PaxosServiceMessage(MSG_OSD_PGTEMP, e), map_epoch(e) { } - MOSDPGTemp() : PaxosServiceMessage(MSG_OSD_PGTEMP, 0) {} + MOSDPGTemp(epoch_t e) + : PaxosServiceMessage(MSG_OSD_PGTEMP, e, HEAD_VERSION, COMPAT_VERSION), + map_epoch(e) + {} + MOSDPGTemp() + : MOSDPGTemp(0) + {} private: ~MOSDPGTemp() override {} @@ -34,19 +40,25 @@ public: paxos_encode(); ::encode(map_epoch, payload); ::encode(pg_temp, payload); + ::encode(forced, payload); } void decode_payload() override { bufferlist::iterator p = payload.begin(); paxos_decode(p); ::decode(map_epoch, p); ::decode(pg_temp, p); + if (header.version >= 2) { + ::decode(forced, p); + } } const char *get_type_name() const override { return "osd_pgtemp"; } void print(ostream &out) const override { out << "osd_pgtemp(e" << map_epoch << " " << pg_temp << " v" << version << ")"; } - +private: + static constexpr int HEAD_VERSION = 2; + static constexpr int COMPAT_VERSION = 1; }; #endif