[Tarantool-patches] [PATCH 1/1] election: fix box.ctl.promote() crash on 0 LSN

Sergey Petrenko sergepetrenko at tarantool.org
Sun Jul 25 20:41:38 MSK 2021


23.07.2021 02:31, Vladislav Shpilevoy пишет:
> box.ctl.promote() in case of non-empty limbo tried to wait for
> quorum of instances confirming that they have received the latest
> data.
>
> The quorum waiting is done via walking the relays and filling a
> vclock object using vclock_follow with the old leader's LSN as it
> is seen by the replicas.
>
> Some replicas might have vclock[old_leader_id] == 0 if they didn't
> receive anything from it. Vclock_follow() crashed at attempt to
> follow these 0 LSNs, because it is initialized with zeros, and
> in vclock_follow() it has an assert: new_lsn > old_lsn. This
> resulted into 0 > 0 and the crash.
>
> The patch makes the quorum collector skip these 0 LSNs.
>
> Part of #5430


Hi! Thanks for the patch!


...

> diff --git a/test/replication/gh-5430-master1.lua b/test/replication/gh-5430-master1.lua
> new file mode 100644
> index 000000000..0f57c87c1
> --- /dev/null
> +++ b/test/replication/gh-5430-master1.lua
> @@ -0,0 +1,15 @@
> +#!/usr/bin/env tarantool
> +
> +require('console').listen(os.getenv('ADMIN'))
> +
> +box.cfg({
> +    listen = 'unix/:./master1.sock',
> +    replication = {
> +        'unix/:./master1.sock',
> +        'unix/:./master2.sock',
> +    },
> +    replication_synchro_quorum = 2,
> +    replication_timeout = 0.5,
> +})
> +
> +box.schema.user.grant('guest', 'super')
> diff --git a/test/replication/gh-5430-master2.lua b/test/replication/gh-5430-master2.lua
> new file mode 100644
> index 000000000..b1aeccfe0
> --- /dev/null
> +++ b/test/replication/gh-5430-master2.lua
> @@ -0,0 +1,14 @@
> +#!/usr/bin/env tarantool
> +
> +require('console').listen(os.getenv('ADMIN'))
> +
> +box.cfg({
> +    listen = 'unix/:./master2.sock',
> +    replication = {
> +        'unix/:./master1.sock',
> +        'unix/:./master2.sock',
> +    },
> +    read_only = true,
> +    replication_synchro_quorum = 2,
> +    replication_timeout = 0.5,
> +})
> diff --git a/test/replication/gh-5430-master3.lua b/test/replication/gh-5430-master3.lua
> new file mode 100644
> index 000000000..eff479a68
> --- /dev/null
> +++ b/test/replication/gh-5430-master3.lua
> @@ -0,0 +1,12 @@
> +#!/usr/bin/env tarantool
> +
> +require('console').listen(os.getenv('ADMIN'))
> +
> +box.cfg({
> +    listen = 'unix/:./master3.sock',
> +    replication = {
> +        'unix/:./master1.sock',
> +    },
> +    replication_synchro_quorum = 3,
> +    replication_timeout = 0.5,
> +})


I'd create a single lua file, gh-5430-master.lua, and 3 symlinks.

listening socket may be deduced from filename, and

replication_synchro_quorum might be passed as a parameter.


I don't insist, LGTM anyways.



More information about the Tarantool-patches mailing list