Commit 1fda0544 authored by Nayuta Yanagisawa's avatar Nayuta Yanagisawa

MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql...

MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created

The server crashed when SPIDER_DIRECT_SQL UDF was called with
non-existing temporary table.

The bug has been introduced by 91ffdc83. The commit removed
the check, from THD::open_temporary_table(), which ensure that
the target temporary tables exist.

We can fix the bug by adding the check before the call of
THD::open_temporary_table().
parent a1b0f235
for master_1
for child2
child2_1
child2_2
child2_3
for child3
MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
connection master_1;
SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
ERROR HY000: Temporary table 'test.non_existing_temporary_table' is not found
for master_1
for child2
child2_1
child2_2
child2_3
for child3
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
!include ../my_2_1.cnf
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
--echo
--echo MDEV-25684 Crash in THD::find_temporary_table while calling spider_direct_sql UDF without temporary table created
--echo
--connection master_1
--error 12703
SELECT SPIDER_DIRECT_SQL('SELECT * FROM s', 'non_existing_temporary_table', 'srv "s_2_1"');
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
......@@ -3818,6 +3818,10 @@ TABLE *spider_find_temporary_table(
) {
DBUG_ENTER("spider_find_temporary_table");
#ifdef SPIDER_open_temporary_table
if (!thd->has_temporary_tables())
{
DBUG_RETURN(NULL);
}
if (thd->open_temporary_table(table_list))
{
DBUG_RETURN(NULL);
......
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