From: Sage Weil Date: Thu, 2 May 2013 20:33:36 +0000 (-0700) Subject: Revert "mon: fix Monitor::pick_random_mon()" X-Git-Tag: v0.62~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5cdd731784efa57d66a026c01add8ffa95b57c54;p=ceph.git Revert "mon: fix Monitor::pick_random_mon()" This reverts commit 741f46852380c8e75669f6d7bf1202adad0358fb. This is fixed in next; revert this to avoid a conflict. Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index a9b293571e84..dd490948b455 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -1064,7 +1064,7 @@ void Monitor::handle_sync_finish(MMonSync *m) // synchronization provider -string Monitor::_pick_random_mon() +string Monitor::_pick_random_mon(int other) { assert(monmap->size() > 0); if (monmap->size() == 1) @@ -1072,6 +1072,8 @@ string Monitor::_pick_random_mon() 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 71f3a9b3e121..1a19914ba927 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(); + string _pick_random_mon(int other = -1); int _pick_random_quorum_mon(int other = -1); /** * Deal with the consequences of @p entity's sync timing out.