summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <yuchen.pei@mariadb.com>2023-04-20 11:02:43 +1000
committerYuchen Pei <yuchen.pei@mariadb.com>2023-04-20 13:05:56 +1000
commit700c0ae8ae6753544f539c0ff42896d4ac263414 (patch)
tree9415f36fc11181e0460ab21706c477d12f13a1ed
parentbc0cbf6e1d5c33744da22e4eb2b66cbd067835b5 (diff)
downloadmariadb-git-700c0ae8ae6753544f539c0ff42896d4ac263414.tar.gz
MDEV-27095 spider should be installed with INSTALL SONAME ha_spider
There are several plugins in ha_spider: spider, spider_alloc_mem, spider_wrapper_protocols, spider_rewrite etc. INSTALL PLUGIN foo SONAME ha_spider causes all the other ones to be installed by the init queries where foo is any of the plugins. This introduces unnecessary complexiy. For example it reads mysql.plugins to find all other plugins, causing the hack of moving spider plugin init to a separate thread. To install all spider related plugins, install soname ha_spider should be used instead.
-rw-r--r--storage/spider/mysql-test/spider/bugfix/r/index.result39
-rw-r--r--storage/spider/mysql-test/spider/bugfix/t/index.test8
-rw-r--r--storage/spider/mysql-test/spider/include/deinit_spider.inc5
-rw-r--r--storage/spider/mysql-test/spider/include/init_spider.inc4
-rw-r--r--storage/spider/spd_init_query.h116
5 files changed, 11 insertions, 161 deletions
diff --git a/storage/spider/mysql-test/spider/bugfix/r/index.result b/storage/spider/mysql-test/spider/bugfix/r/index.result
index 3563744997b..801fec2e763 100644
--- a/storage/spider/mysql-test/spider/bugfix/r/index.result
+++ b/storage/spider/mysql-test/spider/bugfix/r/index.result
@@ -1,21 +1,4 @@
for master_1
-connect master_1, localhost, root, , , $MASTER_1_MYPORT, $MASTER_1_MYSOCK;
-connection master_1;
-CALL mtr.add_suppression("unknown variable");
-SET SESSION sql_log_bin= 0;
-INSTALL PLUGIN spider SONAME 'ha_spider';
-CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
-HOST 'localhost',
-DATABASE 'auto_test_local',
-USER 'root',
-PASSWORD '',
-SOCKET '$MASTER_1_MYSOCK'
- );
-SET spider_internal_sql_log_off= 0;
-SET spider_direct_order_limit= 10000;
-SET spider_init_sql_alloc_size= 1;
-Warnings:
-Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
for child2
for child3
create database auto_test_local;
@@ -70,27 +53,5 @@ a b
drop table ts, auto_test_local.t;
drop database auto_test_local;
for master_1
-connection master_1;
-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_wrapper_protocols;
-UNINSTALL PLUGIN spider_alloc_mem;
-UNINSTALL PLUGIN spider;
-Warnings:
-Warning 1620 Plugin is busy and will be uninstalled on shutdown
-DROP TABLE IF EXISTS mysql.spider_xa;
-DROP TABLE IF EXISTS mysql.spider_xa_member;
-DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
-DROP TABLE IF EXISTS mysql.spider_tables;
-DROP TABLE IF EXISTS mysql.spider_link_mon_servers;
-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_1;
-disconnect master_1;
for child2
for child3
diff --git a/storage/spider/mysql-test/spider/bugfix/t/index.test b/storage/spider/mysql-test/spider/bugfix/t/index.test
index 10d5025c9c7..641fa164d0d 100644
--- a/storage/spider/mysql-test/spider/bugfix/t/index.test
+++ b/storage/spider/mysql-test/spider/bugfix/t/index.test
@@ -1,4 +1,8 @@
+--disable_query_log
+--disable_result_log
--source ../t/test_init.inc
+--enable_result_log
+--enable_query_log
create database auto_test_local;
set spider_same_server_link= on;
@@ -42,4 +46,8 @@ select a, b from ts where a > 0 and b = 'g' order by a;
drop table ts, auto_test_local.t;
drop database auto_test_local;
+--disable_query_log
+--disable_result_log
--source ../t/test_deinit.inc
+--enable_query_log
+--enable_result_log
diff --git a/storage/spider/mysql-test/spider/include/deinit_spider.inc b/storage/spider/mysql-test/spider/include/deinit_spider.inc
index dd474c59bc7..3145aa2b55f 100644
--- a/storage/spider/mysql-test/spider/include/deinit_spider.inc
+++ b/storage/spider/mysql-test/spider/include/deinit_spider.inc
@@ -20,7 +20,6 @@ if (`SELECT IF($PLUGIN_VERSION = 3, 1, 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;
@@ -33,9 +32,7 @@ DROP FUNCTION spider_copy_tables;
DROP FUNCTION spider_ping_table;
DROP FUNCTION spider_bg_direct_sql;
DROP FUNCTION spider_direct_sql;
-UNINSTALL PLUGIN spider_wrapper_protocols;
-UNINSTALL PLUGIN spider_alloc_mem;
-UNINSTALL PLUGIN spider;
+UNINSTALL SONAME "ha_spider.so";
DROP TABLE IF EXISTS mysql.spider_xa;
DROP TABLE IF EXISTS mysql.spider_xa_member;
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;
diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc
index b4ce7c8f035..ccf9e305cf7 100644
--- a/storage/spider/mysql-test/spider/include/init_spider.inc
+++ b/storage/spider/mysql-test/spider/include/init_spider.inc
@@ -2,7 +2,7 @@ let $VERSION_COMPILE_OS_WIN=
`SELECT IF(@@version_compile_os like 'Win%', 1, 0)`;
if ($VERSION_COMPILE_OS_WIN)
{
- INSTALL PLUGIN spider SONAME 'ha_spider';
+ INSTALL SONAME 'ha_spider';
if ($MASTER_1_MYPORT)
{
evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
@@ -76,7 +76,7 @@ if ($VERSION_COMPILE_OS_WIN)
}
if (!$VERSION_COMPILE_OS_WIN)
{
- INSTALL PLUGIN spider SONAME 'ha_spider';
+ INSTALL SONAME 'ha_spider';
if ($MASTER_1_MYSOCK)
{
evalp CREATE SERVER s_1 FOREIGN DATA WRAPPER mysql OPTIONS (
diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h
index c3bea1c166b..727cfe9334e 100644
--- a/storage/spider/spd_init_query.h
+++ b/storage/spider/spd_init_query.h
@@ -662,82 +662,6 @@ static LEX_STRING spider_init_queries[] = {
"create procedure mysql.spider_plugin_installer()"
"begin"
" set @win_plugin := IF(@@version_compile_os like 'Win%', 1, 0);"
-/*
- Install spider plugin
-*/
-/*
- " set @have_spider_i_s_plugin := 0;"
- " select @have_spider_i_s_plugin := 1 from INFORMATION_SCHEMA.plugins"
- " where PLUGIN_NAME = 'SPIDER';"
- " set @have_spider_plugin := 0;"
- " select @have_spider_plugin := 1 from mysql.plugin"
- " where name = 'spider';"
- " if @have_spider_i_s_plugin = 0 then"
- " if @have_spider_plugin = 1 then"
- " / *"
- " spider plugin is present in mysql.plugin but not in"
- " information_schema.plugins. Remove spider plugin entry"
- " in mysql.plugin first."
- " * /"
- " delete from mysql.plugin where name = 'spider';"
- " end if;"
- " if @win_plugin = 0 then "
- " install plugin spider soname 'ha_spider.so';"
- " else"
- " install plugin spider soname 'ha_spider.dll';"
- " end if;"
- " end if;"
-*/
-/*
- Install spider_alloc_mem plugin
-*/
- " set @have_spider_i_s_alloc_mem_plugin := 0;"
- " select @have_spider_i_s_alloc_mem_plugin := 1"
- " from INFORMATION_SCHEMA.plugins"
- " where PLUGIN_NAME = 'SPIDER_ALLOC_MEM';"
- " set @have_spider_alloc_mem_plugin := 0;"
- " select @have_spider_alloc_mem_plugin := 1 from mysql.plugin"
- " where name = 'spider_alloc_mem';"
- " if @have_spider_i_s_alloc_mem_plugin = 0 then"
- " if @have_spider_alloc_mem_plugin = 1 then"
- " /*"
- " spider_alloc_mem plugin is present in mysql.plugin but not in"
- " information_schema.plugins. Remove spider_alloc_mem plugin entry"
- " in mysql.plugin first."
- " */"
- " delete from mysql.plugin where name = 'spider_alloc_mem';"
- " end if;"
- " if @win_plugin = 0 then "
- " install plugin spider_alloc_mem soname 'ha_spider.so';"
- " else"
- " install plugin spider_alloc_mem soname 'ha_spider.dll';"
- " end if;"
- " end if;"
-/*
- Install spider_wrapper_protocols plugin
-*/
- " set @have_spider_i_s_wrapper_protocols_plugin := 0;"
- " select @have_spider_i_s_wrapper_protocols_plugin := 1"
- " from INFORMATION_SCHEMA.plugins"
- " where PLUGIN_NAME = 'SPIDER_WRAPPER_PROTOCOLS';"
- " set @have_spider_wrapper_protocols_plugin := 0;"
- " select @have_spider_wrapper_protocols_plugin := 1 from mysql.plugin"
- " where name = 'spider_wrapper_protocols';"
- " if @have_spider_i_s_wrapper_protocols_plugin = 0 then"
- " if @have_spider_wrapper_protocols_plugin = 1 then"
- " /*"
- " spider_wrapper_protocols plugin is present in mysql.plugin but not in"
- " information_schema.plugins. Remove spider_wrapper_protocols plugin entry"
- " in mysql.plugin first."
- " */"
- " delete from mysql.plugin where name = 'spider_wrapper_protocols';"
- " end if;"
- " if @win_plugin = 0 then "
- " install plugin spider_wrapper_protocols soname 'ha_spider.so';"
- " else"
- " install plugin spider_wrapper_protocols soname 'ha_spider.dll';"
- " end if;"
- " end if;"
" set @have_spider_direct_sql_udf := 0;"
" select @have_spider_direct_sql_udf := 1 from mysql.func"
" where name = 'spider_direct_sql';"
@@ -798,46 +722,6 @@ static LEX_STRING spider_init_queries[] = {
" soname 'ha_spider.dll';"
" end if;"
" end if;"
-/*
- Install spider_rewrite plugin
-*/
-/*
- " if @server_name = 'MariaDB' and "
- " ("
- " @server_major_version > 11"
- " )"
- " then"
- " set @have_spider_i_s_rewrite_plugin := 0;"
- " select @have_spider_i_s_rewrite_plugin := 1"
- " from INFORMATION_SCHEMA.plugins"
- " where PLUGIN_NAME = 'SPIDER_REWRITE';"
- " set @have_spider_rewrite_plugin := 0;"
- " select @have_spider_rewrite_plugin := 1 from mysql.plugin"
- " where name = 'spider_rewrite';"
- " if @have_spider_i_s_rewrite_plugin = 0 then"
- " if @have_spider_rewrite_plugin = 1 then"
- " delete from mysql.plugin where name = 'spider_rewrite';"
- " end if;"
- " if @win_plugin = 0 then "
- " install plugin spider_rewrite soname 'ha_spider.so';"
- " else"
- " install plugin spider_rewrite soname 'ha_spider.dll';"
- " end if;"
- " end if;"
- " set @have_spider_flush_rewrite_cache_udf := 0;"
- " select @have_spider_flush_rewrite_cache_udf := 1 from mysql.func"
- " where name = 'spider_flush_rewrite_cache';"
- " if @have_spider_flush_rewrite_cache_udf = 0 then"
- " if @win_plugin = 0 then "
- " create function spider_flush_rewrite_cache returns int"
- " soname 'ha_spider.so';"
- " else"
- " create function spider_flush_rewrite_cache returns int"
- " soname 'ha_spider.dll';"
- " end if;"
- " end if;"
- " end if;"
-*/
"end;"
)},
{C_STRING_WITH_LEN(