From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp16.mail.ru (smtp16.mail.ru [94.100.176.153]) (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 245FE42EF5C for ; Mon, 22 Jun 2020 12:44:05 +0300 (MSK) References: <409bc44b-2b6b-1d49-f8c7-82f979480b2f@tarantool.org> From: Serge Petrenko Message-ID: <9c56561d-554c-d6a9-3bf8-c942ee528073@tarantool.org> Date: Mon, 22 Jun 2020 12:44:04 +0300 MIME-Version: 1.0 In-Reply-To: <409bc44b-2b6b-1d49-f8c7-82f979480b2f@tarantool.org> Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: 8bit Content-Language: en-GB 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: Vladislav Shpilevoy , Leonid Vasiliev , sergos@tarantool.org, gorcunov@gmail.com Cc: tarantool-patches@dev.tarantool.org 21.06.2020 19:25, Vladislav Shpilevoy пишет: > 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. Actually, stmt->space is NULL for NOPs. > > 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 > -- Serge Petrenko