From 0517e7b22d545ece452022b372d1bd3426e720d4 Mon Sep 17 00:00:00 2001 From: "guilhem@mysql.com" <> Date: Mon, 8 Nov 2004 21:45:23 +0100 Subject: [PATCH] As rollback can be 30 times slower than insert in InnoDB, and user may not know there's rollback (if it's because of a dupl row), better warn that it's happening. It can also be of use for a DBA killing a connection and wondering what this connection is still doing now. Example: | 5 | root | localhost | test | Killed | 10 | Rolling back | insert into i select * from j | --- sql/handler.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sql/handler.cc b/sql/handler.cc index f7a1a6ef0bf..cb88ab463d8 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -581,6 +581,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) if (opt_using_transactions) { bool operation_done=0; + /* + As rollback can be 30 times slower than insert in InnoDB, and user may + not know there's rollback (if it's because of a dupl row), better warn. + */ + const char *save_proc_info= thd->proc_info; + thd->proc_info= "Rolling back"; #ifdef HAVE_NDBCLUSTER_DB if (trans->ndb_tid) { @@ -652,6 +658,7 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans) thd->variables.tx_isolation=thd->session_tx_isolation; if (operation_done) statistic_increment(ha_rollback_count,&LOCK_status); + thd->proc_info= save_proc_info; } #endif /* USING_TRANSACTIONS */ DBUG_RETURN(error);