From dc1db5518b47ae0d3cc4657716a97f0a0f37972f Mon Sep 17 00:00:00 2001 From: sageweil Date: Mon, 4 Jun 2007 21:09:42 +0000 Subject: [PATCH] * mds boot osdmap weirdness fixup git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@1392 29311d96-e01e-0410-9327-a35deaab8ce9 --- branches/sage/cephmds2/TODO | 3 +-- branches/sage/cephmds2/mds/MDS.cc | 43 ++++++++++++++++++++----------- branches/sage/cephmds2/mds/MDS.h | 1 + 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/branches/sage/cephmds2/TODO b/branches/sage/cephmds2/TODO index 72bb37d21098d..9150c21fcfdb7 100644 --- a/branches/sage/cephmds2/TODO +++ b/branches/sage/cephmds2/TODO @@ -20,10 +20,9 @@ mds - more testing of failures + thrashing. - is export prep dir open deadlock properly fixed by forge_replica_dir()? -- locker vs node failure - osd needs a set_floor_and_read op for safe failover/STOGITH-like semantics. - failures during recovery stages (resolve, rejoin)... make sure rejoin still works! -- fix mds initial osdmap weirdness (which will currently screw up on standby -> almost anything) + - incremental mdsmaps? - client failure diff --git a/branches/sage/cephmds2/mds/MDS.cc b/branches/sage/cephmds2/mds/MDS.cc index fc2fd5ae49b7f..7a1bf6d69d88e 100644 --- a/branches/sage/cephmds2/mds/MDS.cc +++ b/branches/sage/cephmds2/mds/MDS.cc @@ -440,6 +440,7 @@ void MDS::beacon_kill(utime_t lab) void MDS::handle_mds_map(MMDSMap *m) { + version_t hadepoch = mdsmap->get_epoch(); version_t epoch = m->get_epoch(); dout(5) << "handle_mds_map epoch " << epoch << " from " << m->get_source() << endl; @@ -670,6 +671,12 @@ void MDS::handle_mds_map(MMDSMap *m) } */ + // just got mdsmap+osdmap? + if (hadepoch == 0 && + mdsmap->get_epoch() > 0 && + osdmap->get_epoch() > 0) + boot(); + delete m; } @@ -690,24 +697,30 @@ void MDS::bcast_mds_map() void MDS::handle_osd_map(MOSDMap *m) { - version_t had = osdmap->get_epoch(); + version_t hadepoch = osdmap->get_epoch(); + dout(10) << "handle_osd_map had " << hadepoch << endl; - dout(10) << "handle_osd_map had " << had << endl; - - // process locally + // process objecter->handle_osd_map(m); - if (had == 0 && osdmap->get_epoch() > 0) { - if (is_creating()) - boot_create(); // new tables, journal - else if (is_starting()) - boot_start(); // old tables, empty journal - else if (is_replay()) - boot_replay(); // replay, join - else - assert(is_standby()); - } - + // just got mdsmap+osdmap? + if (hadepoch == 0 && + osdmap->get_epoch() > 0 && + mdsmap->get_epoch() > 0) + boot(); +} + + +void MDS::boot() +{ + if (is_creating()) + boot_create(); // new tables, journal + else if (is_starting()) + boot_start(); // old tables, empty journal + else if (is_replay()) + boot_replay(); // replay, join + else + assert(0); } diff --git a/branches/sage/cephmds2/mds/MDS.h b/branches/sage/cephmds2/mds/MDS.h index d7645c322a518..a030e53b62768 100644 --- a/branches/sage/cephmds2/mds/MDS.h +++ b/branches/sage/cephmds2/mds/MDS.h @@ -188,6 +188,7 @@ class MDS : public Dispatcher { int init(bool standby=false); void reopen_logger(); + void boot(); void boot_create(); // i am new mds. void boot_start(); // i am old but empty (was down:out) mds. void boot_replay(int step=0); // i am recovering existing (down:failed) mds. -- 2.39.5