From: Oleg Babin <olegrok@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
tarantool-patches@dev.tarantool.org,
yaroslav.dynnikov@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 vshard 1/2] storage: fix reload applying migration twice
Date: Thu, 6 Aug 2020 09:40:02 +0300 [thread overview]
Message-ID: <6179c32d-0970-db1b-09a4-178d8ab102b0@tarantool.org> (raw)
In-Reply-To: <b4f5ab11512f819d0dfc6d09cc5b68243f74678c.1596665591.git.v.shpilevoy@tarantool.org>
Hi! Thanks for your patch. LGTM.
On 06/08/2020 01:15, Vladislav Shpilevoy wrote:
> Reload evolution is a subsystem for storage hot code reload. When
> code is reloaded, it applies migration scripts one by one. But
> there was a bug - the last migration script was applied even when
> code version didn't really change.
>
> The bug didn't affect anything, since so far the reload evolution
> was not used for anything and had just one dummy migration script
> doing nothing.
>
> Now a first migration script is going to be added, so the bug is
> fixed before that.
>
> Needed for #237
> ---
> test/reload_evolution/storage.result | 6 +++++-
> test/reload_evolution/storage.test.lua | 6 +++++-
> vshard/storage/reload_evolution.lua | 2 +-
> 3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/test/reload_evolution/storage.result b/test/reload_evolution/storage.result
> index ebf4fdc..dde0a1f 100644
> --- a/test/reload_evolution/storage.result
> +++ b/test/reload_evolution/storage.result
> @@ -86,7 +86,11 @@ package.loaded['vshard.storage'] = nil
> vshard.storage = require("vshard.storage")
> ---
> ...
> -test_run:grep_log('storage_2_a', 'vshard.storage.reload_evolution: upgraded to') ~= nil
> +-- Should be nil. Because there was a bug that reload always reapplied the last
> +-- migration callback. When it was fixed, the last callback wasn't called twice.
> +-- But since the callback was only one, now nothing is called, and nothing is
> +-- logged.
> +test_run:grep_log('storage_2_a', 'vshard.storage.reload_evolution: upgraded to') == nil
> ---
> - true
> ...
> diff --git a/test/reload_evolution/storage.test.lua b/test/reload_evolution/storage.test.lua
> index 56c1693..7858112 100644
> --- a/test/reload_evolution/storage.test.lua
> +++ b/test/reload_evolution/storage.test.lua
> @@ -35,7 +35,11 @@ box.space.test:insert({42, bucket_id_to_move})
> package.path = original_package_path
> package.loaded['vshard.storage'] = nil
> vshard.storage = require("vshard.storage")
> -test_run:grep_log('storage_2_a', 'vshard.storage.reload_evolution: upgraded to') ~= nil
> +-- Should be nil. Because there was a bug that reload always reapplied the last
> +-- migration callback. When it was fixed, the last callback wasn't called twice.
> +-- But since the callback was only one, now nothing is called, and nothing is
> +-- logged.
> +test_run:grep_log('storage_2_a', 'vshard.storage.reload_evolution: upgraded to') == nil
> vshard.storage.internal.reload_version
> -- Make sure storage operates well.
> vshard.storage.bucket_force_drop(2000)
> diff --git a/vshard/storage/reload_evolution.lua b/vshard/storage/reload_evolution.lua
> index 5d09b11..1abc9e2 100644
> --- a/vshard/storage/reload_evolution.lua
> +++ b/vshard/storage/reload_evolution.lua
> @@ -33,7 +33,7 @@ local function upgrade(M)
> log.error(err_msg)
> error(err_msg)
> end
> - for i = start_version, #migrations do
> + for i = start_version + 1, #migrations do
> local ok, err = pcall(migrations[i], M)
> if ok then
> log.info('vshard.storage.reload_evolution: upgraded to %d version',
next prev parent reply other threads:[~2020-08-06 6:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-05 22:15 [Tarantool-patches] [PATCH v2 vshard 0/2] storage: allow replica to boot before master Vladislav Shpilevoy
2020-08-05 22:15 ` [Tarantool-patches] [PATCH v2 vshard 1/2] storage: fix reload applying migration twice Vladislav Shpilevoy
2020-08-06 6:40 ` Oleg Babin [this message]
2020-08-06 8:29 ` Yaroslav Dynnikov
2020-08-05 22:15 ` [Tarantool-patches] [PATCH v2 vshard 2/2] storage: allow replica to boot before master Vladislav Shpilevoy
2020-08-06 6:40 ` Oleg Babin
2020-08-06 8:30 ` Yaroslav Dynnikov
2020-08-06 19:57 ` [Tarantool-patches] [PATCH v2 vshard 0/2] " Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6179c32d-0970-db1b-09a4-178d8ab102b0@tarantool.org \
--to=olegrok@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--cc=yaroslav.dynnikov@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 vshard 1/2] storage: fix reload applying migration twice' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox