From: Joao Eduardo Luis Date: Mon, 1 Jul 2013 22:18:48 +0000 (+0100) Subject: mon: Paxos: update first_committed on first paxos proposal X-Git-Tag: v0.67-rc1~169 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=935c27842e4549b32c1c8721e178e9f3a10f2ad4;p=ceph.git mon: Paxos: update first_committed on first paxos proposal We were adding this update to a transaction that would only be applied on the leader. The peons would never see a first_committed > 0. Fixes: #5484 Signed-off-by: Joao Eduardo Luis Reviewed-by: Sage Weil --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 58c35d0305ca..da00e400113c 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -489,15 +489,24 @@ void Paxos::begin(bufferlist& v) accepted.clear(); accepted.insert(mon->rank); new_value = v; + + if (last_committed == 0) { + MonitorDBStore::Transaction t; + // initial base case; set first_committed too + t.put(get_name(), "first_committed", 1); + decode_append_transaction(t, new_value); + + bufferlist tx_bl; + t.encode(tx_bl); + + new_value = tx_bl; + } + // store the proposed value in the store. IF it is accepted, we will then // have to decode it into a transaction and apply it. MonitorDBStore::Transaction t; t.put(get_name(), last_committed+1, new_value); - // initial base case; set first_committed too - if (last_committed == 0) - t.put(get_name(), "first_committed", 1); - dout(30) << __func__ << " transaction dump:\n"; JSONFormatter f(true); t.dump(&f);