Commit 69389c03 authored by Sergei Golubchik's avatar Sergei Golubchik Committed by Yuchen Pei

MDEV-32683 Spider engine does not load with non-default alter-algorithm

specify algorithm/lock explicitly, don't depend on server settings
parent 9259b4b8
#
# MDEV-32683 Spider engine does not load with non-default alter-algorithm
#
set global alter_algorithm=INSTANT;
install plugin spider soname 'ha_spider';
select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider';
plugin_name plugin_status plugin_type plugin_license load_option
SPIDER ACTIVE STORAGE ENGINE GPL ON
uninstall plugin spider;
drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member;
drop function spider_direct_sql;
drop function spider_bg_direct_sql;
drop function spider_ping_table;
drop function spider_copy_tables;
drop function spider_flush_table_mon_cache;
set global alter_algorithm=DEFAULT;
--echo #
--echo # MDEV-32683 Spider engine does not load with non-default alter-algorithm
--echo #
set global alter_algorithm=INSTANT;
install plugin spider soname 'ha_spider';
select plugin_name, plugin_status, plugin_type, plugin_license, load_option from information_schema.plugins where plugin_name like 'spider';
uninstall plugin spider;
drop table mysql.spider_link_failed_log, mysql.spider_link_mon_servers, mysql.spider_tables, mysql.spider_table_crd, mysql.spider_table_position_for_recovery, mysql.spider_table_sts, mysql.spider_xa, mysql.spider_xa_failed_log, mysql.spider_xa_member;
drop function spider_direct_sql;
drop function spider_bg_direct_sql;
drop function spider_ping_table;
drop function spider_copy_tables;
drop function spider_flush_table_mon_cache;
set global alter_algorithm=DEFAULT;
...@@ -198,7 +198,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -198,7 +198,8 @@ static LEX_STRING spider_init_queries[] = {
" add if not exists username char(64) default null," " add if not exists username char(64) default null,"
" add if not exists password char(64) default null," " add if not exists password char(64) default null,"
" add if not exists tgt_db_name char(64) default null," " add if not exists tgt_db_name char(64) default null,"
" add if not exists tgt_table_name char(64) default null;" " add if not exists tgt_table_name char(64) default null,"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for version 0.17 Fix for version 0.17
...@@ -212,7 +213,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -212,7 +213,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'binary(128)' then" "if @col_type != 'binary(128)' then"
" alter table mysql.spider_xa" " alter table mysql.spider_xa"
" modify data binary(128) not null default '';" " modify data binary(128) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -224,7 +226,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -224,7 +226,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'binary(128)' then" "if @col_type != 'binary(128)' then"
" alter table mysql.spider_xa_member" " alter table mysql.spider_xa_member"
" modify data binary(128) not null default '';" " modify data binary(128) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
/* /*
...@@ -234,14 +237,16 @@ static LEX_STRING spider_init_queries[] = { ...@@ -234,14 +237,16 @@ static LEX_STRING spider_init_queries[] = {
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
" add column if not exists link_id int not null default 0 after table_name," " add column if not exists link_id int not null default 0 after table_name,"
" drop primary key," " drop primary key,"
" add primary key (db_name, table_name, link_id);" " add primary key (db_name, table_name, link_id),"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for version 2.8 Fix for version 2.8
*/ */
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
" add column if not exists link_status tinyint not null default 1;" " add column if not exists link_status tinyint not null default 1,"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for version 2.10 Fix for version 2.10
...@@ -257,7 +262,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -257,7 +262,8 @@ static LEX_STRING spider_init_queries[] = {
" after ssl_key," " after ssl_key,"
" add column if not exists default_file char(64) default null" " add column if not exists default_file char(64) default null"
" after ssl_verify_server_cert," " after ssl_verify_server_cert,"
" add column if not exists default_group char(64) default null after default_file;" " add column if not exists default_group char(64) default null after default_file,"
" algorithm=copy, lock=shared;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
...@@ -270,7 +276,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -270,7 +276,8 @@ static LEX_STRING spider_init_queries[] = {
" after ssl_key," " after ssl_key,"
" add column if not exists default_file char(64) default null" " add column if not exists default_file char(64) default null"
" after ssl_verify_server_cert," " after ssl_verify_server_cert,"
" add column if not exists default_group char(64) default null after default_file;" " add column if not exists default_group char(64) default null after default_file,"
" algorithm=copy, lock=shared;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_link_mon_servers" "alter table mysql.spider_link_mon_servers"
...@@ -283,7 +290,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -283,7 +290,8 @@ static LEX_STRING spider_init_queries[] = {
" after ssl_key," " after ssl_key,"
" add column if not exists default_file char(64) default null" " add column if not exists default_file char(64) default null"
" after ssl_verify_server_cert," " after ssl_verify_server_cert,"
" add column if not exists default_group char(64) default null after default_file;" " add column if not exists default_group char(64) default null after default_file,"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for version 2.28 Fix for version 2.28
...@@ -297,7 +305,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -297,7 +305,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'int(10) unsigned' then" "if @col_type != 'int(10) unsigned' then"
" alter table mysql.spider_link_mon_servers" " alter table mysql.spider_link_mon_servers"
" modify sid int unsigned not null default 0;" " modify sid int unsigned not null default 0,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
/* /*
...@@ -319,7 +328,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -319,7 +328,8 @@ static LEX_STRING spider_init_queries[] = {
" modify ssl_capath text," " modify ssl_capath text,"
" modify ssl_cert text," " modify ssl_cert text,"
" modify ssl_key text," " modify ssl_key text,"
" modify default_file text;" " modify default_file text,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -336,7 +346,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -336,7 +346,8 @@ static LEX_STRING spider_init_queries[] = {
" modify ssl_capath text," " modify ssl_capath text,"
" modify ssl_cert text," " modify ssl_cert text,"
" modify ssl_key text," " modify ssl_key text,"
" modify default_file text;" " modify default_file text,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -353,7 +364,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -353,7 +364,8 @@ static LEX_STRING spider_init_queries[] = {
" modify ssl_capath text," " modify ssl_capath text,"
" modify ssl_cert text," " modify ssl_cert text,"
" modify ssl_key text," " modify ssl_key text,"
" modify default_file text;" " modify default_file text,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
/* /*
...@@ -362,7 +374,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -362,7 +374,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
" add if not exists monitoring_binlog_pos_at_failing tinyint not null default 0" " add if not exists monitoring_binlog_pos_at_failing tinyint not null default 0"
" after ssl_verify_server_cert;" " after ssl_verify_server_cert,"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for version 3.3.6 Fix for version 3.3.6
...@@ -370,12 +383,14 @@ static LEX_STRING spider_init_queries[] = { ...@@ -370,12 +383,14 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
" add column if not exists block_status tinyint not null default 0" " add column if not exists block_status tinyint not null default 0"
" after link_status;" " after link_status,"
" algorithm=copy, lock=shared;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_tables" "alter table mysql.spider_tables"
" add column if not exists static_link_id char(64) default null after block_status," " add column if not exists static_link_id char(64) default null after block_status,"
" add unique index if not exists uidx1 (db_name, table_name, static_link_id);" " add unique index if not exists uidx1 (db_name, table_name, static_link_id),"
" algorithm=copy, lock=shared;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS" "select COLUMN_TYPE INTO @col_type from INFORMATION_SCHEMA.COLUMNS"
...@@ -386,7 +401,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -386,7 +401,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(64)' then" "if @col_type != 'char(64)' then"
" alter table mysql.spider_link_mon_servers" " alter table mysql.spider_link_mon_servers"
" modify link_id char(64) not null default '';" " modify link_id char(64) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -398,7 +414,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -398,7 +414,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(64)' then" "if @col_type != 'char(64)' then"
" alter table mysql.spider_link_failed_log" " alter table mysql.spider_link_failed_log"
" modify link_id char(64) not null default '';" " modify link_id char(64) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
/* /*
...@@ -413,7 +430,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -413,7 +430,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_tables" " alter table mysql.spider_tables"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -425,7 +443,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -425,7 +443,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_link_mon_servers" " alter table mysql.spider_link_mon_servers"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -437,7 +456,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -437,7 +456,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_link_failed_log" " alter table mysql.spider_link_failed_log"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -449,7 +469,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -449,7 +469,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_table_position_for_recovery" " alter table mysql.spider_table_position_for_recovery"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -461,7 +482,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -461,7 +482,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_table_sts" " alter table mysql.spider_table_sts"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -473,7 +495,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -473,7 +495,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @col_type != 'char(199)' then" "if @col_type != 'char(199)' then"
" alter table mysql.spider_table_crd" " alter table mysql.spider_table_crd"
" modify table_name char(199) not null default '';" " modify table_name char(199) not null default '',"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
/* /*
...@@ -481,7 +504,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -481,7 +504,8 @@ static LEX_STRING spider_init_queries[] = {
*/ */
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"alter table mysql.spider_table_sts" "alter table mysql.spider_table_sts"
" add column if not exists checksum bigint unsigned default null after update_time;" " add column if not exists checksum bigint unsigned default null after update_time,"
" algorithm=copy, lock=shared;"
)}, )},
/* /*
Fix for MariaDB 10.4: Crash-Safe system tables Fix for MariaDB 10.4: Crash-Safe system tables
...@@ -494,7 +518,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -494,7 +518,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_link_failed_log" " alter table mysql.spider_link_failed_log"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -505,7 +530,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -505,7 +530,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_link_mon_servers" " alter table mysql.spider_link_mon_servers"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -516,7 +542,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -516,7 +542,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_table_crd" " alter table mysql.spider_table_crd"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -527,7 +554,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -527,7 +554,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_table_position_for_recovery" " alter table mysql.spider_table_position_for_recovery"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -538,7 +566,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -538,7 +566,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_table_sts" " alter table mysql.spider_table_sts"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -549,7 +578,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -549,7 +578,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_tables" " alter table mysql.spider_tables"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -560,7 +590,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -560,7 +590,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_xa" " alter table mysql.spider_xa"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -571,7 +602,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -571,7 +602,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_xa_failed_log" " alter table mysql.spider_xa_failed_log"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
...@@ -582,7 +614,8 @@ static LEX_STRING spider_init_queries[] = { ...@@ -582,7 +614,8 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
"if @engine_name != 'Aria' then" "if @engine_name != 'Aria' then"
" alter table mysql.spider_xa_member" " alter table mysql.spider_xa_member"
" engine=Aria transactional=1;" " engine=Aria transactional=1,"
" algorithm=copy, lock=shared;"
"end if;" "end if;"
)}, )},
{C_STRING_WITH_LEN( {C_STRING_WITH_LEN(
......
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