mdsmap: add a last_changed utime_t data member.

This commit is contained in:
Greg Farnum 2009-10-08 16:28:39 -07:00
parent 535072b493
commit ed70b5ae1f
2 changed files with 6 additions and 0 deletions

View File

@ -26,11 +26,13 @@ class MonMap {
epoch_t epoch; // what epoch/version of the monmap
ceph_fsid_t fsid;
vector<entity_inst_t> 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);
}

View File

@ -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;
}