self.assertEqual(mds_0['gid'], self.fs.get_rank(rank=0)['gid'])
self.fs.rank_freeze(False, rank=0)
+ def test_connect_bootstrapping(self):
+ self.config_set("mds", "mds_sleep_rank_change", 10000000.0)
+ self.config_set("mds", "mds_connect_bootstrapping", True)
+ self.fs.set_max_mds(2)
+ self.fs.wait_for_daemons()
+ self.fs.rank_fail(rank=0)
+ # rank 0 will get stuck in up:resolve, see https://tracker.ceph.com/issues/53194
+ self.fs.wait_for_daemons()
+
+
class TestStandbyReplay(CephFSTestCase):
CLIENTS_REQUIRED = 0
MDSS_REQUIRED = 4
if (oldstate != state) {
// update messenger.
- if (state == MDSMap::STATE_STANDBY_REPLAY) {
+ auto sleep_rank_change = g_conf().get_val<double>("mds_sleep_rank_change");
+ if (unlikely(sleep_rank_change > 0)) {
+ // This is to trigger a race where another rank tries to connect to this
+ // MDS before an update to the messenger "myname" is processed. This race
+ // should be closed by ranks holding messages until the rank is out of a
+ // "bootstrapping" state.
+ usleep(sleep_rank_change);
+ } if (state == MDSMap::STATE_STANDBY_REPLAY) {
dout(1) << "handle_mds_map i am now mds." << mds_gid << "." << incarnation
- << " replaying mds." << whoami << "." << incarnation << dendl;
+ << " replaying mds." << whoami << "." << incarnation << dendl;
messenger->set_myname(entity_name_t::MDS(mds_gid));
} else {
dout(1) << "handle_mds_map i am now mds." << whoami << "." << incarnation << dendl;
}
}
+ // for testing...
+ if (unlikely(g_conf().get_val<bool>("mds_connect_bootstrapping"))) {
+ std::set<mds_rank_t> bootstrapping;
+ mdsmap->get_mds_set(bootstrapping, MDSMap::STATE_REPLAY);
+ mdsmap->get_mds_set(bootstrapping, MDSMap::STATE_CREATING);
+ mdsmap->get_mds_set(bootstrapping, MDSMap::STATE_STARTING);
+ for (const auto& rank : bootstrapping) {
+ auto m = make_message<MMDSMap>(monc->get_fsid(), *mdsmap);
+ send_message_mds(std::move(m), rank);
+ }
+ }
+
// did someone go active?
if (state >= MDSMap::STATE_CLIENTREPLAY &&
oldstate >= MDSMap::STATE_CLIENTREPLAY) {