[Tarantool-patches] [PATCH v4 10/12] election: support manual elections in clear_synchro_queue()

Serge Petrenko sergepetrenko at tarantool.org
Mon Apr 19 15:47:10 MSK 2021



16.04.2021 19:25, Serge Petrenko пишет:

Follow-up fixes:

=============================

s.petrenko at spetrenko:~/Source/tarantool$ git diff
diff --git a/src/box/box.cc b/src/box/box.cc
index 797aa86b5..358aedd78 100644
--- a/src/box/box.cc
+++ b/src/box/box.cc
@@ -1521,9 +1521,6 @@ box_clear_synchro_queue(bool try_wait)
          */
         if (!is_box_configured)
                 return 0;
-       if (txn_limbo_replica_term(&txn_limbo, instance_id) == 
box_raft()->term)
-               return 0;
-
         bool run_elections = false;

         switch (box_election_mode) {
@@ -1535,7 +1532,8 @@ box_clear_synchro_queue(bool try_wait)
                          "manual elections");
                 return -1;
         case ELECTION_MODE_MANUAL:
-               assert(box_raft()->state == RAFT_STATE_FOLLOWER);
+               if (box_raft()->state == RAFT_STATE_LEADER)
+                       return 0;
                 run_elections = true;
                 try_wait = false;
                 break;
@@ -1550,6 +1548,10 @@ box_clear_synchro_queue(bool try_wait)
                                  "'candidate'", "manual elections");
                         return -1;
                 }
+               if (txn_limbo_replica_term(&txn_limbo, instance_id) ==
+                   box_raft()->term)
+                       return 0;
+
                 break;
         default:
                 unreachable();

-- 
Serge Petrenko



More information about the Tarantool-patches mailing list