From 8386438d259da60358b2791ced379c9ba41751f3 Mon Sep 17 00:00:00 2001 From: Roman Tsisyk <roman@tsisyk.com> Date: Mon, 21 Jan 2013 14:59:23 +0400 Subject: [PATCH] Move "too long" message to txn_commit --- src/box/box.m | 6 ------ src/box/txn.m | 9 +++++++++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/box/box.m b/src/box/box.m index 2ec84bcee4..7ea6f8af3a 100644 --- a/src/box/box.m +++ b/src/box/box.m @@ -86,7 +86,6 @@ static void process_rw(struct port *port, u32 op, struct tbuf *data) { struct txn *txn = txn_begin(); - ev_tstamp start = ev_now(), stop; @try { struct request *request = request_create(op, data); @@ -99,11 +98,6 @@ process_rw(struct port *port, u32 op, struct tbuf *data) } @catch (id e) { txn_rollback(txn); @throw; - } @finally { - stop = ev_now(); - if (stop - start > cfg.too_long_threshold) - say_warn("too long %s: %.3f sec", - request_name(op), stop - start); } } diff --git a/src/box/txn.m b/src/box/txn.m index 925aa950db..146c376574 100644 --- a/src/box/txn.m +++ b/src/box/txn.m @@ -31,6 +31,7 @@ #include "space.h" #include <recovery.h> #include <fiber.h> +#include "request.h" /* for request_name */ void txn_add_redo(struct txn *txn, u16 op, struct tbuf *data) @@ -77,11 +78,19 @@ txn_commit(struct txn *txn) { if (txn->old_tuple || txn->new_tuple) { int64_t lsn = next_lsn(recovery_state); + + ev_tstamp start = ev_now(), stop; int res = wal_write(recovery_state, lsn, 0, txn->op, &txn->req); + stop = ev_now(); + say_warn("too long %s: %.3f sec", + request_name(txn->op), stop - start); + confirm_lsn(recovery_state, lsn, res == 0); + if (res) tnt_raise(LoggedError, :ER_WAL_IO); + } } -- GitLab