mirror of
https://github.com/MariaDB/server.git
synced 2025-12-28 08:10:14 +00:00
MDEV-35611 ALTER IF EXISTS assertions in sql_errno with statement timeout
Check stmt_da::is_error before calling stmt_da::sql_errno(which is what the assertion ensures) The bug did not have any negative effects in optimized builds.
This commit is contained in:
parent
6e9e48648a
commit
c742cc94ba
@ -60,3 +60,22 @@ drop table t1;
|
||||
#
|
||||
# End of 10.11 tests
|
||||
#
|
||||
#
|
||||
# MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER
|
||||
#
|
||||
CREATE TABLE t (a INT) ENGINE=MyISAM;
|
||||
INSERT INTO t VALUES (1);
|
||||
LOCK TABLE t READ;
|
||||
connection con1;
|
||||
SET max_statement_time=0.001;
|
||||
ALTER TABLE t FORCE;
|
||||
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
|
||||
ALTER TABLE IF EXISTS t FORCE;
|
||||
ERROR 70100: Query execution was interrupted (max_statement_time exceeded)
|
||||
disconnect con1;
|
||||
connection default;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t;
|
||||
#
|
||||
# End of 11.4 tests
|
||||
#
|
||||
|
||||
@ -78,3 +78,25 @@ drop table t1;
|
||||
--echo #
|
||||
--echo # End of 10.11 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-35611 Assertion failure in Diagnostics_area::sql_errno upon interrupted ALTER
|
||||
--echo #
|
||||
CREATE TABLE t (a INT) ENGINE=MyISAM;
|
||||
INSERT INTO t VALUES (1);
|
||||
LOCK TABLE t READ;
|
||||
--connection con1
|
||||
SET max_statement_time=0.001;
|
||||
--error ER_STATEMENT_TIMEOUT
|
||||
ALTER TABLE t FORCE;
|
||||
--error ER_STATEMENT_TIMEOUT
|
||||
ALTER TABLE IF EXISTS t FORCE;
|
||||
# Cleanup
|
||||
--disconnect con1
|
||||
--connection default
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t;
|
||||
|
||||
--echo #
|
||||
--echo # End of 11.4 tests
|
||||
--echo #
|
||||
|
||||
@ -10655,7 +10655,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
|
||||
|
||||
if (unlikely(error))
|
||||
{
|
||||
if (if_exists)
|
||||
if (if_exists && thd->get_stmt_da()->is_error())
|
||||
{
|
||||
int tmp_errno= thd->get_stmt_da()->sql_errno();
|
||||
if (tmp_errno == ER_NO_SUCH_TABLE)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user