From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 01F11445320 for ; Sun, 5 Jul 2020 18:29:44 +0300 (MSK) From: Vladislav Shpilevoy References: Message-ID: Date: Sun, 5 Jul 2020 17:29:43 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v2 10/19] txn_limbo: add ROLLBACK processing List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index ac57fd1bd..680e81d3d 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c > @@ -127,33 +141,64 @@ txn_limbo_wait_complete(struct txn_limbo *limbo, struct txn_limbo_entry *entry) > -/** > - * Write a confirmation entry to WAL. After it's written all the > - * transactions waiting for confirmation may be finished. > - */ > static int > -txn_limbo_write_confirm(struct txn_limbo *limbo, struct txn_limbo_entry *entry) > +txn_limbo_write_confirm_rollback(struct txn_limbo *limbo, > + struct txn_limbo_entry *entry, > + bool is_confirm) > { > struct xrow_header row; > struct request request = { > .header = &row, > }; > > - if (xrow_encode_confirm(&row, limbo->instance_id, entry->lsn) < 0) > + int res = 0; > + if (is_confirm) { > + res = xrow_encode_confirm(&row, limbo->instance_id, entry->lsn); > + } else { > + /* > + * This entry is the first to be rolled back, so > + * the last "safe" lsn is entry->lsn - 1. > + */ > + res = xrow_encode_rollback(&row, limbo->instance_id, > + entry->lsn - 1); Why can't you write the exact lsn + change the check in txn_limbo_read_rollback() from if (e->lsn <= lsn) break; to if (e->lsn < lsn) break; Currently the rollback entry contains LSN which counter-intuitively shouldn't be rolled back.