]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon:honour last seen election epoch in win_standalone_election() 6407/head
authorrenhwztetecs <rhwlyw@163.com>
Wed, 28 Oct 2015 07:04:54 +0000 (15:04 +0800)
committerrenhwztetecs <sky@renhuanwentekiMacBook-Pro.local>
Sat, 31 Oct 2015 05:12:08 +0000 (13:12 +0800)
add the elector.init() and elector.get_epoch() into Monitor::win_standalone_election() to initialise the new election epoch with last election epoch+1

Fixes: #13627
Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
src/mon/Monitor.cc

index 58b13cf9294f5ff9fc1a3873c75ef490da53a1c7..2aab566c0341b536ce4dbe08c055e210002d4b86 100644 (file)
@@ -1812,6 +1812,7 @@ void Monitor::win_standalone_election()
 
   // bump election epoch, in case the previous epoch included other
   // monitors; we need to be able to make the distinction.
+  elector.init();
   elector.advance_epoch();
 
   rank = monmap->get_rank(name);
@@ -1822,7 +1823,7 @@ void Monitor::win_standalone_election()
   const MonCommand *my_cmds;
   int cmdsize;
   get_locally_supported_monitor_commands(&my_cmds, &cmdsize);
-  win_election(1, q, CEPH_FEATURES_ALL, my_cmds, cmdsize, NULL);
+  win_election(elector.get_epoch(), q, CEPH_FEATURES_ALL, my_cmds, cmdsize, NULL);
 }
 
 const utime_t& Monitor::get_leader_since() const