Commit 5c6fceec authored by Yuchen Pei's avatar Yuchen Pei

MDEV-28998 remove a known reference to a SPIDER_CONN when it is freed

parent 8660e2de
#
# MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
#
for master_1
for child2
for child3
CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t1_SPIDER (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
CREATE TABLE t2 AS SELECT a FROM t1_SPIDER;
SELECT * FROM t2;
a
1
2
DROP TABLE t2, t1_SPIDER, t1;
drop server s;
for master_1
for child2
for child3
#
# end of test mdev_28998
#
--echo #
--echo # MDEV-28998 ASAN errors in spider_fields::free_conn_holder or spider_create_group_by_handler
--echo #
if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "%ASAN%"`)
{
--skip test needs to be run with ASAN
}
--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t1_SPIDER (a INT) ENGINE=SPIDER COMMENT = "wrapper 'mysql', srv 's', table 't1'";
CREATE TABLE t2 AS SELECT a FROM t1_SPIDER;
SELECT * FROM t2;
# Cleanup
DROP TABLE t2, t1_SPIDER, t1;
drop server s;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log
--echo #
--echo # end of test mdev_28998
--echo #
......@@ -1255,6 +1255,8 @@ int spider_free_conn(
ip_port_conn->ip_port_count--;
pthread_mutex_unlock(&ip_port_conn->mutex);
}
if (conn->conn_holder_for_direct_join)
conn->conn_holder_for_direct_join->conn= NULL;
spider_free_conn_alloc(conn);
spider_free(spider_current_trx, conn, MYF(0));
DBUG_RETURN(0);
......
......@@ -859,7 +859,8 @@ void spider_fields::free_conn_holder(
}
}
}
conn_holder_arg->conn->conn_holder_for_direct_join = NULL;
if (conn_holder_arg->conn)
conn_holder_arg->conn->conn_holder_for_direct_join = NULL;
DBUG_PRINT("info",("spider free conn_holder=%p", conn_holder_arg));
spider_free(spider_current_trx, conn_holder_arg, MYF(0));
DBUG_VOID_RETURN;
......
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