]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/OSDMonitor: populate Incremental::full_crc
authorSage Weil <sage@redhat.com>
Thu, 21 Aug 2014 16:49:02 +0000 (09:49 -0700)
committerSage Weil <sage@redhat.com>
Mon, 10 Nov 2014 22:20:25 +0000 (14:20 -0800)
When we encode an Incremental, put in the expected crc for the resulting
full OSDMap.

Signed-off-by: Sage Weil <sage@redhat.com>
src/mon/OSDMonitor.cc

index 8efc700c3ee7fbf12a5dbb87d4daa3e22d61d29c..7c6bb75623e44da32477c5b62c82fca37c4e4876 100644 (file)
@@ -111,6 +111,8 @@ void OSDMonitor::create_initial()
 
   // encode into pending incremental
   newmap.encode(pending_inc.fullmap, mon->quorum_features | CEPH_FEATURE_RESERVED);
+  pending_inc.full_crc = newmap.get_crc();
+  dout(20) << " full crc " << pending_inc.full_crc << dendl;
 }
 
 void OSDMonitor::update_from_paxos(bool *need_bootstrap)
@@ -643,10 +645,23 @@ void OSDMonitor::encode_pending(MonitorDBStore::TransactionRef t)
     }
   }
 
+  // determine the new map's crc
+  OSDMap tmp;
+  {
+    tmp.deepish_copy_from(osdmap);
+    tmp.apply_incremental(pending_inc);
+    bufferlist t;
+    ::encode(tmp, t, mon->quorum_features | CEPH_FEATURE_RESERVED);
+    pending_inc.full_crc = tmp.get_crc();
+  }
+
   // encode
   assert(get_last_committed() + 1 == pending_inc.epoch);
   ::encode(pending_inc, bl, mon->quorum_features | CEPH_FEATURE_RESERVED);
 
+  dout(20) << " full_crc " << tmp.get_crc()
+          << " inc_crc " << pending_inc.inc_crc << dendl;
+
   /* put everything in the transaction */
   put_version(t, pending_inc.epoch, bl);
   put_last_committed(t, pending_inc.epoch);