mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-33538 make auxiliary spider plugins init depend on actual spider
The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL only makes sense if the main SPIDER plugin is installed. Further, SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill the table. We also update the spider init query to override --transaction_read_only=on so that it does not affect the spider init. Also fixed error handling in spider_db_init() so that failure in spider table init does not result in memory leak
This commit is contained in:
12
storage/spider/mysql-test/spider/bugfix/r/mdev_33538.result
Normal file
12
storage/spider/mysql-test/spider/bugfix/r/mdev_33538.result
Normal file
@@ -0,0 +1,12 @@
|
||||
show create table information_schema.SPIDER_ALLOC_MEM;
|
||||
Table Create Table
|
||||
SPIDER_ALLOC_MEM CREATE TEMPORARY TABLE `SPIDER_ALLOC_MEM` (
|
||||
`ID` int(10) unsigned NOT NULL,
|
||||
`FUNC_NAME` varchar(64),
|
||||
`FILE_NAME` varchar(64),
|
||||
`LINE_NO` int(10) unsigned,
|
||||
`TOTAL_ALLOC_MEM` bigint(20) unsigned,
|
||||
`CURRENT_ALLOC_MEM` bigint(20),
|
||||
`ALLOC_MEM_COUNT` bigint(20) unsigned,
|
||||
`FREE_MEM_COUNT` bigint(20) unsigned
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
|
@@ -0,0 +1,8 @@
|
||||
call mtr.add_suppression("\\[ERROR\\] SPIDER plugin initialization failed");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_WRAPPER_PROTOCOLS' registration as a INFORMATION SCHEMA failed.");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_ALLOC_MEM' registration as a INFORMATION SCHEMA failed.");
|
||||
create table mysql.spider_tables (c int);
|
||||
# restart: --plugin-load-add=ha_spider
|
||||
SELECT * FROM information_schema.SPIDER_ALLOC_MEM;
|
||||
ERROR 42S02: Unknown table 'SPIDER_ALLOC_MEM' in information_schema
|
@@ -3,5 +3,9 @@
|
||||
#
|
||||
select * from mysql.plugin;
|
||||
name dl
|
||||
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = "information_schema" and TABLE_NAME like "SPIDER_%";
|
||||
TABLE_NAME
|
||||
SPIDER_ALLOC_MEM
|
||||
SPIDER_WRAPPER_PROTOCOLS
|
||||
create table t (c int) Engine=SPIDER;
|
||||
drop table t;
|
||||
|
2
storage/spider/mysql-test/spider/bugfix/t/mdev_33538.opt
Normal file
2
storage/spider/mysql-test/spider/bugfix/t/mdev_33538.opt
Normal file
@@ -0,0 +1,2 @@
|
||||
--plugin-load-add=ha_spider
|
||||
--transaction-read-only=on
|
@@ -0,0 +1,2 @@
|
||||
# we check that information_schema.SPIDER_ALLOC_MEM exists
|
||||
show create table information_schema.SPIDER_ALLOC_MEM;
|
@@ -0,0 +1,17 @@
|
||||
call mtr.add_suppression("\\[ERROR\\] SPIDER plugin initialization failed");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER' registration as a STORAGE ENGINE failed.");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_WRAPPER_PROTOCOLS' registration as a INFORMATION SCHEMA failed.");
|
||||
call mtr.add_suppression(".*\\[ERROR\\] Plugin 'SPIDER_ALLOC_MEM' registration as a INFORMATION SCHEMA failed.");
|
||||
# We create a table with identical name of the spider system table, to
|
||||
# fail the spider init query ([ERROR] SPIDER plugin initialization
|
||||
# failed at 'alter table mysql.spider_tables add column if not exists
|
||||
# link_id int not null default 0 after table_name, drop primary key,
|
||||
# add primary key (db_name, table_name, link_id), algorithm=copy,
|
||||
# lock=shared;' by 'Unknown column 'table_name' in 'spider_tables'')
|
||||
# This will cause the init of spider_alloc_mem to fail because it
|
||||
# depends on the main spider plugin.
|
||||
create table mysql.spider_tables (c int);
|
||||
--let $restart_parameters= --plugin-load-add=ha_spider
|
||||
--source include/restart_mysqld.inc
|
||||
--error ER_UNKNOWN_TABLE
|
||||
SELECT * FROM information_schema.SPIDER_ALLOC_MEM;
|
@@ -3,5 +3,6 @@
|
||||
--echo #
|
||||
# A simple test that tests plugin-load-add=ha_spider
|
||||
select * from mysql.plugin;
|
||||
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = "information_schema" and TABLE_NAME like "SPIDER_%";
|
||||
create table t (c int) Engine=SPIDER;
|
||||
drop table t;
|
||||
|
Reference in New Issue
Block a user