Skip to content
Permalink
Browse files

MDEV-19842 Crash while creating statistics for Spider table (#1355)

Added checks of the number of columns of the system tables.
Move install_spider.sql into source code except installing Spider
  • Loading branch information...
Kentoku committed Jul 6, 2019
1 parent 4a739d7 commit fa7051c419a653a002282eaca60f8202c1066d61
@@ -0,0 +1,12 @@
--connection master_1
alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time;
DROP DATABASE IF EXISTS auto_test_local;

--let $MASTER_1_COMMENT_2_1= $MASTER_1_COMMENT_2_1_BACKUP
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_result_log
--enable_query_log
--enable_warnings
@@ -0,0 +1,13 @@
--disable_warnings
--disable_query_log
--disable_result_log
--source ../t/test_init.inc
--enable_result_log
--enable_query_log
--enable_warnings
--let $MASTER_1_COMMENT_2_1_BACKUP= $MASTER_1_COMMENT_2_1
let $MASTER_1_COMMENT_2_1=
COMMENT='table "tbl_a", host "127.0.0.1", port "$MASTER_1_MYPORT", user "root"';
--connection master_1
alter table mysql.spider_table_sts drop column checksum;
insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00');
@@ -0,0 +1,38 @@
for master_1
for child2
for child3
connection master_1;
alter table mysql.spider_table_sts drop column checksum;
insert into mysql.spider_table_sts values ('auto_test_local', 'tbl_a', 0, 0, 0, 0, 0, '2019-01-01 00:00:00', '2019-01-01 00:00:00', '2019-01-01 00:00:00');

this test is for MDEV-19842

drop and create databases
connection master_1;
CREATE DATABASE auto_test_local;
USE auto_test_local;

create table
connection master_1;
CREATE TABLE tbl_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1

select test 1
connection master_1;
SELECT pkey FROM tbl_a;
ERROR HY000: System table spider_table_sts is different version

deinit
connection master_1;
DROP DATABASE IF EXISTS auto_test_local;
ERROR HY000: System table spider_table_sts is different version
connection master_1;
alter table mysql.spider_table_sts add column checksum bigint unsigned default null after update_time;
DROP DATABASE IF EXISTS auto_test_local;
for master_1
for child2
for child3

end of test
@@ -0,0 +1,2 @@
!include include/default_mysqld.cnf
!include ../my_1_1.cnf
@@ -0,0 +1,46 @@
--source ../include/spider_table_sts_init.inc
--echo
--echo this test is for MDEV-19842
--echo
--echo drop and create databases

--connection master_1
--disable_warnings
CREATE DATABASE auto_test_local;
USE auto_test_local;
--enable_warnings

--echo
--echo create table

--connection master_1
--disable_query_log
echo CREATE TABLE tbl_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
eval CREATE TABLE tbl_a (
pkey int NOT NULL,
PRIMARY KEY (pkey)
) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
--enable_query_log

--echo
--echo select test 1

--connection master_1
--error 12609
SELECT pkey FROM tbl_a;

--echo
--echo deinit
--disable_warnings

--connection master_1
--error 12609
DROP DATABASE IF EXISTS auto_test_local;

--enable_warnings
--source ../include/spider_table_sts_deinit.inc
--echo
--echo end of test
@@ -1,8 +1,39 @@
DROP FUNCTION spider_direct_sql;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_copy_tables;
let $SERVER_NAME=
`SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 2), '-', -1)`;
let $SERVER_MAJOR_VERSION=
`SELECT SUBSTRING_INDEX(version(), '.', 1)`;
let $SERVER_MINOR_VERSION=
`SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '.', 2), '.', -1)`;
let $PLUGIN_VERSION=
`SELECT SUBSTRING_INDEX(plugin_version, '.', 1)
FROM information_schema.plugins
WHERE plugin_name = 'SPIDER'`;
if (`SELECT IF($PLUGIN_VERSION = 3, 1, 0)`)
{
let $HAS_REWRITE=
`SELECT IF (STRCMP('$SERVER_NAME', 'MariaDB') = 0,
IF ($SERVER_MAJOR_VERSION = 10,
IF ($SERVER_MINOR_VERSION < 4, 0, 1),
IF ($SERVER_MAJOR_VERSION < 10, 0, 1)),
0)`;
let $HAS_REWRITE= 0;
if ($HAS_REWRITE)
{
DROP FUNCTION spider_flush_rewrite_cache;
UNINSTALL PLUGIN spider_rewrite;
DROP TABLE IF EXISTS mysql.spider_rewrite_tables;
DROP TABLE IF EXISTS mysql.spider_rewrite_table_tables;
DROP TABLE IF EXISTS mysql.spider_rewrite_table_partitions;
DROP TABLE IF EXISTS mysql.spider_rewrite_table_subpartitions;
DROP TABLE IF EXISTS mysql.spider_rewritten_tables;
}
}
DROP FUNCTION spider_flush_table_mon_cache;
DROP FUNCTION spider_copy_tables;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_direct_sql;
UNINSTALL PLUGIN spider_alloc_mem;
UNINSTALL PLUGIN spider;
DROP TABLE IF EXISTS mysql.spider_xa;
DROP TABLE IF EXISTS mysql.spider_xa_member;
@@ -13,9 +44,57 @@ DROP TABLE IF EXISTS mysql.spider_link_failed_log;
DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery;
DROP TABLE IF EXISTS mysql.spider_table_sts;
DROP TABLE IF EXISTS mysql.spider_table_crd;
DROP SERVER s_2_1;
DROP SERVER s_2_2;
DROP SERVER s_2_3;
DROP SERVER s_3_1;
DROP SERVER s_3_2;
DROP SERVER s_3_3;
if ($VERSION_COMPILE_OS_WIN)
{
if ($CHILD2_1_MYPORT)
{
DROP SERVER s_2_1;
}
if ($CHILD2_2_MYPORT)
{
DROP SERVER s_2_2;
}
if ($CHILD2_3_MYPORT)
{
DROP SERVER s_2_3;
}
if ($CHILD3_1_MYPORT)
{
DROP SERVER s_3_1;
}
if ($CHILD3_2_MYPORT)
{
DROP SERVER s_3_2;
}
if ($CHILD2_3_MYPORT)
{
DROP SERVER s_3_3;
}
}
if (!$VERSION_COMPILE_OS_WIN)
{
if ($CHILD2_1_MYSOCK)
{
DROP SERVER s_2_1;
}
if ($CHILD2_2_MYSOCK)
{
DROP SERVER s_2_2;
}
if ($CHILD2_3_MYSOCK)
{
DROP SERVER s_2_3;
}
if ($CHILD3_1_MYSOCK)
{
DROP SERVER s_3_1;
}
if ($CHILD3_2_MYSOCK)
{
DROP SERVER s_3_2;
}
if ($CHILD3_3_MYSOCK)
{
DROP SERVER s_3_3;
}
}

0 comments on commit fa7051c

Please sign in to comment.
You can’t perform that action at this time.