mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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 |
This commit is contained in:
@ -581,6 +581,12 @@ int ha_rollback_trans(THD *thd, THD_TRANS *trans)
|
|||||||
if (opt_using_transactions)
|
if (opt_using_transactions)
|
||||||
{
|
{
|
||||||
bool operation_done=0;
|
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
|
#ifdef HAVE_NDBCLUSTER_DB
|
||||||
if (trans->ndb_tid)
|
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;
|
thd->variables.tx_isolation=thd->session_tx_isolation;
|
||||||
if (operation_done)
|
if (operation_done)
|
||||||
statistic_increment(ha_rollback_count,&LOCK_status);
|
statistic_increment(ha_rollback_count,&LOCK_status);
|
||||||
|
thd->proc_info= save_proc_info;
|
||||||
}
|
}
|
||||||
#endif /* USING_TRANSACTIONS */
|
#endif /* USING_TRANSACTIONS */
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
Reference in New Issue
Block a user