From 0c9a69a8d8fb6674e6016d44262771b56769a537 Mon Sep 17 00:00:00 2001 From: John Spray Date: Fri, 23 Dec 2016 19:23:20 +0000 Subject: [PATCH] mds: wait for purgequeue on rank shutdown Also, move shutdown_pass call from dispatch to tick, so that it doesn't rely on incoming messages to make progress. Signed-off-by: John Spray --- src/mds/MDSRank.cc | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index 04269ef039b91..62ae2764a2a1f 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -222,6 +222,28 @@ void MDSRankDispatcher::tick() snapserver->check_osd_map(false); } + // shut down? + if (is_stopping()) { + mdlog->trim(); + if (mdcache->shutdown_pass()) { + if (!purge_queue.is_idle()) { + dout(7) << "shutdown_pass=true, but still waiting for purge queue" + << dendl; + // This takes unbounded time, so we must indicate progress + // to the administrator + // TODO include progress in message + clog->info() << "MDS rank " << whoami << " waiting for purge queue"; + } else { + dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to " + "down:stopped" << dendl; + stopping_done(); + } + } + else { + dout(7) << "shutdown_pass=false" << dendl; + } + } + // Expose ourselves to Beacon to update health indicators beacon.notify_health(this); } @@ -571,17 +593,6 @@ bool MDSRank::_dispatch(Message *m, bool new_msg) mlogger->set(l_mdm_buf, buffer::get_total_alloc()); } - // shut down? - if (is_stopping()) { - mdlog->trim(); - if (mdcache->shutdown_pass()) { - dout(7) << "shutdown_pass=true, finished w/ shutdown, moving to down:stopped" << dendl; - stopping_done(); - } - else { - dout(7) << "shutdown_pass=false" << dendl; - } - } return true; } -- 2.39.5