]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: remove ONESHOT_REPLAY mode
authorJohn Spray <john.spray@redhat.com>
Tue, 22 Mar 2016 17:44:22 +0000 (17:44 +0000)
committerJohn Spray <john.spray@redhat.com>
Tue, 3 May 2016 11:57:22 +0000 (12:57 +0100)
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 <john.spray@redhat.com>
src/ceph_mds.cc
src/include/ceph_fs.h
src/mds/MDSDaemon.cc
src/mds/MDSDaemon.h
src/mds/MDSMap.h
src/mds/MDSRank.cc
src/mds/MDSRank.h
src/mon/MDSMonitor.cc

index fda5a37715707a421a474eb0ca0aace697e495ed..efe22e6b995ffc59fc91cd5877ee6decffd20aff 100644 (file)
@@ -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<const char*>::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;
index fe0a8d5d0699aa1ec50d1117ecdfe638e6764f58..70f83e3d2b9947041254baf04914def5280069c8 100644 (file)
@@ -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. */
index a950b0b4c7ba504bf6cddba55380be4dab950b39..caa33f1644054dddbbbd5b8460546ff66200ca0d 100644 (file)
@@ -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;
index 783f37e348fbfc3286e2350f84f07c3206f57ade..05a056d27482633251f1af3fb0c09e82c5ac0f9a 100644 (file)
@@ -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);
index bb69a75f9d5efa97c11a40aa0d50bcaec624ed3e..eda4fc7bce40f5d4f59796118601443524e18f13 100644 (file)
@@ -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.
index feb48970e1fdf0c3de43ae7bf72d5da8d57efd4a..5724f3cb85d02d71a33c69eb5e4508fc37952f58 100644 (file)
@@ -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));
index 4da260d7ac9e22183f08cac8893385c0987afd65..fe65c56d90da9f602aaee01d9b28545d10071e4a 100644 (file)
@@ -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);
index 00f06a0207f49903ed0f71834c4f1a74c68608ac..ea1582995f29a61a7270b31696105efc9b69aab3 100644 (file)
@@ -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;