From: Greg Farnum Date: Fri, 26 Apr 2013 19:32:10 +0000 (-0700) Subject: mon: use brute force to find a sync provider if our first one fails X-Git-Tag: v0.61~87 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5fa3cbf520f5aeb9e0101c1263f681542d3069a5;p=ceph.git mon: use brute force to find a sync provider if our first one fails We try and select a random monitor first, but if that fails we should make sure that nobody's available before asserting. Fixes #4812 Signed-off-by: Greg Farnum Reviewed-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index c2cde236de25..787a804db0ca 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1106,6 +1106,17 @@ void Monitor::sync_timeout(entity_inst_t &entity) } } + // well that sucks. Let's see if we can find a monitor to connect to + for (int i = 0; i < monmap->size(); ++i) { + entity_inst_t i_inst = monmap->get_inst(i); + if (i != rank && i_inst != entity) { + sync_provider->entity = i_inst; + sync_state = SYNC_STATE_START; + sync_start_chunks(sync_provider); + return; + } + } + assert(0 == "Unable to find a new monitor to connect to. Not cool."); } else if (sync_role & SYNC_ROLE_PROVIDER) { dout(10) << __func__ << " cleanup " << entity << dendl;