From: Sage Weil Date: Fri, 26 Apr 2013 18:12:53 +0000 (-0700) Subject: mon: fix Monitor::pick_random_mon() X-Git-Tag: v0.62~54 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=741f46852380c8e75669f6d7bf1202adad0358fb;p=ceph.git mon: fix Monitor::pick_random_mon() The other arg isn't used, so remove the (broken) handling for that case. If we re-add it later, model after the MonClient's version. Fixes: #4821 Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index aabf5f1eb76f..27682ffbd964 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1034,7 +1034,7 @@ void Monitor::handle_sync_finish(MMonSync *m) // synchronization provider -string Monitor::_pick_random_mon(int other) +string Monitor::_pick_random_mon() { assert(monmap->size() > 0); if (monmap->size() == 1) @@ -1042,8 +1042,6 @@ string Monitor::_pick_random_mon(int other) int max = monmap->size(); int n = sync_rng() % max; - if (other >= 0 && n >= other) - n++; return monmap->get_name(n); } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index 1a19914ba927..71f3a9b3e121 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -719,7 +719,7 @@ private: * @param other Any monitor other than the one with rank @p other * @returns The picked monitor's name. */ - string _pick_random_mon(int other = -1); + string _pick_random_mon(); int _pick_random_quorum_mon(int other = -1); /** * Deal with the consequences of @p entity's sync timing out.