Commit 4fbd2e85 authored by Brandon Nesterenko's avatar Brandon Nesterenko Committed by Daniel Black

MDEV-31768: Alias MASTER_DEMOTE_TO_REPLICA for MASTER_DEMOTE_TO_SLAVE

Per MDEV-20601, REPLICA should be an alias for SLAVE in SQL
statements.

Reviewed By:
============
Kristian Nielsen <knielsen@knielsen-hq.org>
Andrei Elkin <andrei.elkin@mariadb.com>
parent 7bbc545f
...@@ -683,6 +683,23 @@ connection master; ...@@ -683,6 +683,23 @@ connection master;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=Slave_Pos, master_demote_to_slave=invalid; CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=Slave_Pos, master_demote_to_slave=invalid;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'invalid' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'invalid' at line 1
# #
# MDEV-31768
# Ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
#
connection slave;
RESET MASTER;
include/reset_slave.inc
CREATE TABLE t_mdev_31768 (a int);
CHANGE MASTER TO master_use_gtid=Replica_Pos, master_demote_to_replica=1;
# Validating alias MASTER_DEMOTE_TO_REPLICA provides intended behavior..
# ..success
DROP TABLE t_mdev_31768;
RESET MASTER;
include/reset_slave.inc
# Clear primary binlog state to match replica
connection master;
RESET MASTER;
#
# Cleanup # Cleanup
# #
connection master; connection master;
......
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
# non-boolean value. # non-boolean value.
# #
# #
# Additionally ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
#
#
# References: # References:
# MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based # MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based
# replication is used by default if master supports it # replication is used by default if master supports it
...@@ -454,6 +457,37 @@ EOF ...@@ -454,6 +457,37 @@ EOF
--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SLAVE_MYPORT, master_user='root', master_use_gtid=Slave_Pos, master_demote_to_slave=invalid --eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SLAVE_MYPORT, master_user='root', master_use_gtid=Slave_Pos, master_demote_to_slave=invalid
--echo #
--echo # MDEV-31768
--echo # Ensure MASTER_DEMOTE_TO_REPLICA aliases MASTER_DEMOTE_TO_SLAVE
--echo #
--connection slave
RESET MASTER;
--source include/reset_slave.inc
CREATE TABLE t_mdev_31768 (a int);
--let $gtid_binlog_pos= `SELECT @@GLOBAL.gtid_binlog_pos`
CHANGE MASTER TO master_use_gtid=Replica_Pos, master_demote_to_replica=1;
--let $gtid_slave_pos= `SELECT @@GLOBAL.gtid_slave_pos`
--echo # Validating alias MASTER_DEMOTE_TO_REPLICA provides intended behavior..
if (`SELECT strcmp("$gtid_binlog_pos","$gtid_slave_pos") != 0`)
{
--echo # ..failed
--echo # Binlog pos: $gtid_binlog_pos
--echo # Replica pos: $gtid_slave_pos
die MASTER_DEMOTE_TO_REPLICA does not alias MASTER_DEMOTE_TO_SLAVE correctly;
}
--echo # ..success
DROP TABLE t_mdev_31768;
RESET MASTER;
--source include/reset_slave.inc
--echo # Clear primary binlog state to match replica
--connection master
RESET MASTER;
--echo # --echo #
--echo # Cleanup --echo # Cleanup
--echo # --echo #
......
...@@ -385,6 +385,7 @@ SYMBOL symbols[] = { ...@@ -385,6 +385,7 @@ SYMBOL symbols[] = {
{ "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)}, { "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)},
{ "MASTER_USER", SYM(MASTER_USER_SYM)}, { "MASTER_USER", SYM(MASTER_USER_SYM)},
{ "MASTER_USE_GTID", SYM(MASTER_USE_GTID_SYM)}, { "MASTER_USE_GTID", SYM(MASTER_USE_GTID_SYM)},
{ "MASTER_DEMOTE_TO_REPLICA", SYM(MASTER_DEMOTE_TO_SLAVE_SYM)},
{ "MASTER_DEMOTE_TO_SLAVE", SYM(MASTER_DEMOTE_TO_SLAVE_SYM)}, { "MASTER_DEMOTE_TO_SLAVE", SYM(MASTER_DEMOTE_TO_SLAVE_SYM)},
{ "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)}, { "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)},
{ "MATCH", SYM(MATCH)}, { "MATCH", SYM(MATCH)},
......
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