From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@dev.tarantool.org, sergepetrenko@tarantool.org, gorcunov@gmail.com Subject: [Tarantool-patches] [PATCH 3/3] txn: warn "too long WAL" on write, not on commit Date: Sat, 31 Oct 2020 19:01:42 +0100 [thread overview] Message-ID: <f5bcb80909524336dac9a4db44e6f1eb10b18771.1604166646.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1604166646.git.v.shpilevoy@tarantool.org> "Too long WAL write" is supposed to warn a user that either the disk write was too long, or the event loop is too slow, maybe due to certain fibers not doing yields often enough. It was printed by the code doing the transaction commit. As a result, for synchronous transactions the check also included the replication time, often overflowing a threshold and printing "too long WAL write" even when it had nothing to do with a WAL write or the event loop being too slow. The patch makes so the warning is checked and printed after WAL write right away, not after commit. Closes #5139 --- src/box/txn.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/box/txn.c b/src/box/txn.c index fd77a934a..c26116f1d 100644 --- a/src/box/txn.c +++ b/src/box/txn.c @@ -543,14 +543,6 @@ txn_complete_fail(struct txn *txn) void txn_complete_success(struct txn *txn) { - double stop_tm = ev_monotonic_now(loop()); - if (stop_tm - txn->start_tm > 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); - } assert(!txn_has_flag(txn, TXN_IS_DONE)); assert(!txn_has_flag(txn, TXN_WAIT_SYNC)); assert(txn->signature >= 0); @@ -587,6 +579,14 @@ txn_on_journal_write(struct journal_entry *entry) txn_complete_fail(txn); goto finish; } + double stop_tm = ev_monotonic_now(loop()); + if (stop_tm - txn->start_tm > 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); + } if (txn_has_flag(txn, TXN_HAS_TRIGGERS)) txn_run_wal_write_triggers(txn); if (!txn_has_flag(txn, TXN_WAIT_SYNC)) -- 2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-10-31 18:01 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 2020-11-02 22:39 ` Vladislav Shpilevoy 2020-10-31 18:01 ` Vladislav Shpilevoy [this message] 2020-11-02 12:31 ` [Tarantool-patches] [PATCH 3/3] txn: warn "too long WAL" on write, not on commit 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=f5bcb80909524336dac9a4db44e6f1eb10b18771.1604166646.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=gorcunov@gmail.com \ --cc=sergepetrenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 3/3] txn: warn "too long WAL" on write, not on commit' \ /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