From 80d848f069b9c5c97a720972f62bbb8eda1d3573 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Tue, 5 Sep 2017 14:16:57 -0700 Subject: [PATCH] osd/PGBackend, MOSDPGRecoveryDelete[Reply]: handle incompatible encoding Handle a pre-luminous encoding without min_epoch for both these messages. Bump the header version, so the simple path of inline decoding works for the future. For 12.2.0 and pre-luminous, we can check the SERVER_LUMINOUS flag on the connection to tell which encoding to use. This is not a cherry-pick from master since all upgrades must stop at luminous, and will use the existing encoding before continuing. Signed-off-by: Josh Durgin --- src/messages/MOSDPGRecoveryDelete.h | 14 +++++++++++--- src/messages/MOSDPGRecoveryDeleteReply.h | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/messages/MOSDPGRecoveryDelete.h b/src/messages/MOSDPGRecoveryDelete.h index 3941f9f53e8..2643acd3764 100644 --- a/src/messages/MOSDPGRecoveryDelete.h +++ b/src/messages/MOSDPGRecoveryDelete.h @@ -5,6 +5,7 @@ #define CEPH_MOSDPGRECOVERYDELETE_H #include "MOSDFastDispatchOp.h" +#include "include/ceph_features.h" /* * instruct non-primary to remove some objects during recovery @@ -12,7 +13,7 @@ struct MOSDPGRecoveryDelete : public MOSDFastDispatchOp { - static const int HEAD_VERSION = 1; + static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; pg_shard_t from; @@ -70,7 +71,9 @@ public: ::encode(from, payload); ::encode(pgid, payload); ::encode(map_epoch, payload); - ::encode(min_epoch, payload); + if (HAVE_FEATURE(features, SERVER_LUMINOUS)) { + ::encode(min_epoch, payload); + } ::encode(cost, payload); ::encode(objects, payload); } @@ -79,7 +82,12 @@ public: ::decode(from, p); ::decode(pgid, p); ::decode(map_epoch, p); - ::decode(min_epoch, p); + if (header.version == 1 && + !HAVE_FEATURE(get_connection()->get_features(), SERVER_LUMINOUS)) { + min_epoch = map_epoch; + } else { + ::decode(min_epoch, p); + } ::decode(cost, p); ::decode(objects, p); } diff --git a/src/messages/MOSDPGRecoveryDeleteReply.h b/src/messages/MOSDPGRecoveryDeleteReply.h index fe936388da9..b4f835edb30 100644 --- a/src/messages/MOSDPGRecoveryDeleteReply.h +++ b/src/messages/MOSDPGRecoveryDeleteReply.h @@ -5,9 +5,10 @@ #define MOSDRECOVERYDELETEREPLY_H #include "MOSDFastDispatchOp.h" +#include "include/ceph_features.h" struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp { - static const int HEAD_VERSION = 1; + static const int HEAD_VERSION = 2; static const int COMPAT_VERSION = 1; pg_shard_t from; @@ -34,7 +35,12 @@ struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp { bufferlist::iterator p = payload.begin(); ::decode(pgid.pgid, p); ::decode(map_epoch, p); - ::decode(min_epoch, p); + if (header.version == 1 && + !HAVE_FEATURE(get_connection()->get_features(), SERVER_LUMINOUS)) { + min_epoch = map_epoch; + } else { + ::decode(min_epoch, p); + } ::decode(objects, p); ::decode(pgid.shard, p); ::decode(from, p); @@ -43,7 +49,9 @@ struct MOSDPGRecoveryDeleteReply : public MOSDFastDispatchOp { void encode_payload(uint64_t features) override { ::encode(pgid.pgid, payload); ::encode(map_epoch, payload); - ::encode(min_epoch, payload); + if (HAVE_FEATURE(features, SERVER_LUMINOUS)) { + ::encode(min_epoch, payload); + } ::encode(objects, payload); ::encode(pgid.shard, payload); ::encode(from, payload); -- 2.47.3