]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: include any new paxos commits in each sync CHUNK message
authorSage Weil <sage@inktank.com>
Fri, 5 Jul 2013 00:09:07 +0000 (17:09 -0700)
committerSage Weil <sage@inktank.com>
Fri, 5 Jul 2013 00:09:07 +0000 (17:09 -0700)
We already take note of the paxos version when we begin the sync.  As
sync progresses and there are new paxos commits/txns, include those
and update last_committed, so that when sync completes we will have
a full view of everything that happened during sync.

Note that this does not introduce any compatibility change.  This change
*only* affects the provider.  The key difference is that at the end
of the sync, the provide will set version to the latest version, and
not the version from the start of the sync (as was done previously).

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

index 42fc15c5905bf7b7fcdfdb9623f090afcec3ef33..e541d4b77a11db6e2bb6a0a1687da80f7989e8db 100644 (file)
@@ -1265,8 +1265,27 @@ void Monitor::sync_send_chunks(SyncEntity sync)
   assert(sync->synchronizer->has_next_chunk());
 
   MMonSync *msg = new MMonSync(MMonSync::OP_CHUNK);
+  MonitorDBStore::Transaction tx;
+
+  // include any recent paxos commits
+  if (sync->version < paxos->get_version()) {
+    while (sync->version < paxos->get_version()) {  // FIXME: limit size?
+      sync->version++;
+      dout(10) << " including paxos version " << sync->version << dendl;
+      bufferlist bl;
+      store->get(paxos->get_name(), sync->version, bl);
+      tx.put(paxos->get_name(), sync->version, bl);
+    }
+    dout(10) << " included paxos through " << sync->version << dendl;
+    msg->version = sync->version;
+  }
+
+  // get next bunch of commits in the remaining space
+  sync->synchronizer->get_chunk_tx(tx);
+
+  if (!tx.empty())
+    tx.encode(msg->chunk_bl);
 
-  sync->synchronizer->get_chunk(msg->chunk_bl);
   msg->last_key = sync->synchronizer->get_last_key();
   dout(10) << __func__ << " last key ("
           << msg->last_key.first << ","