From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 A767E42EF5C for ; Fri, 26 Jun 2020 01:14:18 +0300 (MSK) References: <16c9d1ffb9d09bb2b2f206a23973e2734616c345.1592482315.git.sergepetrenko@tarantool.org> From: Vladislav Shpilevoy Message-ID: <81acf9b0-5fca-7be5-cd27-73cf45edbb4a@tarantool.org> Date: Fri, 26 Jun 2020 00:14:16 +0200 MIME-Version: 1.0 In-Reply-To: <16c9d1ffb9d09bb2b2f206a23973e2734616c345.1592482315.git.sergepetrenko@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH 4/4] txn_limbo: add ROLLBACK processing List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Serge Petrenko , gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org > diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c > index a715a136e..c55f5bda1 100644 > --- a/src/box/txn_limbo.c > +++ b/src/box/txn_limbo.c > @@ -191,6 +244,38 @@ txn_limbo_read_confirm(struct txn_limbo *limbo, int64_t lsn) > +void > +txn_limbo_read_rollback(struct txn_limbo *limbo, int64_t lsn) > +{ > + assert(limbo->instance_id != REPLICA_ID_NIL && > + limbo->instance_id != instance_id); > + struct txn_limbo_entry *e, *tmp; > + rlist_foreach_entry_safe_reverse(e, &limbo->queue, in_queue, tmp) { > + if (e->lsn < lsn) > + break; Shouldn't this be 'continue' instead of 'break'? As I understand rollback, we need to find entry, *from* which all the entries will be rolled back. Here it seems that if the oldest entry in the limbo (with the smallest LSN) is smaller than rollback lsn, we just won't rollback anything. > + assert(e->txn->fiber == NULL); > + e->is_rollback = true; > + txn_limbo_pop(limbo, e); > + txn_clear_flag(e->txn, TXN_WAIT_ACK); > + > + /* Rollback the transaction. */ > + e->txn->signature = -1; > + txn_complete(e->txn); > + } > +}