From ed70b5ae1faba8271098ea4287b09f70be39cd00 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Thu, 8 Oct 2009 16:28:39 -0700 Subject: [PATCH] mdsmap: add a last_changed utime_t data member. --- src/mon/MonMap.h | 4 ++++ src/mon/MonmapMonitor.cc | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/mon/MonMap.h b/src/mon/MonMap.h index 9313d9f0ec3..24f4ef0f17b 100644 --- a/src/mon/MonMap.h +++ b/src/mon/MonMap.h @@ -26,11 +26,13 @@ class MonMap { epoch_t epoch; // what epoch/version of the monmap ceph_fsid_t fsid; vector mon_inst; + utime_t last_changed; int last_mon; // last mon i talked to MonMap() : epoch(0), last_mon(-1) { memset(&fsid, 0, sizeof(fsid)); + last_changed = g_clock.now(); } ceph_fsid_t& get_fsid() { return fsid; } @@ -89,6 +91,7 @@ class MonMap { ::encode_raw(fsid, blist); ::encode(epoch, blist); ::encode(mon_inst, blist); + ::encode(last_changed, blist); } void decode(bufferlist& blist) { bufferlist::iterator p = blist.begin(); @@ -100,6 +103,7 @@ class MonMap { ::decode_raw(fsid, p); ::decode(epoch, p); ::decode(mon_inst, p); + ::decode(last_changed, p); } diff --git a/src/mon/MonmapMonitor.cc b/src/mon/MonmapMonitor.cc index a231ce08077..0c7d0caca96 100644 --- a/src/mon/MonmapMonitor.cc +++ b/src/mon/MonmapMonitor.cc @@ -64,6 +64,7 @@ void MonmapMonitor::create_pending() { pending_map = *mon->monmap; pending_map.epoch++; + pending_map.last_changed = g_clock.now(); dout(10) << "create_pending monmap epoch " << pending_map.epoch << dendl; } @@ -84,6 +85,7 @@ bool MonmapMonitor::prepare_update(PaxosServiceMessage *message) { MMonAdd *m = (MMonAdd *) message; pending_map.add(m->address); + pending_map.last_changed = g_clock.now(); return true; }