]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages/: accomodate the new past_intervals encoding
authorSamuel Just <sjust@redhat.com>
Fri, 6 Jan 2017 19:50:54 +0000 (11:50 -0800)
committerSage Weil <sage@redhat.com>
Fri, 28 Apr 2017 15:30:38 +0000 (11:30 -0400)
Signed-off-by: Samuel Just <sjust@redhat.com>
src/messages/MOSDPGInfo.h
src/messages/MOSDPGLog.h
src/messages/MOSDPGNotify.h

index dd2f847bf8d3e5376000ea2a5e13bf147e39e42b..f77ec23dff5c46e8bb2bd02e1830c2f6aacd455a 100644 (file)
@@ -20,7 +20,7 @@
 #include "osd/osd_types.h"
 
 class MOSDPGInfo : public Message {
-  static const int HEAD_VERSION = 4;
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 1;
 
   epoch_t epoch;
@@ -74,8 +74,14 @@ public:
     // v2 needs the PastIntervals for each record
     for (vector<pair<pg_notify_t,PastIntervals> >::iterator p = pg_list.begin();
         p != pg_list.end();
-        p++)
-      ::encode(p->second, payload);
+        p++) {
+      if (HAVE_FEATURE(features, SERVER_LUMINOUS)) {
+       ::encode(p->second, payload);
+      } else {
+       header.version = 4;
+       p->second.encode_classic(payload);
+      }
+    }
 
     // v3 needs epoch_sent, query_epoch
     for (vector<pair<pg_notify_t,PastIntervals> >::iterator p = pg_list.begin();
@@ -107,7 +113,11 @@ public:
     if (header.version >= 2) {
       // get the PastIntervals portion
       for (unsigned i=0; i<n; i++) {
-       ::decode(pg_list[i].second, p);
+       if (header.version >= 5) {
+         ::decode(pg_list[i].second, p);
+       } else {
+         pg_list[i].second.decode_classic(p);
+       }
       }
     }
 
index 96427a2acf8f0368b6d51b3fd929457abaf0aef7..194628cdcabc76292a781b74c9f242adfe2d292a 100644 (file)
@@ -20,7 +20,7 @@
 
 class MOSDPGLog : public Message {
 
-  static const int HEAD_VERSION = 4;
+  static const int HEAD_VERSION = 5;
   static const int COMPAT_VERSION = 2;
 
   epoch_t epoch;
@@ -80,7 +80,12 @@ public:
     ::encode(log, payload);
     ::encode(missing, payload);
     ::encode(query_epoch, payload);
-    ::encode(past_intervals, payload);
+    if (HAVE_FEATURE(features, SERVER_LUMINOUS)) {
+      ::encode(past_intervals, payload);
+    } else {
+      header.version = 4;
+      past_intervals.encode_classic(payload);
+    }
     ::encode(to, payload);
     ::encode(from, payload);
   }
@@ -94,7 +99,11 @@ public:
       ::decode(query_epoch, p);
     }
     if (header.version >= 3) {
-      ::decode(past_intervals, p);
+      if (header.version >= 5) {
+       ::decode(past_intervals, p);
+      } else {
+       past_intervals.decode_classic(p);
+      }
     }
     if (header.version >= 4) {
       ::decode(to, p);
index 5f8a84a6b0f40e18902d85a190d5b226ddf15337..700b579d029ddbb7521bab602f9d27e742e90e9c 100644 (file)
@@ -25,7 +25,7 @@
 
 class MOSDPGNotify : public Message {
 
-  static const int HEAD_VERSION = 5;
+  static const int HEAD_VERSION = 6;
   static const int COMPAT_VERSION = 2;
 
   epoch_t epoch;
@@ -78,8 +78,14 @@ public:
     // v3 needs the PastIntervals for each record
     for (vector<pair<pg_notify_t,PastIntervals> >::iterator p = pg_list.begin();
         p != pg_list.end();
-        p++)
-      ::encode(p->second, payload);
+        p++) {
+      if (HAVE_FEATURE(features, SERVER_LUMINOUS)) {
+       ::encode(p->second, payload);
+      } else {
+       header.version = 5;
+       p->second.encode_classic(payload);
+      }
+    }
 
     // v4 needs epoch_sent, query_epoch
     for (vector<pair<pg_notify_t,PastIntervals> >::iterator p = pg_list.begin();
@@ -115,7 +121,11 @@ public:
     if (header.version >= 3) {
       // get the PastIntervals portion
       for (unsigned i=0; i<n; i++) {
-       ::decode(pg_list[i].second, p);
+       if (header.version >= 6) {
+         ::decode(pg_list[i].second, p);
+       } else {
+         pg_list[i].second.decode_classic(p);
+       }
       }
     }