Skip to content
Snippets Groups Projects
  1. Aug 17, 2021
    • Serge Petrenko's avatar
      replication: fix flaky election_basic test · fc3e6986
      Serge Petrenko authored
      Found the following error in our CI:
      
       Test failed! Result content mismatch:
       --- replication/election_basic.result	Fri Aug 13 13:50:26 2021
       +++ /build/usr/src/debug/tarantool-2.9.0.276/test/var/rejects/replication/election_basic.reject	Sat Aug 14 08:14:17 2021
       @@ -116,6 +116,7 @@
         | ...
        box.ctl.demote()
         | ---
       + | - error: box.ctl.demote does not support simultaneous invocations
         | ...
        --
      
      Even though box.ctl.demote() or box.ctl.promote() isn't called above the
      failing line, promote() is issued internally once the instance becomes
      the leader.
      
      Wait until previous promote is finished
      (i.e. box.info.synchro.queue.owner is set)
      fc3e6986
  2. Aug 06, 2021
    • Serge Petrenko's avatar
      box: introduce `box.ctl.demote` · cdb234e1
      Serge Petrenko authored
      Introduce a new journal entry, DEMOTE. The entry has the same meaning as
      PROMOTE, with the only difference that it clears limbo ownership instead
      of transferring it to the issuer.
      
      Introduce `box.ctl.demote`, a counterpart to `box.ctl.promote`, which
      clears the limbo ownership (when elections are off) via writing the DEMOTE, or
      simply makes this instance step down from the leader's role (when elections
      are enabled in any mode).
      
      A new request was necessary instead of simply writing PROMOTE(origin_id
      = 0), because origin_id is deduced from row.replica_id, which cannot be
      0 for replicated rows (it's always equal to instance_id of the row
      originator).
      
      Closes #6034
      
      @TarantoolBot document
      Title: box.ctl.demote
      
      `box.ctl.demote()` is a counterpart to `box.ctl.promote()` which works
      as follows:
       - when `box.cfg.election_mode` is not 'off': make the instance give up
         leadership.
       - when `box.cfg.election_mode` is 'off': write a DEMOTE entry to WAL.
      
      `box.ctl.demote()` may only be issued on the synchronous transaction
      queue owner (i.e. leader when elections are enabled).
      
      A DEMOTE request (DEMOTE = 32) copies PROMOTE behaviour (it clears the
      limbo as well), but clears the synchronous transaction queue  ownership instead
      of assigning it to a new instance.
      cdb234e1
  3. Aug 05, 2021
    • Serge Petrenko's avatar
      box: introduce on_election triggers · 7f5876fa
      Serge Petrenko authored
      On_election triggers are fired asynchronously after any Raft event with
      a broadcast, they are run in a worker fiber, so it's allowed to yield
      inside them, unlike Raft's on_update triggers we already had.
      
      Closes #5819
      
      @TarantoolBot document
      Title: document triggers on election state change
      
      A new function to register triggers is added, `box.ctl.on_election()`.
      Triggers registered via this function are run asynchronously every time
      a visible change in `box.info.election` table appears.
      No parameters are passed to the trigger, it may check what's changed by
      looking at `box.info.election` and `box.info.synchro`.
      7f5876fa
  4. Jun 18, 2021
    • Alxander V. Tikhonov's avatar
      test: flaky election_basic.test.lua test · 9951a20a
      Alxander V. Tikhonov authored
      Found that on slow test hosts like FreeBSD VMware test flaky failed, like:
      
        [001] @@ -153,7 +153,7 @@
        [001]   | ...
        [001]  assert(leader_count == 1)
        [001]   | ---
        [001] - | - true
        [001] + | - error: assertion failed!
        [001]   | ...
        [001]  -- All nodes have the same leader.
        [001]  r1_leader = test_run:eval('election_replica1', leader_id_cmd)[1]
      
      It happened because there was not enough time right after wait_fullmesh()
      call and before check of the current leader to make any of the replicas
      leader. Later in the code was not correct logic when checked who is the
      leader and choosed 'election_replica3' if not the others, it caused the
      later fails in the test. Decided to wait after wait_fullmesh() when any
      of the replicas became leader using test_cond() routine.
      
      Closes #5368
      9951a20a
  5. Apr 21, 2021
    • Serge Petrenko's avatar
      election: introduce a new election mode: "manual" · a9b84f32
      Serge Petrenko authored
      When an instance is configured in "manual" election mode, it behaves as
      a voter for most of the time, until `box.ctl.promote()` is called.
      
      Once `box.ctl.promote()` is called the instance will behave as a
      candidate for a full election round, e.g. until the leader is known. If
      the instance wins the elections, it remains in `leader` state until the
      next elections. Otherwise the instance returns to `voter` state.
      
      Follow-up #5445
      Part of #3055
      a9b84f32
  6. Nov 10, 2020
    • Vladislav Shpilevoy's avatar
      test: fix a typo in election_basic · 455c6d18
      Vladislav Shpilevoy authored
      The typo led to not resetting the election timeout to the default
      value. It was left 1000, and as a result the next election tests
      could work extremely long.
      
      Part of #5499
      455c6d18
  7. Oct 12, 2020
    • Vladislav Shpilevoy's avatar
      raft: introduce election_mode configuration option · 24974f36
      Vladislav Shpilevoy authored
      The new option can be one of 3 values: 'off', 'candidate',
      'voter'. It replaces 2 old options: election_is_enabled and
      election_is_candidate. These flags looked strange, that it was
      possible to set candidate true, but disable election at the same
      time. Also it would not look good if we would ever decide to
      introduce another mode like a data-less sentinel node, for
      example. Just for voting.
      
      Anyway, the single option approach looks easier to configure and
      to extend.
      
      - 'off' means the election is disabled on the node. It is the same
        as election_is_enabled = false in the old config;
      
      - 'voter' means the node can vote and is never writable. The same
        as election_is_enabled = true + election_is_candidate = false in
        the old config;
      
      - 'candidate' means the node is a full-featured cluster member,
        which eventually may become a leader. The same as
        election_is_enabled = true + election_is_candidate = true in the
        old config.
      
      Part of #1146
      24974f36
  8. Sep 29, 2020
Loading