]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
paxos: update first_committed
authorSage Weil <sage.weil@dreamhost.com>
Wed, 5 Oct 2011 18:12:51 +0000 (11:12 -0700)
committerSage Weil <sage.weil@dreamhost.com>
Wed, 5 Oct 2011 18:13:23 +0000 (11:13 -0700)
Otherwise this stays at 0, which isn't accurate.

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

index 6806f54f37ae8101a1a997895d338aa90bf67a0e..1eb30bff803fccc062ded07a7bcd24ca441d4a0e 100644 (file)
@@ -1129,6 +1129,7 @@ int Monitor::mkfs(bufferlist& osdmapbl)
     // commit to paxos
     svc->encode_pending(bl);
     store->put_bl_sn(bl, svc->get_machine_name(), 1);
+    store->put_int(1, svc->get_machine_name(), "first_committed");
     store->put_int(1, svc->get_machine_name(), "last_committed");
   }
 
index a1731b31e817e4eecb4dc9833b01bdf889304a00..ff1dcb70f71d82f66a5d3af5c575a2b29b806336 100644 (file)
 
 #define DOUT_SUBSYS paxos
 #undef dout_prefix
-#define dout_prefix _prefix(_dout, mon, mon->name, mon->rank, machine_name, state, last_committed)
+#define dout_prefix _prefix(_dout, mon, mon->name, mon->rank, machine_name, state, first_committed, last_committed)
 static ostream& _prefix(std::ostream *_dout, Monitor *mon, const string& name, int rank,
-                       const char *machine_name, int state, version_t last_committed) {
+                       const char *machine_name, int state,
+                       version_t first_committed, version_t last_committed) {
   return *_dout << "mon." << name << "@" << rank
                << (mon->is_starting() ?
                    (const char*)"(starting)" :
@@ -33,7 +34,8 @@ static ostream& _prefix(std::ostream *_dout, Monitor *mon, const string& name, i
                     (const char*)"(leader)" : 
                     (mon->is_peon() ?
                      (const char*)"(peon)" : (const char*)"(?\?)"))) 
-               << ".paxos(" << machine_name << " " << Paxos::get_statename(state) << " lc " << last_committed
+               << ".paxos(" << machine_name << " " << Paxos::get_statename(state)
+               << " c " << first_committed << ".." << last_committed
                << ") ";
 }
 
@@ -225,6 +227,8 @@ void Paxos::store_state(MMonPaxos *m)
   while (end != m->values.end() &&
         end->first <= m->last_committed) {
     last_committed = end->first;
+    if (!first_committed)
+      first_committed = last_committed;
     ++end;
   }
 
@@ -234,6 +238,7 @@ void Paxos::store_state(MMonPaxos *m)
     dout(10) << "store_state [" << start->first << ".." << last_committed << "]" << dendl;
     mon->store->put_bl_sn_map(machine_name, start, end);
     mon->store->put_int(last_committed, machine_name, "last_committed");
+    mon->store->put_int(first_committed, machine_name, "first_committed");
   }
 }
 
@@ -495,6 +500,10 @@ void Paxos::commit()
   last_committed++;
   last_commit_time = ceph_clock_now(g_ceph_context);
   mon->store->put_int(last_committed, machine_name, "last_committed");
+  if (!first_committed) {
+    first_committed = last_committed;
+    mon->store->put_int(last_committed, machine_name, "first_committed");
+  }
 
   // tell everyone
   for (set<int>::const_iterator p = mon->get_quorum().begin();