Skip to content

Commit 45fadb6

Browse files
MDEV-32753 Make spider init queries compatible with oracle sql mode
Remove ORACLE from the (session) sql_mode in connections made with sql service to run init queries The connection is new and the global variable value takes effect rather than the session value from the caller of spider_db_init.
1 parent 3ba041f commit 45fadb6

10 files changed

+101
-1
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#
2+
# MDEV-32753 Spider engine does not load in ORACLE mode
3+
#
4+
select * from mysql.plugin;
5+
name dl
6+
create table t (c int) Engine=SPIDER;
7+
drop table t;
8+
#
9+
# end of test mdev_32753
10+
#
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#
2+
# MDEV-32753 Spider engine does not load in ORACLE mode
3+
#
4+
install soname 'ha_spider';
5+
select * from mysql.plugin;
6+
name dl
7+
SPIDER ha_spider.so
8+
SPIDER_ALLOC_MEM ha_spider.so
9+
SPIDER_WRAPPER_PROTOCOLS ha_spider.so
10+
create table t (c int) Engine=SPIDER;
11+
drop table t;
12+
#
13+
# end of test mdev_32753_after_start
14+
#
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#
2+
# MDEV-32753 Spider engine does not load in ORACLE mode
3+
#
4+
set @old_sql_mode=@@sql_mode;
5+
SET @@sql_mode = CONCAT(@@sql_mode, ',ORACLE');
6+
install soname 'ha_spider';
7+
select * from mysql.plugin;
8+
name dl
9+
SPIDER ha_spider.so
10+
SPIDER_ALLOC_MEM ha_spider.so
11+
SPIDER_WRAPPER_PROTOCOLS ha_spider.so
12+
create table t (c int) Engine=SPIDER;
13+
drop table t;
14+
set sql_mode=@old_sql_mode;
15+
#
16+
# end of test mdev_32753_after_start
17+
#
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--sql-mode=oracle
2+
--plugin-load-add=ha_spider
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
--echo #
2+
--echo # MDEV-32753 Spider engine does not load in ORACLE mode
3+
--echo #
4+
5+
# This test tests spider init during server startup under global
6+
# ORACLE mode
7+
select * from mysql.plugin;
8+
create table t (c int) Engine=SPIDER;
9+
drop table t;
10+
--echo #
11+
--echo # end of test mdev_32753
12+
--echo #
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--sql-mode=oracle
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--echo #
2+
--echo # MDEV-32753 Spider engine does not load in ORACLE mode
3+
--echo #
4+
5+
# This test tests spider init after startup under global ORACLE mode
6+
install soname 'ha_spider';
7+
select * from mysql.plugin;
8+
create table t (c int) Engine=SPIDER;
9+
drop table t;
10+
11+
--disable_query_log
12+
--disable_result_log
13+
--source ../../include/clean_up_spider.inc
14+
--enable_result_log
15+
--enable_query_log
16+
17+
--echo #
18+
--echo # end of test mdev_32753_after_start
19+
--echo #
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--echo #
2+
--echo # MDEV-32753 Spider engine does not load in ORACLE mode
3+
--echo #
4+
5+
# This test tests spider init after startup under session ORACLE mode
6+
set @old_sql_mode=@@sql_mode;
7+
SET @@sql_mode = CONCAT(@@sql_mode, ',ORACLE');
8+
install soname 'ha_spider';
9+
select * from mysql.plugin;
10+
create table t (c int) Engine=SPIDER;
11+
drop table t;
12+
set sql_mode=@old_sql_mode;
13+
14+
--disable_query_log
15+
--disable_result_log
16+
--source ../../include/clean_up_spider.inc
17+
--enable_result_log
18+
--enable_query_log
19+
20+
--echo #
21+
--echo # end of test mdev_32753_after_start
22+
--echo #

storage/spider/mysql-test/spider/include/clean_up_spider.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DROP FUNCTION spider_copy_tables;
33
DROP FUNCTION spider_ping_table;
44
DROP FUNCTION spider_bg_direct_sql;
55
DROP FUNCTION spider_direct_sql;
6-
UNINSTALL SONAME IF EXISTS "ha_spider";
6+
UNINSTALL SONAME IF EXISTS 'ha_spider';
77
DROP TABLE IF EXISTS mysql.spider_xa;
88
DROP TABLE IF EXISTS mysql.spider_xa_member;
99
DROP TABLE IF EXISTS mysql.spider_xa_failed_log;

storage/spider/spd_init_query.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*/
2121

2222
static LEX_STRING spider_init_queries[] = {
23+
{C_STRING_WITH_LEN(
24+
"SET @@SQL_MODE = REPLACE(@@SQL_MODE, 'ORACLE', '');"
25+
)},
2326
{C_STRING_WITH_LEN(
2427
"create table if not exists mysql.spider_xa("
2528
" format_id int not null default 0,"

0 commit comments

Comments
 (0)