From: John Spray Date: Tue, 22 Mar 2016 17:44:22 +0000 (+0000) Subject: mds: remove ONESHOT_REPLAY mode X-Git-Tag: v11.0.0~711^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=edfda9c6b0a0c8b75ebff5f06017aa475339b1fd;p=ceph.git mds: remove ONESHOT_REPLAY mode This predated cephfs-journal-tool. Don't bother with any backwards-compatibility mechanisms here, as it was a seriously niche undocumented thing. On the off chance that someone ran an old ceph-mds against a newer ceph-mon with oneshot enabled, it shouldn't break anything, it just won't do what they want. Signed-off-by: John Spray --- diff --git a/src/ceph_mds.cc b/src/ceph_mds.cc index fda5a3771570..efe22e6b995f 100644 --- a/src/ceph_mds.cc +++ b/src/ceph_mds.cc @@ -97,10 +97,6 @@ int main(int argc, const char **argv) 0, "mds_data"); ceph_heap_profiler_init(); - // mds specific args - MDSMap::DaemonState shadow = MDSMap::STATE_NULL; - std::string dump_file; - std::string val, action; for (std::vector::iterator i = args.begin(); i != args.end(); ) { if (ceph_argparse_double_dash(args, i)) { @@ -110,30 +106,13 @@ int main(int argc, const char **argv) usage(); break; } - else if (ceph_argparse_witharg(args, i, &val, "--journal-check", (char*)NULL)) { - int r = parse_rank("journal-check", val); - if (shadow != MDSMap::STATE_NULL) { - dout(0) << "Error: can only select one standby state" << dendl; - return -1; - } - dout(0) << "requesting oneshot_replay for mds." << r << dendl; - shadow = MDSMap::STATE_ONESHOT_REPLAY; - char rb[32]; - snprintf(rb, sizeof(rb), "%d", r); - g_conf->set_val("mds_standby_for_rank", rb); - g_conf->apply_changes(NULL); - } else if (ceph_argparse_witharg(args, i, &val, "--hot-standby", (char*)NULL)) { int r = parse_rank("hot-standby", val); - if (shadow != MDSMap::STATE_NULL) { - dout(0) << "Error: can only select one standby state" << dendl; - return -1; - } dout(0) << "requesting standby_replay for mds." << r << dendl; - shadow = MDSMap::STATE_STANDBY_REPLAY; char rb[32]; snprintf(rb, sizeof(rb), "%d", r); g_conf->set_val("mds_standby_for_rank", rb); + g_conf->set_val("mds_standby_replay", "true"); g_conf->apply_changes(NULL); } else { @@ -193,8 +172,7 @@ int main(int argc, const char **argv) if (r < 0) exit(1); - if (shadow != MDSMap::STATE_ONESHOT_REPLAY) - global_init_daemonize(g_ceph_context); + global_init_daemonize(g_ceph_context); common_init_finish(g_ceph_context); // get monmap @@ -212,10 +190,7 @@ int main(int argc, const char **argv) mds->orig_argc = argc; mds->orig_argv = argv; - if (shadow != MDSMap::STATE_NULL) - r = mds->init(shadow); - else - r = mds->init(); + r = mds->init(); if (r < 0) { msgr->wait(); goto shutdown; diff --git a/src/include/ceph_fs.h b/src/include/ceph_fs.h index fe0a8d5d0699..70f83e3d2b99 100644 --- a/src/include/ceph_fs.h +++ b/src/include/ceph_fs.h @@ -253,7 +253,7 @@ struct ceph_mon_subscribe_ack { #define CEPH_MDS_STATE_CREATING -6 /* up, creating MDS instance. */ #define CEPH_MDS_STATE_STARTING -7 /* up, starting previously stopped mds */ #define CEPH_MDS_STATE_STANDBY_REPLAY -8 /* up, tailing active node's journal */ -#define CEPH_MDS_STATE_REPLAYONCE -9 /* up, replaying an active node's journal */ +#define CEPH_MDS_STATE_REPLAYONCE -9 /* Legacy, unused */ #define CEPH_MDS_STATE_NULL -10 #define CEPH_MDS_STATE_REPLAY 8 /* up, replaying journal. */ diff --git a/src/mds/MDSDaemon.cc b/src/mds/MDSDaemon.cc index a950b0b4c7ba..caa33f164405 100644 --- a/src/mds/MDSDaemon.cc +++ b/src/mds/MDSDaemon.cc @@ -121,7 +121,7 @@ MDSDaemon::MDSDaemon(const std::string &n, Messenger *m, MonClient *mc) : mds_rank(NULL), tick_event(0), standby_for_rank(MDSMap::MDS_NO_STANDBY_PREF), - standby_type(MDSMap::STATE_NULL), + standby_replay(false), asok_hook(NULL) { orig_argc = 0; @@ -438,7 +438,7 @@ void MDSDaemon::handle_conf_change(const struct md_config_t *conf, } -int MDSDaemon::init(MDSMap::DaemonState wanted_state) +int MDSDaemon::init() { dout(10) << sizeof(MDSCacheObject) << "\tMDSCacheObject" << dendl; dout(10) << sizeof(CInode) << "\tCInode" << dendl; @@ -545,41 +545,23 @@ int MDSDaemon::init(MDSMap::DaemonState wanted_state) timer.init(); - if (wanted_state==MDSMap::STATE_BOOT && g_conf->mds_standby_replay) { - wanted_state = MDSMap::STATE_STANDBY_REPLAY; - } - - // starting beacon. this will induce an MDSMap from the monitor - if (wanted_state==MDSMap::STATE_STANDBY_REPLAY || - wanted_state==MDSMap::STATE_ONESHOT_REPLAY) { - g_conf->set_val_or_die("mds_standby_replay", "true"); - g_conf->apply_changes(NULL); - if ( wanted_state == MDSMap::STATE_ONESHOT_REPLAY && - (g_conf->mds_standby_for_rank == -1) && - g_conf->mds_standby_for_name.empty()) { - // uh-oh, must specify one or the other! - dout(0) << "Specified oneshot replay mode but not an MDS!" << dendl; - suicide(); - } - standby_type = wanted_state; - wanted_state = MDSMap::STATE_BOOT; + MDSMap::DaemonState wanted_state = MDSMap::STATE_BOOT; + if (g_conf->mds_standby_replay) { + standby_replay = true; } standby_for_rank = mds_rank_t(g_conf->mds_standby_for_rank); standby_for_name.assign(g_conf->mds_standby_for_name); - if (standby_type == MDSMap::STATE_STANDBY_REPLAY && - standby_for_rank == -1) { + if (standby_replay && standby_for_rank == -1) { if (standby_for_name.empty()) standby_for_rank = MDSMap::MDS_STANDBY_ANY; else standby_for_rank = MDSMap::MDS_STANDBY_NAME; - } else if (standby_type == MDSMap::STATE_NULL && !standby_for_name.empty()) + } else if (!standby_replay && !standby_for_name.empty()) { standby_for_rank = MDSMap::MDS_MATCHED_ACTIVE; - - if (wanted_state == MDSMap::STATE_NULL) { - wanted_state = MDSMap::STATE_BOOT; } + beacon.init(mdsmap, wanted_state, standby_for_rank, standby_for_name, fs_cluster_id_t(g_conf->mds_standby_for_fscid)); @@ -974,19 +956,8 @@ void MDSDaemon::handle_mds_map(MMDSMap *m) } } - // If I was put into standby replay, but I am configured for a different standby - // type, ignore the map's state and request my standby type (only used - // for oneshot replay?) - if (new_state == MDSMap::STATE_STANDBY_REPLAY) { - if (standby_type != MDSMap::STATE_NULL && standby_type != MDSMap::STATE_STANDBY_REPLAY) { - beacon.set_want_state(mdsmap, standby_type); - beacon.send(); - goto out; - } - } - - if (whoami == MDS_RANK_NONE && ( - new_state == MDSMap::STATE_STANDBY_REPLAY || new_state == MDSMap::STATE_ONESHOT_REPLAY)) { + if (whoami == MDS_RANK_NONE && + new_state == MDSMap::STATE_STANDBY_REPLAY) { whoami = mdsmap->get_mds_info_gid(mds_gid_t(monc->get_global_id())).standby_for_rank; } @@ -1066,8 +1037,9 @@ void MDSDaemon::_handle_mds_map(MDSMap *oldmap) beacon.set_want_state(mdsmap, new_state); dout(1) << "handle_mds_map standby" << dendl; - if (standby_type != MDSMap::STATE_NULL) {// we want to be in standby_replay or oneshot_replay! - beacon.set_want_state(mdsmap, standby_type); + if (standby_replay) { + // we want to be in standby_replay + beacon.set_want_state(mdsmap, MDSMap::STATE_STANDBY_REPLAY); beacon.send(); } return; diff --git a/src/mds/MDSDaemon.h b/src/mds/MDSDaemon.h index 783f37e348fb..05a056d27482 100644 --- a/src/mds/MDSDaemon.h +++ b/src/mds/MDSDaemon.h @@ -109,8 +109,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { // handle a signal (e.g., SIGTERM) void handle_signal(int signum); - // start up, shutdown - int init(MDSMap::DaemonState wanted_state=MDSMap::STATE_BOOT); + int init(); /** * Hint at whether we were shutdown gracefully (i.e. we were only @@ -144,7 +143,7 @@ class MDSDaemon : public Dispatcher, public md_config_obs_t { mds_rank_t standby_for_rank; string standby_for_name; - MDSMap::DaemonState standby_type; // one of STANDBY_REPLAY, ONESHOT_REPLAY + bool standby_replay; private: bool ms_dispatch(Message *m); diff --git a/src/mds/MDSMap.h b/src/mds/MDSMap.h index bb69a75f9d5e..eda4fc7bce40 100644 --- a/src/mds/MDSMap.h +++ b/src/mds/MDSMap.h @@ -89,7 +89,6 @@ public: // States of an MDS rank, and of any MDS daemon holding that rank // ============================================================== STATE_STOPPED = CEPH_MDS_STATE_STOPPED, // down, once existed, but no subtrees. empty log. may not be held by a daemon. - STATE_ONESHOT_REPLAY = CEPH_MDS_STATE_REPLAYONCE, // up, replaying active node journal to verify it, then shutting down STATE_CREATING = CEPH_MDS_STATE_CREATING, // up, creating MDS instance (new journal, idalloc..). STATE_STARTING = CEPH_MDS_STATE_STARTING, // up, starting prior stopped MDS instance. diff --git a/src/mds/MDSRank.cc b/src/mds/MDSRank.cc index feb48970e1fd..5724f3cb85d0 100644 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@ -1093,12 +1093,6 @@ void MDSRank::replay_done() { dout(1) << "replay_done" << (standby_replaying ? " (as standby)" : "") << dendl; - if (is_oneshot_replay()) { - dout(2) << "hack. journal looks ok. shutting down." << dendl; - suicide(); - return; - } - if (is_standby_replay()) { // The replay was done in standby state, and we are still in that state assert(standby_replaying); @@ -1434,7 +1428,7 @@ void MDSRankDispatcher::handle_mds_map( if (oldstate != state) { // update messenger. - if (state == MDSMap::STATE_STANDBY_REPLAY || state == MDSMap::STATE_ONESHOT_REPLAY) { + if (state == MDSMap::STATE_STANDBY_REPLAY) { dout(1) << "handle_mds_map i am now mds." << mds_gid << "." << incarnation << " replaying mds." << whoami << "." << incarnation << dendl; messenger->set_myname(entity_name_t::MDS(mds_gid)); diff --git a/src/mds/MDSRank.h b/src/mds/MDSRank.h index 4da260d7ac9e..fe65c56d90da 100644 --- a/src/mds/MDSRank.h +++ b/src/mds/MDSRank.h @@ -191,9 +191,7 @@ class MDSRank { bool is_clientreplay() const { return state == MDSMap::STATE_CLIENTREPLAY; } bool is_active() const { return state == MDSMap::STATE_ACTIVE; } bool is_stopping() const { return state == MDSMap::STATE_STOPPING; } - bool is_oneshot_replay() const { return state == MDSMap::STATE_ONESHOT_REPLAY; } - bool is_any_replay() const { return (is_replay() || is_standby_replay() || - is_oneshot_replay()); } + bool is_any_replay() const { return (is_replay() || is_standby_replay()); } bool is_stopped() const { return mdsmap->is_stopped(whoami); } void handle_write_error(int err); diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 00f06a0207f4..ea1582995f29 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -386,8 +386,7 @@ bool MDSMonitor::preprocess_beacon(MonOpRequestRef op) if (info.state != state) { // legal state change? if ((info.state == MDSMap::STATE_STANDBY || - info.state == MDSMap::STATE_STANDBY_REPLAY || - info.state == MDSMap::STATE_ONESHOT_REPLAY) && state > 0) { + info.state == MDSMap::STATE_STANDBY_REPLAY) && state > 0) { dout(10) << "mds_beacon mds can't activate itself (" << ceph_mds_state_name(info.state) << " -> " << ceph_mds_state_name(state) << ")" << dendl; goto reply;