mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
BUG#34656 - KILL a query = Assertion failed: m_status == DA_ERROR ||
m_status == DA_OK Reading from information_scema.tables or information_schema.columns may cause assertion failure in debug builds. This may happen under rare circumstances when information_schema fails to get information about a table (e.g. when a connection is killed). This happens because open_normal_and_derived_tables() can return an error without setting an error message in THD. But information_schema attempts to get an error message from THD unconditionally. With this fix information_schema attempts to get an error message from THD only in case error message is set in THD.
This commit is contained in:
parent
f83cc8e6db
commit
553d70d0ee
4 changed files with 52 additions and 3 deletions
|
@ -1638,4 +1638,6 @@ show open tables where f1()=0;
|
||||||
show open tables where f1()=0;
|
show open tables where f1()=0;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop function f1;
|
drop function f1;
|
||||||
|
select * from information_schema.tables where 1=sleep(100000);
|
||||||
|
select * from information_schema.columns where 1=sleep(100000);
|
||||||
End of 5.1 tests.
|
End of 5.1 tests.
|
||||||
|
|
|
@ -1270,4 +1270,48 @@ show open tables where f1()=0;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
drop function f1;
|
drop function f1;
|
||||||
|
|
||||||
|
#
|
||||||
|
# BUG#34656 - KILL a query = Assertion failed: m_status == DA_ERROR ||
|
||||||
|
# m_status == DA_OK
|
||||||
|
#
|
||||||
|
connect (conn1, localhost, root,,);
|
||||||
|
connection conn1;
|
||||||
|
let $ID= `select connection_id()`;
|
||||||
|
send select * from information_schema.tables where 1=sleep(100000);
|
||||||
|
connection default;
|
||||||
|
let $wait_timeout= 10;
|
||||||
|
let $wait_condition=select count(*)=1 from information_schema.processlist
|
||||||
|
where state='User sleep' and
|
||||||
|
info='select * from information_schema.tables where 1=sleep(100000)';
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
disable_query_log;
|
||||||
|
eval kill $ID;
|
||||||
|
enable_query_log;
|
||||||
|
disconnect conn1;
|
||||||
|
let $wait_timeout= 10;
|
||||||
|
let $wait_condition=select count(*)=0 from information_schema.processlist
|
||||||
|
where state='User sleep' and
|
||||||
|
info='select * from information_schema.tables where 1=sleep(100000)';
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
|
connect (conn1, localhost, root,,);
|
||||||
|
connection conn1;
|
||||||
|
let $ID= `select connection_id()`;
|
||||||
|
send select * from information_schema.columns where 1=sleep(100000);
|
||||||
|
connection default;
|
||||||
|
let $wait_timeout= 10;
|
||||||
|
let $wait_condition=select count(*)=1 from information_schema.processlist
|
||||||
|
where state='User sleep' and
|
||||||
|
info='select * from information_schema.columns where 1=sleep(100000)';
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
disable_query_log;
|
||||||
|
eval kill $ID;
|
||||||
|
enable_query_log;
|
||||||
|
disconnect conn1;
|
||||||
|
let $wait_timeout= 10;
|
||||||
|
let $wait_condition=select count(*)=0 from information_schema.processlist
|
||||||
|
where state='User sleep' and
|
||||||
|
info='select * from information_schema.columns where 1=sleep(100000)';
|
||||||
|
--source include/wait_condition.inc
|
||||||
|
|
||||||
--echo End of 5.1 tests.
|
--echo End of 5.1 tests.
|
||||||
|
|
|
@ -3722,6 +3722,7 @@ longlong Item_func_sleep::val_int()
|
||||||
pthread_cond_init(&cond, NULL);
|
pthread_cond_init(&cond, NULL);
|
||||||
pthread_mutex_lock(&LOCK_user_locks);
|
pthread_mutex_lock(&LOCK_user_locks);
|
||||||
|
|
||||||
|
thd_proc_info(thd, "User sleep");
|
||||||
thd->mysys_var->current_mutex= &LOCK_user_locks;
|
thd->mysys_var->current_mutex= &LOCK_user_locks;
|
||||||
thd->mysys_var->current_cond= &cond;
|
thd->mysys_var->current_cond= &cond;
|
||||||
|
|
||||||
|
@ -3733,6 +3734,7 @@ longlong Item_func_sleep::val_int()
|
||||||
break;
|
break;
|
||||||
error= 0;
|
error= 0;
|
||||||
}
|
}
|
||||||
|
thd_proc_info(thd, 0);
|
||||||
pthread_mutex_unlock(&LOCK_user_locks);
|
pthread_mutex_unlock(&LOCK_user_locks);
|
||||||
pthread_mutex_lock(&thd->mysys_var->mutex);
|
pthread_mutex_lock(&thd->mysys_var->mutex);
|
||||||
thd->mysys_var->current_mutex= 0;
|
thd->mysys_var->current_mutex= 0;
|
||||||
|
|
|
@ -3430,7 +3430,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
||||||
/*
|
/*
|
||||||
there was errors during opening tables
|
there was errors during opening tables
|
||||||
*/
|
*/
|
||||||
const char *error= thd->main_da.message();
|
const char *error= thd->is_error() ? thd->main_da.message() : "";
|
||||||
if (tables->view)
|
if (tables->view)
|
||||||
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
|
table->field[3]->store(STRING_WITH_LEN("VIEW"), cs);
|
||||||
else if (tables->schema_table)
|
else if (tables->schema_table)
|
||||||
|
@ -3631,8 +3631,9 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
|
||||||
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
|
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
|
||||||
rather than in SHOW COLUMNS
|
rather than in SHOW COLUMNS
|
||||||
*/
|
*/
|
||||||
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
if (thd->is_error())
|
||||||
thd->main_da.sql_errno(), thd->main_da.message());
|
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||||
|
thd->main_da.sql_errno(), thd->main_da.message());
|
||||||
thd->clear_error();
|
thd->clear_error();
|
||||||
res= 0;
|
res= 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue