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

Enable replication of CREATE/ALTER/DROP SERVER statements
in Galera cluster.
This commit is contained in:
Nirbhay Choubey 2016-03-16 16:44:43 -04:00
parent 000f76d886
commit d31d6d31bb
3 changed files with 54 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# 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

View file

@ -0,0 +1,28 @@
# 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

View file

@ -5649,6 +5649,8 @@ create_sp_error:
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
break; break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
res= create_server(thd, &lex->server_options); res= create_server(thd, &lex->server_options);
break; break;
} }
@ -5660,6 +5662,8 @@ create_sp_error:
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
break; break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if ((error= alter_server(thd, &lex->server_options))) if ((error= alter_server(thd, &lex->server_options)))
{ {
DBUG_PRINT("info", ("problem altering server <%s>", DBUG_PRINT("info", ("problem altering server <%s>",
@ -5678,6 +5682,8 @@ create_sp_error:
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
break; break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if ((err_code= drop_server(thd, &lex->server_options))) if ((err_code= drop_server(thd, &lex->server_options)))
{ {
if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST) if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST)