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)) {
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 {
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
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;
#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. */
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;
}
-int MDSDaemon::init(MDSMap::DaemonState wanted_state)
+int MDSDaemon::init()
{
dout(10) << sizeof(MDSCacheObject) << "\tMDSCacheObject" << dendl;
dout(10) << sizeof(CInode) << "\tCInode" << dendl;
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));
}
}
- // 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;
}
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;
// 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
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);
// 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.
{
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);
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));
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);
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;