From ae216508b0d36b4aa48ec69fd00d0f5a834c5647 Mon Sep 17 00:00:00 2001 From: sageweil Date: Wed, 18 Jul 2007 18:42:00 +0000 Subject: [PATCH] mdsmap same_in_set_since git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1526 29311d96-e01e-0410-9327-a35deaab8ce9 --- trunk/ceph/TODO | 7 ------- trunk/ceph/mds/MDS.cc | 4 ++-- trunk/ceph/mds/MDSMap.h | 10 +++++----- trunk/ceph/mon/MDSMonitor.cc | 13 ++++++------- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/trunk/ceph/TODO b/trunk/ceph/TODO index 3e760361151b4..dadac8af2c8f1 100644 --- a/trunk/ceph/TODO +++ b/trunk/ceph/TODO @@ -1,11 +1,4 @@ - -- change same_inst_since to align with "in" set -- tag MClientRequest with mdsmap v -- push new mdsmap to clients on send_message_client, based on the tag? - - hrm, what about exports and stale caps wonkiness... there's a race with the REAP. hmm. - - some smallish projects: - crush rewrite in C diff --git a/trunk/ceph/mds/MDS.cc b/trunk/ceph/mds/MDS.cc index 3883e9925a73f..cce42573f2e70 100644 --- a/trunk/ceph/mds/MDS.cc +++ b/trunk/ceph/mds/MDS.cc @@ -641,10 +641,10 @@ void MDS::handle_mds_map(MMDSMap *m) } - // inst set changed? + // in set set changed? /* if (state >= MDSMap::STATE_ACTIVE && // only if i'm active+. otherwise they'll get map during reconnect. - mdsmap->get_same_inst_since() > last_client_mdsmap_bcast) { + mdsmap->get_same_in_set_since() > last_client_mdsmap_bcast) { bcast_mds_map(); } */ diff --git a/trunk/ceph/mds/MDSMap.h b/trunk/ceph/mds/MDSMap.h index d72e6a1f21cca..f7d1d20e5275b 100644 --- a/trunk/ceph/mds/MDSMap.h +++ b/trunk/ceph/mds/MDSMap.h @@ -97,7 +97,7 @@ class MDSMap { protected: epoch_t epoch; utime_t created; - epoch_t same_inst_since; + epoch_t same_in_set_since; // note: this does not reflect exit-by-failure. int target_num; int anchortable; // which MDS has anchortable (fixme someday) @@ -112,13 +112,13 @@ class MDSMap { friend class MDSMonitor; public: - MDSMap() : epoch(0), same_inst_since(0), anchortable(0), root(0) {} + MDSMap() : epoch(0), same_in_set_since(0), anchortable(0), root(0) {} epoch_t get_epoch() const { return epoch; } void inc_epoch() { epoch++; } const utime_t& get_create() const { return created; } - epoch_t get_same_inst_since() const { return same_inst_since; } + epoch_t get_same_in_set_since() const { return same_in_set_since; } int get_anchortable() const { return anchortable; } int get_root() const { return root; } @@ -311,7 +311,7 @@ class MDSMap { ::_encode(epoch, bl); ::_encode(target_num, bl); ::_encode(created, bl); - ::_encode(same_inst_since, bl); + ::_encode(same_in_set_since, bl); ::_encode(anchortable, bl); ::_encode(root, bl); ::_encode(mds_state, bl); @@ -325,7 +325,7 @@ class MDSMap { ::_decode(epoch, bl, off); ::_decode(target_num, bl, off); ::_decode(created, bl, off); - ::_decode(same_inst_since, bl, off); + ::_decode(same_in_set_since, bl, off); ::_decode(anchortable, bl, off); ::_decode(root, bl, off); ::_decode(mds_state, bl, off); diff --git a/trunk/ceph/mon/MDSMonitor.cc b/trunk/ceph/mon/MDSMonitor.cc index daebe0ab3f2cb..763ee31c43ec1 100644 --- a/trunk/ceph/mon/MDSMonitor.cc +++ b/trunk/ceph/mon/MDSMonitor.cc @@ -303,9 +303,6 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m) pending_mdsmap.mds_inst[from].name = MSG_ADDR_MDS(from); pending_mdsmap.mds_inc[from]++; - // someone (new) has joined the cluster. - pending_mdsmap.same_inst_since = pending_mdsmap.epoch; - // reset the beacon timer last_beacon[from] = g_clock.now(); } @@ -333,10 +330,12 @@ bool MDSMonitor::handle_beacon(MMDSBeacon *m) << " -> " << MDSMap::get_state_name(state) << endl; - // did someone leave the cluster? - if (state == MDSMap::STATE_STOPPED && - !mdsmap.is_stopped(from)) - pending_mdsmap.same_inst_since = pending_mdsmap.epoch; + // has someone join or leave the cluster? + if (state == MDSMap::STATE_REPLAY || + state == MDSMap::STATE_ACTIVE || + state == MDSMap::STATE_STOPPED) { + pending_mdsmap.same_in_set_since = pending_mdsmap.epoch; + } // change the state pending_mdsmap.mds_state[from] = state; -- 2.39.5