[Tarantool-patches] [PATCH 3/3] box: remove is_local_recovery variable
Serge Petrenko
sergepetrenko at tarantool.org
Fri Apr 2 14:47:27 MSK 2021
Hi! Thanks for the patch!
02.04.2021 01:23, Vladislav Shpilevoy пишет:
> It was used so as to recover synchronous auto-commit transactions
> in an async way (not blocking the fiber). But it became not
> necessary since #5874 was fixed. Because recovery does not use
> auto-commit transactions anymore.
>
> Closes #5194
> ---
> src/box/box.cc | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/src/box/box.cc b/src/box/box.cc
> index f70a2bd0e..8eacbfebb 100644
> --- a/src/box/box.cc
> +++ b/src/box/box.cc
> @@ -125,8 +125,6 @@ static struct gc_checkpoint_ref backup_gc;
> static bool is_box_configured = false;
> static bool is_ro = true;
> static fiber_cond ro_cond;
> -/** Set to true during recovery from local files. */
> -static bool is_local_recovery = false;
>
> /**
> * The following flag is set if the instance failed to
> @@ -241,7 +239,6 @@ box_process_rw(struct request *request, struct space *space,
> goto rollback;
>
> if (is_autocommit) {
> - int res = 0;
> /*
> * During local recovery the commit procedure
> * should be async, otherwise the only fiber
> @@ -253,12 +250,7 @@ box_process_rw(struct request *request, struct space *space,
> * all during local recovery, since journal_write
> * is faked at this stage and returns immediately.
> */
The comment above doesn't belong here anymore.
I propose you move it to `wal_stream_apply_dml_row`, where
txn_commit_try_async()
is called now.
LGTM otherwise.
> - if (is_local_recovery) {
> - res = txn_commit_try_async(txn);
> - } else {
> - res = txn_commit(txn);
> - }
> - if (res < 0)
> + if (txn_commit(txn) < 0)
> goto error;
> fiber_gc();
> }
> @@ -3037,7 +3029,6 @@ local_recovery(const struct tt_uuid *instance_uuid,
> memtx = (struct memtx_engine *)engine_by_name("memtx");
> assert(memtx != NULL);
>
> - is_local_recovery = true;
> recovery_journal_create(&recovery->vclock);
>
> /*
> @@ -3096,7 +3087,6 @@ local_recovery(const struct tt_uuid *instance_uuid,
> }
> stream_guard.is_active = false;
> recovery_finalize(recovery);
> - is_local_recovery = false;
>
> /*
> * We must enable WAL before finalizing engine recovery,
--
Serge Petrenko
More information about the Tarantool-patches
mailing list