From 7935a2d19307dab2c066e63e57c3534f64cf0c11 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 28 Apr 2009 13:10:50 -0700 Subject: [PATCH] mon: order log entries as they're committed This doesn't fully order them (across commits), but it helps. --- src/mon/LogMonitor.cc | 11 +++++++---- src/mon/LogMonitor.h | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mon/LogMonitor.cc b/src/mon/LogMonitor.cc index 5c9ca4bde278b..414a5fd8499f6 100644 --- a/src/mon/LogMonitor.cc +++ b/src/mon/LogMonitor.cc @@ -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(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::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(p->stamp, *p)); } } diff --git a/src/mon/LogMonitor.h b/src/mon/LogMonitor.h index 7a465e5b046ed..b772f215e03d9 100644 --- a/src/mon/LogMonitor.h +++ b/src/mon/LogMonitor.h @@ -30,7 +30,7 @@ class MLog; class LogMonitor : public PaxosService { private: - bufferlist pending_inc; + multimap pending_log; LogSummary pending_summary, summary; void create_initial(bufferlist& bl); -- 2.39.5