MDEV-26539 SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER
The server crashes if ALTER TABLE, which accesses physical data placed at data nodes, is performed on a Spider table. The cause of the bug is that spider_check_trx_and_get_conn() does not allocate connections if sql_command == SQLCOM_ALTER_TABLE. Some ALTER TABLE statements, like ALTER TABLE ... CHECK PARTITION, access data nodes. So, we need to allocate a new connection before performing ALTER TABLEs.
This commit is contained in:
parent
052dda61bb
commit
9068020efe
36
storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result
Normal file
36
storage/spider/mysql-test/spider/bugfix/r/mdev_26539.result
Normal file
@ -0,0 +1,36 @@
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
||||
#
|
||||
# MDEV-26539 SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER
|
||||
#
|
||||
connection child2_1;
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
CREATE TABLE tbl_a (
|
||||
c INT
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
connection master_1;
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
CREATE TABLE tbl_a (
|
||||
c INT
|
||||
) ENGINE=Spider DEFAULT CHARSET=utf8 COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS (c) (
|
||||
PARTITION pt1 DEFAULT COMMENT = 'srv "s_2_1"'
|
||||
);
|
||||
INSERT INTO tbl_a VALUES (1);
|
||||
ALTER TABLE tbl_a CHECK PARTITION ALL;
|
||||
Table Op Msg_type Msg_text
|
||||
auto_test_local.tbl_a check status OK
|
||||
DROP DATABASE auto_test_local;
|
||||
connection child2_1;
|
||||
DROP DATABASE auto_test_remote;
|
||||
for master_1
|
||||
for child2
|
||||
child2_1
|
||||
child2_2
|
||||
child2_3
|
||||
for child3
|
3
storage/spider/mysql-test/spider/bugfix/t/mdev_26539.cnf
Normal file
3
storage/spider/mysql-test/spider/bugfix/t/mdev_26539.cnf
Normal file
@ -0,0 +1,3 @@
|
||||
!include include/default_mysqld.cnf
|
||||
!include ../my_1_1.cnf
|
||||
!include ../my_2_1.cnf
|
40
storage/spider/mysql-test/spider/bugfix/t/mdev_26539.test
Normal file
40
storage/spider/mysql-test/spider/bugfix/t/mdev_26539.test
Normal file
@ -0,0 +1,40 @@
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_init.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-26539 SIGSEGV in spider_check_and_set_trx_isolation and I_P_List_iterator from THD::drop_temporary_table (10.5.3 opt only) on ALTER
|
||||
--echo #
|
||||
|
||||
--connection child2_1
|
||||
CREATE DATABASE auto_test_remote;
|
||||
USE auto_test_remote;
|
||||
eval CREATE TABLE tbl_a (
|
||||
c INT
|
||||
) $CHILD2_1_ENGINE $CHILD2_1_CHARSET;
|
||||
|
||||
--connection master_1
|
||||
CREATE DATABASE auto_test_local;
|
||||
USE auto_test_local;
|
||||
|
||||
eval CREATE TABLE tbl_a (
|
||||
c INT
|
||||
) $MASTER_1_ENGINE $MASTER_1_CHARSET COMMENT='table "tbl_a"' PARTITION BY LIST COLUMNS (c) (
|
||||
PARTITION pt1 DEFAULT COMMENT = 'srv "s_2_1"'
|
||||
);
|
||||
|
||||
INSERT INTO tbl_a VALUES (1);
|
||||
ALTER TABLE tbl_a CHECK PARTITION ALL;
|
||||
|
||||
DROP DATABASE auto_test_local;
|
||||
|
||||
--connection child2_1
|
||||
DROP DATABASE auto_test_remote;
|
||||
|
||||
--disable_query_log
|
||||
--disable_result_log
|
||||
--source ../../t/test_deinit.inc
|
||||
--enable_result_log
|
||||
--enable_query_log
|
@ -3744,10 +3744,8 @@ int spider_check_trx_and_get_conn(
|
||||
}
|
||||
spider->wide_handler->trx = trx;
|
||||
spider->set_error_mode();
|
||||
if (
|
||||
spider->wide_handler->sql_command != SQLCOM_DROP_TABLE &&
|
||||
spider->wide_handler->sql_command != SQLCOM_ALTER_TABLE
|
||||
) {
|
||||
if (spider->wide_handler->sql_command != SQLCOM_DROP_TABLE)
|
||||
{
|
||||
SPIDER_TRX_HA *trx_ha = spider_check_trx_ha(trx, spider);
|
||||
if (!trx_ha || trx_ha->wait_for_reusing)
|
||||
spider_trx_set_link_idx_for_all(spider);
|
||||
|
Loading…
x
Reference in New Issue
Block a user