void usage()
{
- derr << "usage: cmds -i name [flags] [--mds rank] [[--journal_check]|[--hot-standby]]\n"
+ derr << "usage: cmds -i name [flags] [--mds rank] [[--journal_check]|[--hot-standby][rank]]\n"
<< " -m monitorip:port\n"
<< " connect to monitor at given address\n"
<< " --debug_mds n\n"
return -1;
}
shadow = MDSMap::STATE_ONESHOT_REPLAY;
+ char *endpoint = NULL;
+ int check_rank = strtol(args[i+1], &endpoint, 0);
+ if (*endpoint) {
+ if(g_conf.mds_standby_for_rank == -1 &&
+ !g_conf.mds_standby_for_name) {
+ dout(0) << "Error: no rank specified for journal replay!" << dendl;
+ return -1;
+ }
+ } else { // we got a rank from command line
+ g_conf.mds_standby_for_rank = check_rank;
+ ++i;
+ }
} else if (!strcmp(args[i], "--hot-standby")) {
dout(0) << "going into standby_replay" << dendl;
if (shadow) {
return -1;
}
shadow = MDSMap::STATE_STANDBY_REPLAY;
+ char *endpoint = NULL;
+ int check_rank = strtol(args[i+1], &endpoint, 0);
+ if (*endpoint) {
+ if(g_conf.mds_standby_for_rank == -1 &&
+ !g_conf.mds_standby_for_name) {
+ dout(0) << "no rank specified for standby, entering pool!" << dendl;
+ }
+ } else { // we got a rank from command line
+ g_conf.mds_standby_for_rank = check_rank;
+ ++i;
+ }
} else {
derr << "unrecognized arg " << args[i] << dendl;
usage();
timer(mds_lock),
name(n),
whoami(-1), incarnation(0),
- standby_for_rank(-1),
standby_type(0),
continue_replay(false),
messenger(m),
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
want_state = wanted_state;
- if (g_conf.id && (wanted_state==MDSMap::STATE_STANDBY_REPLAY ||
- wanted_state==MDSMap::STATE_ONESHOT_REPLAY)) {
- standby_for_rank = strtol(g_conf.id, NULL, 0);
+ if (wanted_state==MDSMap::STATE_STANDBY_REPLAY ||
+ wanted_state==MDSMap::STATE_ONESHOT_REPLAY) {
+ g_conf.mds_standby_replay = true;
+ if ( wanted_state == MDSMap::STATE_ONESHOT_REPLAY &&
+ (g_conf.mds_standby_for_rank == -1) &&
+ !g_conf.mds_standby_for_name) {
+ // uh-oh, must specify one or the other!
+ dout(0) << "Specified oneshot replay mode but not an MDS!" << dendl;
+ suicide();
+ }
want_state = MDSMap::STATE_STANDBY;
standby_type = wanted_state;
}
+
beacon_start();
whoami = -1;
messenger->set_myname(entity_name_t::MDS(whoami));
MMDSBeacon *beacon = new MMDSBeacon(monc->get_fsid(), monc->get_global_id(), name, mdsmap->get_epoch(),
want_state, beacon_last_seq);
- beacon->set_standby_for_rank(standby_for_rank);
- beacon->set_standby_for_name(standby_for_name);
+ beacon->set_standby_for_rank(g_conf.mds_standby_for_rank);
+ beacon->set_standby_for_name(g_conf.mds_standby_for_name);
// include _my_ feature set
beacon->set_compat(mdsmap_compat);
want_state = state = MDSMap::STATE_STANDBY;
dout(1) << "handle_mds_map standby" << dendl;
- if (standby_for_rank >= 0)
+ if (standby_type) // we want to be in standby_replay or oneshot_replay!
request_state(standby_type);
goto out;
if (oldstate == MDSMap::STATE_STANDBY_REPLAY) {
dout(10) << "Monitor activated us! Deactivating replay loop" << dendl;
assert (state == MDSMap::STATE_REPLAY);
- standby_for_rank = -1;
} else {
// did i just recover?
if ((is_active() || is_clientreplay()) &&
if (is_standby_replay())
continue_replay = true;
+ standby_type = 0;
+
calc_recovery_set();
dout(1) << " need osdmap epoch " << mdsmap->get_last_failure_osd_epoch()