Skip to content

Leader elections never start after a leader is lost if there is a member with election_mode = 'off' in the replica set #12018

@sergepetrenko

Description

@sergepetrenko

Bug description

Nodes with election_mode = 'off' do not have a leader tracking timer, but continue broadcasting leader_is_seen = true.

This prevents leader reelection in case of a mixed setup, where some nodes have election_mode = 'off' and others have election_mode = 'candidate', since the candidates won't start the elections until at least one node reports that it sees the leader, and the election_mode = 'off' node will forever report the leader as seen.

Reproducer: start 4 tarantool instances in separate consoles, configure 3 of them as candidates, and one with election_mode = 'off', also set replication_synchro_quorum = 2. Then kill the elected leader. No new leader will emerge:

--
-- Instance 1.
--
-- Step 1.
box.cfg{
    listen = 3301,
    replication = {
        3301,
        3302,
        3303,
        3304,
    },
    election_mode = 'candidate',
    replication_synchro_quorum = 2,
}

-- Step 5. Execute it on the currently active leader. Might be any of the instances 1,2,3:
box.schema.user.grant('guest', 'replication')

-- Step 6. Also on the current leader.
box.info.election -- state: leader
os.exit()
--
-- Instance 2.
--
-- Step 2.
box.cfg{
    listen = 3302,
    replication = {
        3301,
        3302,
        3303,
        3304,
    },
    election_mode = 'candidate',
    replication_synchro_quorum = 2,
}

-- Step 7.
box.info.election -- state: follower
--
-- Instance 3.
--
-- Step 3.
box.cfg{
    listen = 3303,
    replication = {
        3301,
        3302,
        3303,
        3304,
    },
    election_mode = 'candidate',
    replication_synchro_quorum = 2,
}

-- Step 8.
box.info.election -- state: follower
--
-- Instance 4.
--
-- Step 4.
box.cfg{
    listen = 3304,
    replication = {
        3301,
        3302,
        3303,
        3304,
    },
    election_mode = 'off',
    replication_synchro_quorum = 2,
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingraftRAFT protocolreplication

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions