Commit d31d6d31 authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-9696: CREATE SERVER statement does not replicate in Galera Cluster

Enable replication of CREATE/ALTER/DROP SERVER statements
in Galera cluster.
parent 000f76d8
# On node_1
CREATE SERVER s1
FOREIGN DATA WRAPPER mysql
OPTIONS (HOST 'foo');
# On node_2
SELECT * FROM mysql.servers;
Server_name Host Db Username Password Port Socket Wrapper Owner
s1 foo 3306 mysql
ALTER SERVER s1
OPTIONS (HOST 'bar');
# On node_1
SELECT * FROM mysql.servers;
Server_name Host Db Username Password Port Socket Wrapper Owner
s1 bar 3306 mysql
DROP SERVER s1;
# On node_2
SELECT COUNT(*)=0 FROM mysql.servers;
COUNT(*)=0
1
# End of test
# Test for CREATE/ALTER/DROP SERVER in Galera cluster
--source include/galera_cluster.inc
--connection node_1
--echo # On node_1
CREATE SERVER s1
FOREIGN DATA WRAPPER mysql
OPTIONS (HOST 'foo');
--connection node_2
--echo # On node_2
SELECT * FROM mysql.servers;
ALTER SERVER s1
OPTIONS (HOST 'bar');
--connection node_1
--echo # On node_1
SELECT * FROM mysql.servers;
DROP SERVER s1;
--connection node_2
--echo # On node_2
SELECT COUNT(*)=0 FROM mysql.servers;
--source include/galera_end.inc
--echo # End of test
......@@ -5649,6 +5649,8 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL))
break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
res= create_server(thd, &lex->server_options);
break;
}
......@@ -5660,6 +5662,8 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL))
break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if ((error= alter_server(thd, &lex->server_options)))
{
DBUG_PRINT("info", ("problem altering server <%s>",
......@@ -5678,6 +5682,8 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, SUPER_ACL))
break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if ((err_code= drop_server(thd, &lex->server_options)))
{
if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)
......
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