From 5fa3cbf520f5aeb9e0101c1263f681542d3069a5 Mon Sep 17 00:00:00 2001 From: Greg Farnum Date: Fri, 26 Apr 2013 12:32:10 -0700 Subject: [PATCH] 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 --- src/mon/Monitor.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index c2cde236de2..787a804db0c 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; -- 2.47.3