From: Joao Eduardo Luis Date: Thu, 4 Dec 2014 18:34:23 +0000 (+0000) Subject: mon: mkfs compatset may be different from runtime compatset X-Git-Tag: v0.93~270^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0a369b9bb266a29fa0ca7a19caf9ab36150b2c6b;p=ceph.git mon: mkfs compatset may be different from runtime compatset When we create a monitor we set a given number of compat features on disk to clearly state the features a given monitor supports -- mostly to break backward compatibility when such compatibility cannot be guaranteed. However, we may wish to toggle some features during runtime; e.g., wait for all the monitors in the quorum to support a given feature before flipping a switch and state that all monitors now require feature X. We are already flipping those switches during runtime, but we weren't allowing the monitor to set a subset of those features during mkfs. While the initial approach worked fine with clusters being upgraded and fresh clusters, it could become weird in a mixed-version environment. Backport: emperor,firefly,giant Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 1c26350b74c..5480c8579b3 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -341,20 +341,26 @@ void Monitor::handle_signal(int signum) shutdown(); } -CompatSet Monitor::get_supported_features() +CompatSet Monitor::get_initial_supported_features() { CompatSet::FeatureSet ceph_mon_feature_compat; CompatSet::FeatureSet ceph_mon_feature_ro_compat; CompatSet::FeatureSet ceph_mon_feature_incompat; ceph_mon_feature_incompat.insert(CEPH_MON_FEATURE_INCOMPAT_BASE); ceph_mon_feature_incompat.insert(CEPH_MON_FEATURE_INCOMPAT_SINGLE_PAXOS); - ceph_mon_feature_incompat.insert(CEPH_MON_FEATURE_INCOMPAT_OSD_ERASURE_CODES); - ceph_mon_feature_incompat.insert(CEPH_MON_FEATURE_INCOMPAT_OSDMAP_ENC); - ceph_mon_feature_incompat.insert(CEPH_MON_FEATURE_INCOMPAT_ERASURE_CODE_PLUGINS_V2); return CompatSet(ceph_mon_feature_compat, ceph_mon_feature_ro_compat, ceph_mon_feature_incompat); } +CompatSet Monitor::get_supported_features() +{ + CompatSet compat = get_initial_supported_features(); + compat.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_OSD_ERASURE_CODES); + compat.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_OSDMAP_ENC); + compat.incompat.insert(CEPH_MON_FEATURE_INCOMPAT_ERASURE_CODE_PLUGINS_V2); + return compat; +} + CompatSet Monitor::get_legacy_features() { CompatSet::FeatureSet ceph_mon_feature_compat; @@ -4237,7 +4243,7 @@ int Monitor::mkfs(bufferlist& osdmapbl) t->put(MONITOR_NAME, "magic", magicbl); - features = get_supported_features(); + features = get_initial_supported_features(); write_features(t); // save monmap, osdmap, keyring. diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index d60d46dfabb..657aece3b34 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -796,6 +796,7 @@ public: void extract_save_mon_key(KeyRing& keyring); // features + static CompatSet get_initial_supported_features(); static CompatSet get_supported_features(); static CompatSet get_legacy_features(); /// read the ondisk features into the CompatSet pointed to by read_features