]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PGBackend, MOSDPGRecoveryDelete[Reply]: handle incompatible encoding 17584/head
authorJosh Durgin <jdurgin@redhat.com>
Tue, 5 Sep 2017 21:16:57 +0000 (14:16 -0700)
committerJosh Durgin <jdurgin@redhat.com>
Fri, 8 Sep 2017 16:24:57 +0000 (12:24 -0400)
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 <jdurgin@redhat.com>
src/messages/MOSDPGRecoveryDelete.h
src/messages/MOSDPGRecoveryDeleteReply.h

index 3941f9f53e8c435f01b2a7b9f8e1e653132315a5..2643acd376437903f85ff5f6c71d7953ef57ee85 100644 (file)
@@ -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);
   }
index fe936388da972a0e5c9895392a360ee74102cda4..b4f835edb30c7698df2ab4046532699601f3a718 100644 (file)
@@ -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);