From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 73C6942EF6C for ; Tue, 30 Jun 2020 02:16:03 +0300 (MSK) From: Vladislav Shpilevoy Date: Tue, 30 Jun 2020 01:15:28 +0200 Message-Id: <5b689fa1c2e9931860094026333e8a171c4cf90a.1593472477.git.v.shpilevoy@tarantool.org> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v2 09/19] txn_limbo: add timeout when waiting for acks. List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org From: Serge Petrenko 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 bee8e8155..ac57fd1bd 100644 --- a/src/box/txn_limbo.c +++ b/src/box/txn_limbo.c @@ -130,12 +130,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.21.1 (Apple Git-122.3)