From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] wal: simplify rollback
Date: Wed, 6 May 2020 10:55:22 +0300 [thread overview]
Message-ID: <20200506075522.GB51428@grain> (raw)
In-Reply-To: <e09e2aca2559cfa8c02d832ea357b9e2e9c7a3b0.1588286902.git.v.shpilevoy@tarantool.org>
On Fri, May 01, 2020 at 12:50:57AM +0200, Vladislav Shpilevoy wrote:
> From: Georgy Kirichenko <georgy@tarantool.org>
>
> Here is a summary on how and when rollback works in WAL.
>
> Rollback happens, when disk write fails. In that case the failed
> and all next transactions, sent to WAL, should be rolled back.
> Together. Following transactions should be rolled back too,
> because they could make their statements based on what they saw in
> the failed transaction. Also rollback of the failed transaction
> without rollback of the next ones can actually rewrite what they
> committed.
>
> So when rollback is started, *all* pending transactions should be
> rolled back. However if they would keep coming, the rollback would
> be infinite. This means to complete a rollback it is necessary to
> stop sending new transactions to WAL, then rollback all already
> sent. In the end allow new transactions again.
>
> Step-by-step:
>
> 1) stop accepting all new transactions in WAL thread, where
> rollback is started. All new transactions don't even try to go to
> disk. They added to rollback queue immediately after arriving to
> WAL thread.
>
> 2) tell TX thread to stop sending new transactions to WAL. So as
> the rollback queue would stop growing.
>
> 3) rollback all transactions in reverse order.
>
> 4) allow transactions again in WAL thread and TX thread.
>
> The algorithm is long, but simple and understandable. However
> implementation wasn't so easy. It was done using a 4-hop cbus
> route. 2 hops of which were supposed to clear cbus channel from
> all other cbus messages. Next two hops implemented steps 3 and 4.
> Rollback state of the WAL was signaled by checking internals of a
> preallocated cbus message.
>
> The patch makes it simpler and more straightforward. Rollback
> state is now signaled by a simple flag, and there is no a hack
> about clearing cbus channel, no touching attributes of a cbus
> message. The moment when all transactions are stopped and the last
> one has returned from WAL is visible explicitly, because the last
> sent to WAL journal entry is saved.
>
> Also there is now a single route for commit and rollback cbus
> messages, called tx_complete_batch(). This change will come in
> hand in scope of synchronous replication, when WAL write won't be
> enough for commit. And therefore 'commit' as a concept should be
> washed away from WAL's code gradually. Migrate to solely txn
> module.
> ---
> Branch: http://github.com/tarantool/tarantool/tree/gerold103/gh-4842-simplify-wal-rollback
> Issue: https://github.com/tarantool/tarantool/issues/4842
>
> During working on 4842 I managed to extract this patch from
> Georgy's branch and make it not depending on anything else. This
> is supposed to make some things in WAL simpler before they will
> get more complex because of sync replication.
I don't see any obvious errors in the patch itself. Still I'm far
from being a wal expert so might miss something in big picture, thus
Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
next prev parent reply other threads:[~2020-05-06 7:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-30 22:50 Vladislav Shpilevoy
2020-05-03 10:46 ` Konstantin Osipov
2020-05-03 16:45 ` Vladislav Shpilevoy
2020-05-03 19:30 ` Konstantin Osipov
2020-05-06 7:55 ` Cyrill Gorcunov [this message]
2020-05-06 15:38 ` Sergey Ostanevich
2020-05-06 21:43 ` Vladislav Shpilevoy
2020-05-07 10:28 ` Sergey Ostanevich
2020-05-07 21:37 ` Vladislav Shpilevoy
2020-05-08 8:12 ` Kirill Yukhin
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=20200506075522.GB51428@grain \
--to=gorcunov@gmail.com \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 1/1] wal: simplify rollback' \
/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