From cec8d858538c16c0fa60d02860c1dd0ad06b2fea Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 28 Dec 2013 12:23:22 -0800 Subject: [PATCH] mds: require CEPH_FEATURE_OSD_TMAP2OMAP Require that all OSDs support TMAP2OMAP before starting the MDS. This avoids doing some work and then crashing with EOPNOTSUPP, and gives us a more informative message in the logs. Signed-off-by: Sage Weil --- PendingReleaseNotes | 5 +++++ src/include/ceph_features.h | 1 + src/mds/MDS.cc | 28 +++++++++++++++++++++++----- src/osdc/Objecter.h | 2 ++ 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/PendingReleaseNotes b/PendingReleaseNotes index f813e86622c04..9a9a0c094d85f 100644 --- a/PendingReleaseNotes +++ b/PendingReleaseNotes @@ -6,3 +6,8 @@ v0.75 non-plain format. This is consistent with the behavior for a pool which used to hold images, but contains none. Scripts relying on this behavior should be updated. + +- The MDS requires a new OSD operation TMAP2OMAP, added in this release. When + upgrading, be sure to upgrade and restart the ceph-osd daemons before the + ceph-mds daemon. The MDS will refuse to start if any up OSDs do not support + the new feature. diff --git a/src/include/ceph_features.h b/src/include/ceph_features.h index d1cb1bc47c6df..f6b56f1014247 100644 --- a/src/include/ceph_features.h +++ b/src/include/ceph_features.h @@ -43,6 +43,7 @@ #define CEPH_FEATURE_CRUSH_V2 (1ULL<<36) /* new indep; SET_* steps */ #define CEPH_FEATURE_EXPORT_PEER (1ULL<<37) #define CEPH_FEATURE_OSD_ERASURE_CODES (1ULL<<38) +#define CEPH_FEATURE_OSD_TMAP2OMAP (1ULL<<38) /* overlap with EC */ /* * The introduction of CEPH_FEATURE_OSD_SNAPMAPPER caused the feature diff --git a/src/mds/MDS.cc b/src/mds/MDS.cc index c88a0240fe13f..c9df062eb7763 100644 --- a/src/mds/MDS.cc +++ b/src/mds/MDS.cc @@ -479,6 +479,29 @@ int MDS::init(int wanted_state) return 0; } + objecter->init_locked(); + + monc->sub_want("mdsmap", 0, 0); + monc->renew_subs(); + + mds_lock.Unlock(); + + // verify that osds support tmap2omap + while (true) { + objecter->maybe_request_map(); + objecter->wait_for_osd_map(); + uint64_t osd_features = objecter->osdmap->get_up_osd_features(); + if (osd_features & CEPH_FEATURE_OSD_TMAP2OMAP) + break; + derr << "*** one or more OSDs do not support TMAP2OMAP; upgrade OSDs before starting MDS (or downgrade MDS) ***" << dendl; + sleep(10); + } + + mds_lock.Lock(); + if (want_state == CEPH_MDS_STATE_DNE) { + suicide(); // we could do something more graceful here + } + timer.init(); if (wanted_state==MDSMap::STATE_BOOT && g_conf->mds_standby_replay) @@ -516,11 +539,6 @@ int MDS::init(int wanted_state) whoami = -1; messenger->set_myname(entity_name_t::MDS(whoami)); - objecter->init_locked(); - - monc->sub_want("mdsmap", 0, 0); - monc->renew_subs(); - // schedule tick reset_tick(); diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index 4b689424a3fa5..3777c6de5f0b0 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -953,7 +953,9 @@ public: bool keep_balanced_budget; bool honor_osdmap_full; +public: void maybe_request_map(); +private: version_t last_seen_osdmap_version; version_t last_seen_pgmap_version; -- 2.39.5