diff options
author | Greg Farnum <greg@inktank.com> | 2013-04-26 12:32:10 -0700 |
---|---|---|
committer | Greg Farnum <greg@inktank.com> | 2013-04-26 12:32:10 -0700 |
commit | 5fa3cbf520f5aeb9e0101c1263f681542d3069a5 (patch) | |
tree | 4b2434b73a343effa6b06e1903fb025cb65becbf | |
parent | 56ac098b88962a0cbeddfd0fc6cecf03dc4e1df0 (diff) | |
download | ceph-5fa3cbf520f5aeb9e0101c1263f681542d3069a5.tar.gz |
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 <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/mon/Monitor.cc | 11 |
1 files changed, 11 insertions, 0 deletions
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; |