]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon/Paxos: return whether store_state stored anything
authorSage Weil <sage@inktank.com>
Tue, 20 Aug 2013 18:27:09 +0000 (11:27 -0700)
committerSage Weil <sage@inktank.com>
Tue, 20 Aug 2013 18:27:09 +0000 (11:27 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Joao Eduardo Luis <joao.luis@inktank.com>
src/mon/Paxos.cc
src/mon/Paxos.h

index 0fcd3b1390349a3c1e0ec05692408ad671310f1e..09b3391e182b8ccb34b5fb7cbe87980b09cef78e 100644 (file)
@@ -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<version_t,bufferlist>::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()
index 69419e64ab937a483853bb949c4cc922c85039a0..1bd3a3c1f511bfecb12e23cfa2c4c2b657b549d1 100644 (file)
@@ -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();
 
   /**