Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 2/3] txn: split complete into success and fail paths
Date: Mon, 2 Nov 2020 15:15:06 +0300	[thread overview]
Message-ID: <20201102121506.GB2339@grain> (raw)
In-Reply-To: <07914e287ba121ab735959bcf3bfd6794c591359.1604166646.git.v.shpilevoy@tarantool.org>

On Sat, Oct 31, 2020 at 07:01:41PM +0100, Vladislav Shpilevoy wrote:
> txn_complete used to handle all the transaction outcomes:
> - manual rollback;
> - error at WAL write;
> - successful WAL write and commit;
> - successful WAL write and wait for synchronization with replicas.

Looks ok to me. Ack.

Here is a diff on top of the patch I would add, but up to you, feel free to ignore.
---
 src/box/txn.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: tarantool.git/src/box/txn.c
===================================================================
--- tarantool.git.orig/src/box/txn.c
+++ tarantool.git/src/box/txn.c
@@ -533,7 +533,7 @@ txn_complete_fail(struct txn *txn)
 	stailq_reverse(&txn->stmts);
 	stailq_foreach_entry(stmt, &txn->stmts, next)
 		txn_rollback_one_stmt(txn, stmt);
-	if (txn->engine)
+	if (txn->engine != NULL)
 		engine_rollback(txn->engine, txn);
 	if (txn_has_flag(txn, TXN_HAS_TRIGGERS))
 		txn_run_rollback_triggers(txn, &txn->on_rollback);
@@ -544,12 +544,12 @@ void
 txn_complete_success(struct txn *txn)
 {
 	double stop_tm = ev_monotonic_now(loop());
-	if (stop_tm - txn->start_tm > too_long_threshold) {
+	double delta = stop_tm - txn->start_tm;
+	if (delta > too_long_threshold) {
 		int n_rows = txn->n_new_rows + txn->n_applier_rows;
 		say_warn_ratelimited("too long WAL write: %d rows at LSN %lld: "
 				     "%.3f sec", n_rows,
-				     txn->signature - n_rows + 1,
-				     stop_tm - txn->start_tm);
+				     txn->signature - n_rows + 1, delta);
 	}
 	assert(!txn_has_flag(txn, TXN_IS_DONE));
 	assert(!txn_has_flag(txn, TXN_WAIT_SYNC));

  reply	other threads:[~2020-11-02 12:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31 18:01 [Tarantool-patches] [PATCH 0/3] Qsync too long WAL write Vladislav Shpilevoy
2020-10-31 18:01 ` [Tarantool-patches] [PATCH 1/3] txn: rename txn_complete_async to txn_on_journal_write Vladislav Shpilevoy
2020-11-02 11:48   ` Cyrill Gorcunov
2020-10-31 18:01 ` [Tarantool-patches] [PATCH 2/3] txn: split complete into success and fail paths Vladislav Shpilevoy
2020-11-02 12:15   ` Cyrill Gorcunov [this message]
2020-11-02 22:39     ` Vladislav Shpilevoy
2020-10-31 18:01 ` [Tarantool-patches] [PATCH 3/3] txn: warn "too long WAL" on write, not on commit Vladislav Shpilevoy
2020-11-02 12:31   ` Cyrill Gorcunov
2020-11-03  7:36 ` [Tarantool-patches] [PATCH 0/3] Qsync too long WAL write Serge Petrenko
2020-11-03 22:19 ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201102121506.GB2339@grain \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 2/3] txn: split complete into success and fail paths' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox