From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (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 90DBD42EF5C for ; Sun, 21 Jun 2020 19:25:02 +0300 (MSK) References: From: Vladislav Shpilevoy Message-ID: <409bc44b-2b6b-1d49-f8c7-82f979480b2f@tarantool.org> Date: Sun, 21 Jun 2020 18:25:00 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH 3/8] txn: add TXN_WAIT_ACK flag List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leonid Vasiliev , Serge Petrenko , sergos@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org Thanks for the review! >>       stailq_foreach_entry(stmt, &txn->stmts, next) { >>           if (stmt->has_triggers) { >>               txn_init_triggers(txn); >>               rlist_splice(&txn->on_commit, &stmt->on_commit); >>           } >> +        is_sync = is_sync || stmt->space->def->opts.is_sync; > > Seems like > "... || (stmt->space != NULL && stmt->space->def->opts.is_sync);" > can be moved here from "replication: make sync transactions wait quorum". > > LGTM. I don't think it is a good idea. At this commit stmt->space can't be NULL. This becomes possible only after Sergey P. starts using txns to write confirm and rollback entries, which don't relate to any space. However I changed this place - I moved is_sync calculation after stmt->row == NULL check. So as a read from a sync space wouldn't turn the transaction into a synchronous one: ==================== commit e29fd482e0954913b87776d0a83ba04ef14683d8 Author: Vladislav Shpilevoy Date: Sun Jun 21 18:12:53 2020 +0200 txn: don't do sync flag calculation for read statements [TO BE SQUASHED INTO THE PREVIOUS COMMIT] diff --git a/src/box/txn.c b/src/box/txn.c index b50e7c1f8..22591a365 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -502,12 +502,13 @@ txn_journal_entry_new(struct txn *txn) txn_init_triggers(txn); rlist_splice(&txn->on_commit, &stmt->on_commit); } - is_sync = is_sync || stmt->space->def->opts.is_sync; /* A read (e.g. select) request */ if (stmt->row == NULL) continue; + is_sync = is_sync || stmt->space->def->opts.is_sync; + if (stmt->row->replica_id == 0) *local_row++ = stmt->row; else