tarantool / tarantool/tarantool

Applier remains stopped after replica rebootstrap

Open
#13,134 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.7k
Forks
419
Avg merge
1d 23h
Merged PRs (30d)
88

Description

After an unrecoverable replication error, such as ER_TUPLE_FOUND or ER_SPLIT_BRAIN, the applier is stopped. If the user rebootstraps the failed replica by wiping its data files and restarting it with the same UUID, the rebootstrap succeeds, but the applier on the other instance remains stopped.

As a result, replication is restored only in one direction. The user has to restart replication manually, which is not obvious: the same error remains visible after rebootstrap, so the user may assume that the rebootstrap failed and try restarting or rebootstrapping the replica again.

We should probably add a mechanism for automatically restarting the applier in this case.

Reproducer:

-- Instance 1.
-- Step 1.
box.cfg{
    listen = '127.0.0.1:3301',
    replication = {
        '127.0.0.1:3301',
        '127.0.0.1:3302',
    },
    replication_connect_timeout = 60,
}
box.schema.user.grant('guest', 'replication')

-- Step 4.
box.space._schema:insert{'asdf'}

-- Step 10.
-- Instance 2 is running after rebootstrap, but the applier on Instance 1
-- is still stopped with the original error.
box.info.replication[2].upstream
box.space._schema:get{'after_rebootstrap'}

-- Step 11.
-- After restarting replication, it works normally.
box.cfg{replication = {}}
box.cfg{replication = {
    '127.0.0.1:3301',
    '127.0.0.1:3302',
}}

box.space._schema:get{'after_rebootstrap'}


-- Instance 2.
-- Step 2.
box.cfg{
    listen = '127.0.0.1:3302',
    replication = {
        '127.0.0.1:3301',
        '127.0.0.1:3302',
    },
    instance_uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
    read_only = true,
    replication_connect_timeout = 60,
}

-- Step 3.
box.cfg{replication = ''}

-- Step 5.
box.cfg{read_only = false}
box.space._schema:insert{'asdf'}

-- Step 6.
os.exit()

-- Step 7. Wipe *.snap / *.xlog files of the replica, then restart it.

-- Step 8.
box.cfg{
    listen = '127.0.0.1:3302',
    replication = {
        '127.0.0.1:3301',
        '127.0.0.1:3302',
    },
    instance_uuid = 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa',
    replication_connect_timeout = 60,
}

-- Step 9.
box.space._schema:insert{'after_rebootstrap'}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the box.cfg replication setup and the applier state exposed by box.info.replication[2].upstream, then run the failed-replica wipe and restart sequence from the reproducer. Done means the applier on the other instance restarts automatically after rebootstrap and replication works in both directions without manually resetting box.cfg replication.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.