Skip to content

Commit d31d6d3

Browse files
author
Nirbhay Choubey
committed
MDEV-9696: CREATE SERVER statement does not replicate in Galera Cluster
Enable replication of CREATE/ALTER/DROP SERVER statements in Galera cluster.
1 parent 000f76d commit d31d6d3

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# On node_1
2+
CREATE SERVER s1
3+
FOREIGN DATA WRAPPER mysql
4+
OPTIONS (HOST 'foo');
5+
# On node_2
6+
SELECT * FROM mysql.servers;
7+
Server_name Host Db Username Password Port Socket Wrapper Owner
8+
s1 foo 3306 mysql
9+
ALTER SERVER s1
10+
OPTIONS (HOST 'bar');
11+
# On node_1
12+
SELECT * FROM mysql.servers;
13+
Server_name Host Db Username Password Port Socket Wrapper Owner
14+
s1 bar 3306 mysql
15+
DROP SERVER s1;
16+
# On node_2
17+
SELECT COUNT(*)=0 FROM mysql.servers;
18+
COUNT(*)=0
19+
1
20+
# End of test
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Test for CREATE/ALTER/DROP SERVER in Galera cluster
2+
3+
--source include/galera_cluster.inc
4+
5+
--connection node_1
6+
--echo # On node_1
7+
CREATE SERVER s1
8+
FOREIGN DATA WRAPPER mysql
9+
OPTIONS (HOST 'foo');
10+
11+
--connection node_2
12+
--echo # On node_2
13+
SELECT * FROM mysql.servers;
14+
ALTER SERVER s1
15+
OPTIONS (HOST 'bar');
16+
17+
--connection node_1
18+
--echo # On node_1
19+
SELECT * FROM mysql.servers;
20+
DROP SERVER s1;
21+
22+
--connection node_2
23+
--echo # On node_2
24+
SELECT COUNT(*)=0 FROM mysql.servers;
25+
26+
--source include/galera_end.inc
27+
--echo # End of test
28+

sql/sql_parse.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5649,6 +5649,8 @@ mysql_execute_command(THD *thd)
56495649
if (check_global_access(thd, SUPER_ACL))
56505650
break;
56515651

5652+
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
5653+
56525654
res= create_server(thd, &lex->server_options);
56535655
break;
56545656
}
@@ -5660,6 +5662,8 @@ mysql_execute_command(THD *thd)
56605662
if (check_global_access(thd, SUPER_ACL))
56615663
break;
56625664

5665+
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
5666+
56635667
if ((error= alter_server(thd, &lex->server_options)))
56645668
{
56655669
DBUG_PRINT("info", ("problem altering server <%s>",
@@ -5678,6 +5682,8 @@ mysql_execute_command(THD *thd)
56785682
if (check_global_access(thd, SUPER_ACL))
56795683
break;
56805684

5685+
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
5686+
56815687
if ((err_code= drop_server(thd, &lex->server_options)))
56825688
{
56835689
if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)

0 commit comments

Comments
 (0)