]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mon: fix Monitor::pick_random_mon()"
authorSage Weil <sage@inktank.com>
Thu, 2 May 2013 20:33:36 +0000 (13:33 -0700)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 20:33:36 +0000 (13:33 -0700)
This reverts commit 741f46852380c8e75669f6d7bf1202adad0358fb.

This is fixed in next; revert this to avoid a conflict.

Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index a9b293571e8464f886cd88dae93bc6c654fc385f..dd490948b455449dd92eb61e219ece1cb9096ff9 100644 (file)
@@ -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);
 }
 
index 71f3a9b3e12110aaed7288ea16987c743c1c53a9..1a19914ba9271bdac6d516b6f1bad21f1a346381 100644 (file)
@@ -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.