From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp53.i.mail.ru (smtp53.i.mail.ru [94.100.177.113]) (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 32D0942EF5E for ; Thu, 18 Jun 2020 15:14:23 +0300 (MSK) From: Serge Petrenko Date: Thu, 18 Jun 2020 15:14:02 +0300 Message-Id: <87405668347f9bc403be22ba13b4d0a4fdbb80a2.1592482315.git.sergepetrenko@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 3/4] txn_limbo: add timeout when waiting for acks. List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Now txn_limbo_wait_complete() waits for acks only for txn_limbo_confirm_timeout seconds. If a timeout is reached, the entry and all the ones following it must be rolled back. Part-of #4848 --- src/box/txn_limbo.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/box/txn_limbo.c b/src/box/txn_limbo.c index b45068fdd..a715a136e 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -128,12 +128,13 @@ txn_limbo_wait_complete(struct txn_limbo *limbo, struct txn_limbo_entry *entry) return; } bool cancellable = fiber_set_cancellable(false); - while (!txn_limbo_entry_is_complete(entry)) - fiber_yield(); + bool timed_out = fiber_yield_timeout(txn_limbo_confirm_timeout(limbo)); fiber_set_cancellable(cancellable); - // TODO: implement rollback. - assert(!entry->is_rollback); - assert(entry->is_commit); + if (timed_out) { + // TODO: implement rollback. + entry->is_rollback = true; + } + assert(txn_limbo_entry_is_complete(entry)); txn_limbo_remove(limbo, entry); txn_clear_flag(txn, TXN_WAIT_ACK); } -- 2.24.3 (Apple Git-128)