diff --git a/mysql-test/suite/binlog/t/binlog_killed.test b/mysql-test/suite/binlog/t/binlog_killed.test index ce6d344af32..e2db326129d 100644 --- a/mysql-test/suite/binlog/t/binlog_killed.test +++ b/mysql-test/suite/binlog/t/binlog_killed.test @@ -202,7 +202,7 @@ eval kill query $ID; rollback; connection con2; ---error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT +--error 0,ER_QUERY_INTERRUPTED reap; # todo 1,2 above rollback; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f2a6c52ce7b..cf7ec4d6e6f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -759,6 +759,10 @@ convert_error_code_to_mysql( } else if (error == DB_UNSUPPORTED) { return(HA_ERR_UNSUPPORTED); + } else if (error == DB_INTERRUPTED) { + + my_error(ER_QUERY_INTERRUPTED, MYF(0)); + return(-1); } else { return(-1); // Unknown error } diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index ed7ce151718..b1461689d38 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -69,6 +69,9 @@ Created 5/24/1996 Heikki Tuuri a feature that it can't recoginize or work with e.g., FT indexes created by a later version of the engine. */ +#define DB_INTERRUPTED 49 /* the query has been interrupted with + "KILL QUERY N;" */ + /* The following are partial failure codes */ #define DB_FAIL 1000 #define DB_OVERFLOW 1001 diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 20fb69499a1..b4ce31575c7 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -483,6 +483,7 @@ handle_new_error: } else if (err == DB_ROW_IS_REFERENCED || err == DB_NO_REFERENCED_ROW || err == DB_CANNOT_ADD_CONSTRAINT + || err == DB_INTERRUPTED || err == DB_TOO_MANY_CONCURRENT_TRXS) { if (savept) { /* Roll back the latest, possibly incomplete diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index a2eed3f171c..5b1184fb416 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1554,12 +1554,16 @@ srv_suspend_mysql_thread( mutex_exit(&kernel_mutex); - if (trx_is_interrupted(trx) - || (srv_lock_wait_timeout < 100000000 - && wait_time > (double)srv_lock_wait_timeout)) { + if (srv_lock_wait_timeout < 100000000 + && wait_time > (double)srv_lock_wait_timeout) { trx->error_state = DB_LOCK_WAIT_TIMEOUT; } + + if (trx_is_interrupted(trx)) { + + trx->error_state = DB_INTERRUPTED; + } #else /* UNIV_HOTBACKUP */ /* This function depends on MySQL code that is not included in InnoDB Hot Backup builds. Besides, this function should never