Commit 9091535c authored by Georgi Kodinov's avatar Georgi Kodinov

Bug #48985: show create table crashes if previous access to the table was killed

When checking for an error after removing the special view error handler the code
was not taking into account that open_tables() may fail because of the current
statement being killed. 
Added a check for thd->killed.
Added a client program to test it.
parent 76221343
...@@ -1454,4 +1454,10 @@ GRANT PROCESS ON *.* TO test_u@localhost; ...@@ -1454,4 +1454,10 @@ GRANT PROCESS ON *.* TO test_u@localhost;
SHOW ENGINE MYISAM MUTEX; SHOW ENGINE MYISAM MUTEX;
SHOW ENGINE MYISAM STATUS; SHOW ENGINE MYISAM STATUS;
DROP USER test_u@localhost; DROP USER test_u@localhost;
#
# Bug #48985: show create table crashes if previous access to the table
# was killed
#
SHOW CREATE TABLE non_existent;
ERROR 70100: Query execution was interrupted
End of 5.1 tests End of 5.1 tests
...@@ -1207,6 +1207,28 @@ connection default; ...@@ -1207,6 +1207,28 @@ connection default;
DROP USER test_u@localhost; DROP USER test_u@localhost;
--echo #
--echo # Bug #48985: show create table crashes if previous access to the table
--echo # was killed
--echo #
connect(con1,localhost,root,,);
CONNECTION con1;
LET $ID= `SELECT connection_id()`;
CONNECTION default;
--disable_query_log
eval KILL QUERY $ID;
--enable_query_log
CONNECTION con1;
--error ER_QUERY_INTERRUPTED
SHOW CREATE TABLE non_existent;
CONNECTION default;
DISCONNECT con1;
--echo End of 5.1 tests --echo End of 5.1 tests
# Wait till all disconnects are completed # Wait till all disconnects are completed
......
...@@ -719,7 +719,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) ...@@ -719,7 +719,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
thd->push_internal_handler(&view_error_suppressor); thd->push_internal_handler(&view_error_suppressor);
bool error= open_normal_and_derived_tables(thd, table_list, 0); bool error= open_normal_and_derived_tables(thd, table_list, 0);
thd->pop_internal_handler(); thd->pop_internal_handler();
if (error && thd->main_da.is_error()) if (error && (thd->killed || thd->main_da.is_error()))
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment