From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Serge Petrenko <sergepetrenko@tarantool.org>,
tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 4/5] [tosquash] replication: rework how local transactions wait sync
Date: Sun, 5 Jul 2020 17:13:42 +0200 [thread overview]
Message-ID: <de0f0783-da44-ed01-cc6c-ce834897bd1d@tarantool.org> (raw)
In-Reply-To: <09a2d0b1-4c7e-635a-6c9c-8a3627736ed1@tarantool.org>
>> diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c
>> index 387cfd337..44a0c7273 100644
>> --- a/src/box/txn_limbo.c
>> +++ b/src/box/txn_limbo.c
>> @@ -316,7 +320,7 @@ txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn)
>> assert(limbo->instance_id != REPLICA_ID_NIL);
>> struct txn_limbo_entry *e, *tmp;
>> rlist_foreach_entry_safe_reverse(e, &limbo->queue, in_queue, tmp) {
>> - if (e->lsn <= lsn)
>> + if (e->lsn <= lsn && txn_has_flag(e->txn, TXN_WAIT_ACK))
>> break;
>
> Are you rolling back the async transactions that are before the last sync
> transaction to be rolled back? Why?
> Shouldn't this condition stay the same?
Да, похоже на баг. Оставить без изменений не выйдет - у асинхронных
транзакций в лимбе лсн -1. Так что на первой асинхронной транзакции
роллбек остановится, даже если надо идти дальше. Я сделал как в
confirm в итоге. Сначала находим докуда откат. Потом делаем откат.
Тест пока не придумал. Мастер откатывает сейчас либо все, либо ничего.
Потому как откат только по таймауту, а значит всегда с самой первой.
====================
--- a/src/box/txn_limbo.c
+++ b/src/box/txn_limbo.c
@@ -319,9 +319,17 @@ txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn)
{
assert(limbo->instance_id != REPLICA_ID_NIL);
struct txn_limbo_entry *e, *tmp;
- rlist_foreach_entry_safe_reverse(e, &limbo->queue, in_queue, tmp) {
- if (e->lsn <= lsn && txn_has_flag(e->txn, TXN_WAIT_ACK))
+ struct txn_limbo_entry *last_rollback = NULL;
+ rlist_foreach_entry_reverse(e, &limbo->queue, in_queue) {
+ if (!txn_has_flag(e->txn, TXN_WAIT_ACK))
+ continue;
+ if (e->lsn <= lsn)
break;
+ last_rollback = e;
+ }
+ if (last_rollback == NULL)
+ return;
+ rlist_foreach_entry_safe_reverse(e, &limbo->queue, in_queue, tmp) {
e->is_rollback = true;
txn_limbo_pop(limbo, e);
txn_clear_flag(e->txn, TXN_WAIT_SYNC);
@@ -342,6 +350,8 @@ txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn)
txn_complete(e->txn);
e->txn->fiber = fiber;
}
+ if (e == last_rollback)
+ break;
}
}
next prev parent reply other threads:[~2020-07-05 15:13 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-02 23:40 [Tarantool-patches] [PATCH 0/5] Qsync: local rows fixes Vladislav Shpilevoy
2020-07-02 23:40 ` [Tarantool-patches] [PATCH 1/5] [tosquash] replication: fix multiple rollbacks Vladislav Shpilevoy
2020-07-05 9:34 ` Serge Petrenko
2020-07-05 15:13 ` Vladislav Shpilevoy
2020-07-02 23:40 ` [Tarantool-patches] [PATCH 2/5] [tosquash] applier: remove unnecessary fiber name check Vladislav Shpilevoy
2020-07-05 8:40 ` Serge Petrenko
2020-07-02 23:40 ` [Tarantool-patches] [PATCH 3/5] [tosquash] txn_limbo: fix release build Vladislav Shpilevoy
2020-07-05 8:41 ` Serge Petrenko
2020-07-02 23:40 ` [Tarantool-patches] [PATCH 4/5] [tosquash] replication: rework how local transactions wait sync Vladislav Shpilevoy
2020-07-05 9:04 ` Serge Petrenko
2020-07-05 15:13 ` Vladislav Shpilevoy [this message]
2020-07-02 23:40 ` [Tarantool-patches] [PATCH 5/5] [tosquash] replication: add test on local row in the end of sync txn Vladislav Shpilevoy
2020-07-05 9:11 ` Serge Petrenko
2020-07-05 15:13 ` 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=de0f0783-da44-ed01-cc6c-ce834897bd1d@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=sergepetrenko@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH 4/5] [tosquash] replication: rework how local transactions wait sync' \
/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