From: Sage Weil Date: Tue, 20 Aug 2013 18:27:09 +0000 (-0700) Subject: mon/Paxos: return whether store_state stored anything X-Git-Tag: v0.68~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7e0848d8f88f156a05eef47a9f730b772b64fbf2;p=ceph.git mon/Paxos: return whether store_state stored anything Signed-off-by: Sage Weil Reviewed-by: Joao Eduardo Luis --- diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index 0fcd3b139034..09b3391e182b 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -282,10 +282,11 @@ void Paxos::share_state(MMonPaxos *m, version_t peer_first_committed, * be. All all this is done tightly wrapped in a transaction to ensure we * enjoy the atomicity guarantees given by our awesome k/v store. */ -void Paxos::store_state(MMonPaxos *m) +bool Paxos::store_state(MMonPaxos *m) { MonitorDBStore::Transaction t; map::iterator start = m->values.begin(); + bool changed = false; // build map of values to store // we want to write the range [last_committed, m->last_committed] only. @@ -341,9 +342,12 @@ void Paxos::store_state(MMonPaxos *m) first_committed = get_store()->get(get_name(), "first_committed"); _sanity_check_store(); + changed = true; } remove_legacy_versions(); + + return changed; } void Paxos::remove_legacy_versions() diff --git a/src/mon/Paxos.h b/src/mon/Paxos.h index 69419e64ab93..1bd3a3c1f511 100644 --- a/src/mon/Paxos.h +++ b/src/mon/Paxos.h @@ -1095,8 +1095,9 @@ public: * enjoy the atomicity guarantees given by our awesome k/v store. * * @param m A message + * @returns true if we stored something new; false otherwise */ - void store_state(MMonPaxos *m); + bool store_state(MMonPaxos *m); void _sanity_check_store(); /**