]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: order log entries as they're committed
authorSage Weil <sage@newdream.net>
Tue, 28 Apr 2009 20:10:50 +0000 (13:10 -0700)
committerSage Weil <sage@newdream.net>
Tue, 28 Apr 2009 20:10:50 +0000 (13:10 -0700)
This doesn't fully order them (across commits), but it helps.

src/mon/LogMonitor.cc
src/mon/LogMonitor.h

index 5c9ca4bde278bfac6681b63565c29bcc28a7426d..414a5fd8499f6771e954092c3a366a1ae2c802d7 100644 (file)
@@ -86,7 +86,7 @@ void LogMonitor::create_initial(bufferlist& bl)
   e.type = LOG_ERROR;
   e.msg = "mkfs";
   e.seq = 0;
-  e.encode(pending_inc);
+  pending_log.insert(pair<utime_t,LogEntry>(e.stamp, e));
 }
 
 bool LogMonitor::update_from_paxos()
@@ -174,7 +174,7 @@ bool LogMonitor::update_from_paxos()
 
 void LogMonitor::create_pending()
 {
-  pending_inc.clear();
+  pending_log.clear();
   pending_summary = summary;
   dout(10) << "create_pending v " << (paxos->get_version() + 1) << dendl;
 }
@@ -182,7 +182,10 @@ void LogMonitor::create_pending()
 void LogMonitor::encode_pending(bufferlist &bl)
 {
   dout(10) << "encode_pending v " << (paxos->get_version() + 1) << dendl;
-  bl = pending_inc;
+  for (multimap<utime_t,LogEntry>::iterator p = pending_log.begin();
+       p != pending_log.end();
+       p++)
+    p->second.encode(bl);
 }
 
 bool LogMonitor::preprocess_query(Message *m)
@@ -256,7 +259,7 @@ bool LogMonitor::prepare_log(MLog *m)
     dout(10) << " logging " << *p << dendl;
     if (!pending_summary.contains(p->key())) {
       pending_summary.add(*p);
-      (*p).encode(pending_inc);
+      pending_log.insert(pair<utime_t,LogEntry>(p->stamp, *p));
     }
   }
 
index 7a465e5b046ed9a1eb82567bc7cd9b7a10e66c3a..b772f215e03d927c2e6619b72a86fd302dc8aa77 100644 (file)
@@ -30,7 +30,7 @@ class MLog;
 
 class LogMonitor : public PaxosService {
 private:
-  bufferlist pending_inc;
+  multimap<utime_t,LogEntry> pending_log;
   LogSummary pending_summary, summary;
 
   void create_initial(bufferlist& bl);