summaryrefslogtreecommitdiff
path: root/mysql-test/suite/rpl
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/suite/rpl')
-rw-r--r--mysql-test/suite/rpl/include/multisource.inc3
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_errors.inc5
-rw-r--r--mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test7
-rw-r--r--mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc7
-rw-r--r--mysql-test/suite/rpl/include/rpl_change_master_demote.inc89
-rw-r--r--mysql-test/suite/rpl/include/rpl_checksum.inc9
-rw-r--r--mysql-test/suite/rpl/include/rpl_corruption.inc6
-rw-r--r--mysql-test/suite/rpl/include/rpl_deadlock.test4
-rw-r--r--mysql-test/suite/rpl/include/rpl_extra_col_master.test24
-rw-r--r--mysql-test/suite/rpl/include/rpl_extra_col_slave.test40
-rw-r--r--mysql-test/suite/rpl/include/rpl_flsh_tbls.test6
-rw-r--r--mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc48
-rw-r--r--mysql-test/suite/rpl/include/rpl_loaddata.test2
-rw-r--r--mysql-test/suite/rpl/include/rpl_parallel_29322.inc3
-rw-r--r--mysql-test/suite/rpl/include/rpl_reset_slave.test15
-rw-r--r--mysql-test/suite/rpl/include/rpl_semi_sync.inc13
-rw-r--r--mysql-test/suite/rpl/include/rpl_skip_replication.inc6
-rw-r--r--mysql-test/suite/rpl/include/rpl_slave_max_statement_time.inc79
-rw-r--r--mysql-test/suite/rpl/include/rpl_start_stop_slave.test2
-rw-r--r--mysql-test/suite/rpl/r/rpl_000010.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_corruption.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_binlog_errors.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_change_master_demote.result687
-rw-r--r--mysql-test/suite/rpl/r/rpl_checksum.result9
-rw-r--r--mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_colSize.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_corruption.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_cross_version.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_deadlock_innodb.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_delayed_slave.result7
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result34
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result34
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result42
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_basic.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_crash.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_master_promote.result12
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_misc.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_reconnect.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_sort.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_startpos.result21
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_stop_start.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_gtid_until.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_basic.result24
-rw-r--r--mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_hrtime.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_innodb_bug68220.result233
-rw-r--r--mysql-test/suite/rpl/r/rpl_loaddata.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_log_pos.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_manual_change_index_file.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev382.result6
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev6020.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev6386.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mdev_17614.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_old_master.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_old_master_29078.result30
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_29322.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_parallel_temptable.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_perfschema_applier_status_by_coordinator.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_perfschema_connect_config.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_read_new_relay_log_info.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_reset_slave_fail.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_001.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_colSize.result102
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result14
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_reset_slave.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_row_until.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result8
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id2.result3
-rw-r--r--mysql-test/suite/rpl/r/rpl_server_id_ignore.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_skip_replication.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_alias_replica.result1
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_max_statement_time.result170
-rw-r--r--mysql-test/suite/rpl/r/rpl_slave_skip.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_sp.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_options.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_000001.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_reset_slave.result13
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stm_until.result4
-rw-r--r--mysql-test/suite/rpl/r/rpl_stop_slave.result5
-rw-r--r--mysql-test/suite/rpl/r/rpl_timestamp.result10
-rw-r--r--mysql-test/suite/rpl/r/rpl_trigger.result17
-rw-r--r--mysql-test/suite/rpl/r/rpl_upgrade_master_info.result2
-rw-r--r--mysql-test/suite/rpl/r/rpl_using_gtid_default.result144
-rw-r--r--mysql-test/suite/rpl/r/rpl_xa_gap_lock.result2
-rw-r--r--mysql-test/suite/rpl/r/semisync_future-7591.result6
-rw-r--r--mysql-test/suite/rpl/t/rpl_000010.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_change_master_demote.test470
-rw-r--r--mysql-test/suite/rpl/t/rpl_colSize.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_delayed_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_startpos.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_gtid_until.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_basic.test22
-rw-r--r--mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_innodb_bug68220.test53
-rw-r--r--mysql-test/suite/rpl/t/rpl_log_pos.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_manual_change_index_file.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev6020.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mdev_17614.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_old_master.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_old_master_29078.test12
-rw-r--r--mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_new_relay_log_info.test7
-rw-r--r--mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_reset_slave_fail.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_001.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_row_until.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id2.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_server_id_ignore.test4
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_alias_replica.test1
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_max_statement_time.test110
-rw-r--r--mysql-test/suite/rpl/t/rpl_slave_skip.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test5
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_000001.test2
-rw-r--r--mysql-test/suite/rpl/t/rpl_stm_until.test3
-rw-r--r--mysql-test/suite/rpl/t/rpl_stop_slave.test6
-rw-r--r--mysql-test/suite/rpl/t/rpl_trigger.test15
-rw-r--r--mysql-test/suite/rpl/t/rpl_using_gtid_default.test303
-rw-r--r--mysql-test/suite/rpl/t/rpl_xa_gap_lock.test2
-rw-r--r--mysql-test/suite/rpl/t/semisync_future-7591.test5
156 files changed, 2815 insertions, 623 deletions
diff --git a/mysql-test/suite/rpl/include/multisource.inc b/mysql-test/suite/rpl/include/multisource.inc
index 7a2d9ea79b2..96c4a9aa348 100644
--- a/mysql-test/suite/rpl/include/multisource.inc
+++ b/mysql-test/suite/rpl/include/multisource.inc
@@ -159,7 +159,8 @@ set default_master_connection = '';
eval change master to
master_port=$SERVER_MYPORT_2,
master_host='127.0.0.1',
-master_user='root';
+master_user='root',
+master_use_gtid=no;
start slave;
--source include/wait_for_slave_to_start.inc
diff --git a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc
index bf92736a2af..ab95c9b4ee3 100644
--- a/mysql-test/suite/rpl/include/rpl_binlog_errors.inc
+++ b/mysql-test/suite/rpl/include/rpl_binlog_errors.inc
@@ -389,6 +389,11 @@ RESET MASTER;
--source include/rpl_reset.inc
-- connection slave
+# Slave tests rely on logic of non-gtid mode
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
# slave suppressions
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
diff --git a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
index d750554b4ec..2634a6027a3 100644
--- a/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
+++ b/mysql-test/suite/rpl/include/rpl_binlog_max_cache_size.test
@@ -21,6 +21,13 @@
# and slave are diverging.
#
########################################################################################
+
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
diff --git a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc b/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc
index 7dfef023947..7c1d0ea25e2 100644
--- a/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc
+++ b/mysql-test/suite/rpl/include/rpl_cant_read_event_incident.inc
@@ -22,6 +22,10 @@
--source include/master-slave.inc
--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
# Make sure the slave is stopped while we are messing with master.
# Otherwise we get occasional failures as the slave manages to re-connect
# to the newly started master and we get extra events applied, causing
@@ -49,7 +53,8 @@ show binlog events;
--connection slave
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
-reset slave;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
start slave;
# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
diff --git a/mysql-test/suite/rpl/include/rpl_change_master_demote.inc b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
new file mode 100644
index 00000000000..4c563454a5b
--- /dev/null
+++ b/mysql-test/suite/rpl/include/rpl_change_master_demote.inc
@@ -0,0 +1,89 @@
+#
+# This file tests that a master can be demoted to a slave using
+# CHANGE MASTER TO MASTER_DEMOTE_TO_SLAVE=1 and replication will work correctly
+# afterwards.
+#
+# param $ignore_domain_ids : List of GTID domain ids to use for
+# CHANGE MASTER TO IGNORE_DOMAIN_IDS
+#
+
+--let $include_filename= rpl_change_master_demote.inc
+--source include/begin_include_file.inc
+
+--echo ##############################################
+--echo # Connection semantics change:
+--echo # * True primary is now connection 'slave'
+--echo # * True replica is now connection 'master'
+--echo ##############################################
+
+--connection master
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+
+--let $extra_cm_args=
+if (`SELECT strcmp("$ignore_domain_ids","") != 0`)
+{
+ --let $extra_cm_args=, ignore_domain_ids=($ignore_domain_ids)
+}
+
+--echo # First ensure gtid_slave_pos after master_demote_to_slave matches
+--echo # gtid_current_pos calculation
+--let $current_pos= `SELECT @@gtid_current_pos`
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1 $extra_cm_args
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+--let $slave_pos= `SELECT @@gtid_slave_pos`
+--echo # Validating gtid_slave_pos == gtid_binlog_pos..
+if ($slave_pos != $current_pos)
+{
+ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+ die gtid_slave_pos calculation after master_demote_to_slave=1 differs from gtid_current_pos;
+}
+--echo # ..success
+
+--source include/start_slave.inc
+
+--connection slave
+--source include/stop_slave.inc
+
+--echo # Ensuring replication works correctly after role swap
+--connection slave
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+--source include/save_master_gtid.inc
+
+--connection master
+--source include/sync_with_master_gtid.inc
+--echo # Validating that replication works..
+--let $n_replicated_rows= query_get_value(SELECT COUNT(*) FROM repl_t, COUNT(*), 1)
+if ($n_replicated_rows != 1)
+{
+ die "Replication is broken";
+}
+--echo # ..success
+
+--echo # Cleaning up replication check data
+--connection slave
+DROP TABLE repl_t;
+--source include/save_master_gtid.inc
+
+--connection master
+--source include/sync_with_master_gtid.inc
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+
+--echo ##############################################
+--echo # Connection semantics change:
+--echo # * True primary is back to connection 'master'
+--echo # * True replica is back to connection 'slave'
+--echo ##############################################
+
+--connection master
+--source include/stop_slave.inc
+
+--connection slave
+--replace_result $MASTER_MYPORT MASTER_PORT
+--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$MASTER_MYPORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1
+--source include/start_slave.inc
+
+--let $include_filename= rpl_change_master_demote.inc
+--source include/end_include_file.inc
diff --git a/mysql-test/suite/rpl/include/rpl_checksum.inc b/mysql-test/suite/rpl/include/rpl_checksum.inc
index 17a986dc308..fc765744b3f 100644
--- a/mysql-test/suite/rpl/include/rpl_checksum.inc
+++ b/mysql-test/suite/rpl/include/rpl_checksum.inc
@@ -11,6 +11,12 @@
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
+--connection master
call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log');
call mtr.add_suppression('Replication event checksum verification failed');
# due to C failure simulation
@@ -196,7 +202,8 @@ select count(*) as 'must be zero' from t2;
#
connection slave;
stop slave;
-reset slave;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
# randomize slave server's own checksum policy
set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
diff --git a/mysql-test/suite/rpl/include/rpl_corruption.inc b/mysql-test/suite/rpl/include/rpl_corruption.inc
index c7a913af9d7..cd2a1cc7ef2 100644
--- a/mysql-test/suite/rpl/include/rpl_corruption.inc
+++ b/mysql-test/suite/rpl/include/rpl_corruption.inc
@@ -24,6 +24,12 @@
--source include/have_debug.inc
--source include/master-slave.inc
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
# Block legal errors for MTR
call mtr.add_suppression('Found invalid event in binary log');
call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master');
diff --git a/mysql-test/suite/rpl/include/rpl_deadlock.test b/mysql-test/suite/rpl/include/rpl_deadlock.test
index 53002d255f3..7fcf5cbd22c 100644
--- a/mysql-test/suite/rpl/include/rpl_deadlock.test
+++ b/mysql-test/suite/rpl/include/rpl_deadlock.test
@@ -88,7 +88,7 @@ connection slave;
DELETE FROM t2;
# Set slave position to the BEGIN log event
--replace_result $master_pos_begin <master_pos_begin>
-eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
+eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin, MASTER_USE_GTID=NO;
BEGIN;
# Hold lock
SELECT * FROM t1 FOR UPDATE;
@@ -121,7 +121,7 @@ SET global max_relay_log_size=0;
DELETE FROM t2;
# Set slave position to the BEGIN log event
--replace_result $master_pos_begin <master_pos_begin>
-eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin;
+eval CHANGE MASTER TO MASTER_LOG_POS=$master_pos_begin, MASTER_USE_GTID=NO;
BEGIN;
# Hold lock
SELECT * FROM t1 FOR UPDATE;
diff --git a/mysql-test/suite/rpl/include/rpl_extra_col_master.test b/mysql-test/suite/rpl/include/rpl_extra_col_master.test
index 0d397b7e3ba..a7abe69db0a 100644
--- a/mysql-test/suite/rpl/include/rpl_extra_col_master.test
+++ b/mysql-test/suite/rpl/include/rpl_extra_col_master.test
@@ -450,7 +450,7 @@ connection master;
--echo ** Stop and Reset Slave **
--echo
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
--echo ** create table slave side **
eval CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
@@ -507,7 +507,7 @@ sync_slave_with_master;
--echo
--echo *** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
) ENGINE=$engine_type;
@@ -563,7 +563,7 @@ sync_slave_with_master;
--echo
--echo *** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
) ENGINE=$engine_type;
@@ -614,7 +614,7 @@ sync_slave_with_master;
--echo
--echo *** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
@@ -689,7 +689,7 @@ connection slave;
#***************************
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
--echo *** Drop t14 ***
@@ -711,7 +711,7 @@ START SLAVE;
--echo
--echo *** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
@@ -753,7 +753,7 @@ connection slave;
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
--echo *** Drop t15 ***
@@ -775,7 +775,7 @@ START SLAVE;
--echo
--echo *** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
@@ -830,7 +830,7 @@ connection slave;
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
--echo *** Drop t16 ***
@@ -853,7 +853,7 @@ START SLAVE;
--echo
--echo *** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
@@ -919,7 +919,7 @@ sync_slave_with_master;
--echo
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
@@ -982,7 +982,7 @@ sync_slave_with_master;
--echo
--echo *** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE=$engine_type;
diff --git a/mysql-test/suite/rpl/include/rpl_extra_col_slave.test b/mysql-test/suite/rpl/include/rpl_extra_col_slave.test
index a58fa85a72d..680d5724bea 100644
--- a/mysql-test/suite/rpl/include/rpl_extra_col_slave.test
+++ b/mysql-test/suite/rpl/include/rpl_extra_col_slave.test
@@ -25,7 +25,7 @@ call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot
sync_slave_with_master;
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
@@ -71,7 +71,7 @@ sync_slave_with_master;
## BUG22086
--echo *** Create t2 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -96,7 +96,7 @@ START SLAVE;
--let $show_slave_sql_error= 1
--source include/wait_for_slave_sql_error.inc
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
SELECT * FROM t2 ORDER BY a;
connection master;
@@ -116,7 +116,7 @@ sync_slave_with_master;
####################################
--echo *** Create t3 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -161,7 +161,7 @@ sync_slave_with_master;
--echo *** Create t4 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -204,7 +204,7 @@ sync_slave_with_master;
--echo *** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT, e DOUBLE,
f DECIMAL(8,2))ENGINE=$engine_type;
@@ -249,7 +249,7 @@ sync_slave_with_master;
--echo *** Create t6 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT)ENGINE=$engine_type;
@@ -307,7 +307,7 @@ DROP TABLE t6;
--echo *** Create t7 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e CHAR(20) DEFAULT 'Extra Column Testing')
@@ -349,7 +349,7 @@ sync_slave_with_master;
###########################################
--echo *** Create t8 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e INT)ENGINE=$engine_type;
@@ -395,7 +395,7 @@ sync_slave_with_master;
# Error reaction is up to sql_mode of the slave sql (bug#38173)
#--echo *** Create t9 on slave ***
STOP SLAVE;
- RESET SLAVE;
+ --source include/reset_slave.inc
eval CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
@@ -449,7 +449,7 @@ sync_slave_with_master;
############################################
--echo *** Create t10 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
c CHAR(5), e INT DEFAULT '1')ENGINE=$engine_type;
@@ -491,7 +491,7 @@ sync_slave_with_master;
############################################
--echo *** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
@@ -533,7 +533,7 @@ sync_slave_with_master;
############################################
--echo *** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE=$engine_type;
@@ -572,7 +572,7 @@ sync_slave_with_master;
--echo *** BUG 22177 Start ***
--echo *** Create t13 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
d INT DEFAULT '1',
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -620,7 +620,7 @@ sync_slave_with_master;
--echo *** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -660,7 +660,7 @@ SELECT * FROM t14 ORDER BY c1;
--echo *** Create t14a on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -690,7 +690,7 @@ sync_slave_with_master;
--replace_column 5 CURRENT_TIMESTAMP
SELECT * FROM t14a ORDER BY c1;
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo *** Master Drop c5 ***
connection master;
@@ -749,7 +749,7 @@ sync_slave_with_master;
--echo *** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -822,7 +822,7 @@ sync_slave_with_master;
--echo *** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -877,7 +877,7 @@ sync_slave_with_master;
--echo *** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
eval CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
diff --git a/mysql-test/suite/rpl/include/rpl_flsh_tbls.test b/mysql-test/suite/rpl/include/rpl_flsh_tbls.test
index a8cec3d2a1a..491897ae1e5 100644
--- a/mysql-test/suite/rpl/include/rpl_flsh_tbls.test
+++ b/mysql-test/suite/rpl/include/rpl_flsh_tbls.test
@@ -6,6 +6,12 @@
source include/master-slave.inc;
+connection slave;
+source include/stop_slave.inc;
+change master to master_use_gtid=no;
+source include/start_slave.inc;
+connection master;
+
let $SERVER_VERSION=`select version()`;
create table t1 (a int) ENGINE=MyISAM;
diff --git a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc b/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc
deleted file mode 100644
index cb51058f0ae..00000000000
--- a/mysql-test/suite/rpl/include/rpl_innodb_rows_counters.inc
+++ /dev/null
@@ -1,48 +0,0 @@
-#########################################
-# Author: Benjamin Renard benj@fb.com
-# Date: 11/15/2013
-# Purpose: Showing the difference between current innodb rows stats and the ones recorded at the beginning of the test
-# Requirements: Having @[master|slave]_[system_]rows_[read|inserted|deleted|updated] counters already created
-#########################################
-
---connection master
-
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @master_rows_read;
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @master_rows_updated;
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @master_rows_deleted;
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @master_rows_inserted;
-
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @master_system_rows_read;
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @master_system_rows_updated;
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @master_system_rows_deleted;
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @master_system_rows_inserted;
-
---sync_slave_with_master
-
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @slave_rows_read;
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @slave_rows_updated;
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @slave_rows_deleted;
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @slave_rows_inserted;
-
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @slave_system_rows_read;
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @slave_system_rows_updated;
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @slave_system_rows_deleted;
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @slave_system_rows_inserted;
-
---connection master
diff --git a/mysql-test/suite/rpl/include/rpl_loaddata.test b/mysql-test/suite/rpl/include/rpl_loaddata.test
index f0933c1023f..0a6d03aa837 100644
--- a/mysql-test/suite/rpl/include/rpl_loaddata.test
+++ b/mysql-test/suite/rpl/include/rpl_loaddata.test
@@ -109,7 +109,7 @@ connection slave;
# RESET SLAVE and see if error is cleared in SHOW SLAVE STATUS.
stop slave;
-reset slave;
+--source include/reset_slave.inc
--source include/check_slave_no_error.inc
# Finally, see if logging is done ok on master for a failing LOAD DATA INFILE
diff --git a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
index 54eb13d7f09..96d75f33fb0 100644
--- a/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
+++ b/mysql-test/suite/rpl/include/rpl_parallel_29322.inc
@@ -19,7 +19,8 @@
--connection slave
--source include/stop_slave.inc
-reset slave;
+--let $master_use_gtid_option=No
+--source include/reset_slave.inc
--connection master
--let $datadir= `SELECT @@datadir`
diff --git a/mysql-test/suite/rpl/include/rpl_reset_slave.test b/mysql-test/suite/rpl/include/rpl_reset_slave.test
index e7a78f36efc..d4c9d70169b 100644
--- a/mysql-test/suite/rpl/include/rpl_reset_slave.test
+++ b/mysql-test/suite/rpl/include/rpl_reset_slave.test
@@ -11,7 +11,9 @@
-- source include/master-slave.inc
sync_slave_with_master;
--disable_query_log
+set sql_log_bin=0;
call mtr.add_suppression('Slave I/O: Get master BINLOG_CHECKSUM failed with error');
+set sql_log_bin=1;
--enable_query_log
let $status_items= Master_User, Master_Host;
source include/show_slave_status.inc;
@@ -20,7 +22,7 @@ source include/stop_slave.inc;
change master to master_user='test';
source include/show_slave_status.inc;
-reset slave;
+--source include/reset_slave.inc
source include/show_slave_status.inc;
change master to master_user='root';
@@ -31,13 +33,13 @@ source include/show_slave_status.inc;
# test of crash with temp tables & RESET SLAVE
# (test to see if RESET SLAVE clears temp tables in memory and disk)
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
source include/start_slave.inc;
connection master;
create temporary table t1 (a int);
sync_slave_with_master;
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
source include/start_slave.inc;
sync_with_master;
show status like 'slave_open_temp_tables';
@@ -51,7 +53,7 @@ sync_slave_with_master;
# clearing the status
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
source include/check_slave_no_error.inc;
#
@@ -79,7 +81,7 @@ let $slave_io_errno= 1045;
--source include/wait_for_slave_io_error.inc
--source include/stop_slave_sql.inc
-reset slave;
+--source include/reset_slave.inc
source include/check_slave_no_error.inc;
change master to master_user='root';
@@ -88,7 +90,7 @@ change master to master_user='root';
# BUG#11809016 - NO WAY TO DISCOVER AN INSTANCE IS NO LONGER A SLAVE FOLLOWING MYSQL BUG#28796
#
-reset slave;
+--source include/reset_slave.inc
--source include/start_slave.inc
--source include/stop_slave.inc
@@ -97,6 +99,7 @@ reset slave;
--let $_slave_master_port= query_get_value(SHOW SLAVE STATUS, Master_Port, 1)
reset slave all;
+set @@global.gtid_slave_pos= "";
--error ER_BAD_SLAVE
start slave;
diff --git a/mysql-test/suite/rpl/include/rpl_semi_sync.inc b/mysql-test/suite/rpl/include/rpl_semi_sync.inc
index c3cd918b5fc..720ec059350 100644
--- a/mysql-test/suite/rpl/include/rpl_semi_sync.inc
+++ b/mysql-test/suite/rpl/include/rpl_semi_sync.inc
@@ -17,9 +17,16 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
+# While 'Current_Pos' exists as an option for Using_Gtd, keeping these
+# events in the binlog will update gtid_binlog_pos, and the later calls to
+# set `@@global.gtid_slave_pos= ""` will provide warning messages with
+# inconsistent GTID values because the seq_nos are non-deterministic with
+# the masters events coming in concurrently
+set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin=1;
connection master;
# wait for dying connections (if any) to disappear
@@ -36,7 +43,7 @@ let $_connections_normal_slave= query_get_value(SHOW STATUS LIKE 'Threads_connec
--echo #
connection slave;
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
@@ -351,7 +358,7 @@ show status like 'Rpl_semi_sync_master_yes_tx';
connection slave;
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
# Kill the dump thread on master for previous slave connection and
--source include/kill_binlog_dump_threads.inc
@@ -388,7 +395,7 @@ show status like 'Rpl_semi_sync_master_yes_tx';
--echo #
connection slave;
source include/stop_slave.inc;
-reset slave;
+--source include/reset_slave.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/include/rpl_skip_replication.inc b/mysql-test/suite/rpl/include/rpl_skip_replication.inc
index 97fc961d438..d1044c4bf51 100644
--- a/mysql-test/suite/rpl/include/rpl_skip_replication.inc
+++ b/mysql-test/suite/rpl/include/rpl_skip_replication.inc
@@ -19,6 +19,12 @@
--source include/have_innodb.inc
--source include/master-slave.inc
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
connection slave;
# Test that SUPER is required to change @@replicate_events_marked_for_skip.
CREATE USER 'nonsuperuser'@'127.0.0.1';
diff --git a/mysql-test/suite/rpl/include/rpl_slave_max_statement_time.inc b/mysql-test/suite/rpl/include/rpl_slave_max_statement_time.inc
new file mode 100644
index 00000000000..e064fb074dc
--- /dev/null
+++ b/mysql-test/suite/rpl/include/rpl_slave_max_statement_time.inc
@@ -0,0 +1,79 @@
+#
+# Helper test file to ensure that an event running on a slave which executes
+# for longer than @@slave_max_statement_time will time out. By default, it will
+# use the sleep function to imitate a long running function. This can be
+# changed to use locks using the parameter with_lock.
+#
+# Parameters:
+# with_lock (boolean, in) : Changes the long running command from using SLEEP
+# to using locks. In particular, the MTR test will take the table level
+# write lock on the slave side, while the slave concurrently tries to
+# execute an insert statement.
+#
+# use_load_data (boolean, in) : If in row logging format, uses LOAD DATA
+# INFILLE command to create Load_log_events to create the events which
+# should time out
+#
+
+--connection master
+create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB;
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET GLOBAL slave_max_statement_time=0.75;
+
+--connection master
+--echo # Long running command due to a lock conflict
+if (!$use_load_data)
+{
+ INSERT INTO t1(b) VALUES (1);
+}
+if ($use_load_data)
+{
+ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+}
+--source include/save_master_gtid.inc
+
+--connection slave1
+ BEGIN; INSERT INTO t1(b) VALUES (1);
+
+--connection slave
+
+--echo # Starting slave to receive event which will take longer to execute
+--echo # than slave_max_statement_time
+START SLAVE;
+
+# ER_SLAVE_STATEMENT_TIMEOUT
+--let $slave_sql_errno= 4192
+--source include/wait_for_slave_sql_error.inc
+
+--echo # Ensuring event was not processed..
+--let $t1_count= `select count(*) from t1`
+if ($t1_count != 0)
+{
+ --die Event should have timed out on the slave and not been executed
+}
+--echo # ..success
+
+--echo # Remove slave timeout and catch up to master
+SET GLOBAL slave_max_statement_time=0;
+
+--connection slave1
+ ROLLBACK;
+
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+--echo # Test case cleanup
+--connection master
+DROP TABLE t1;
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
index 32f33b2a31d..ae5f83613fe 100644
--- a/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
+++ b/mysql-test/suite/rpl/include/rpl_start_stop_slave.test
@@ -195,7 +195,7 @@ let $master_pos= `SELECT $master_pos + 1`;
--connection slave
--source include/stop_slave.inc
--replace_regex /[0-9]+/MASTER_POS/
-eval CHANGE MASTER TO master_log_pos=$master_pos;
+eval CHANGE MASTER TO master_log_pos=$master_pos, master_use_gtid=no;
START SLAVE;
# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
diff --git a/mysql-test/suite/rpl/r/rpl_000010.result b/mysql-test/suite/rpl/r/rpl_000010.result
index ae989f25e1b..a86d71bd33f 100644
--- a/mysql-test/suite/rpl/r/rpl_000010.result
+++ b/mysql-test/suite/rpl/r/rpl_000010.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
diff --git a/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result
index c75e65ebb6f..49f3ac455f1 100644
--- a/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result
+++ b/mysql-test/suite/rpl/r/rpl_auto_increment_bug33029.result
@@ -38,6 +38,8 @@ id
==== Clean up ====
stop slave sql_thread;
include/cleanup_fake_relay_log.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
DROP TABLE t1, t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result
index 5c141eed596..730fb67ebc9 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result
@@ -14,4 +14,6 @@ include/wait_for_slave_sql_error.inc [errno=1594]
Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The possible reasons are: the master's binary log is corrupted (you can check this by running 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or slave's MariaDB code. If you want to check the master's binary log or slave's relay log, you will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
==== Clean up ====
include/cleanup_fake_relay_log.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
index 98688df7273..96b14bc1d9c 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_dump_slave_gtid_state_info.result
@@ -5,6 +5,8 @@ SET GLOBAL LOG_WARNINGS=2;
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection master;
"Test Case 1: Start binlog_dump to slave_server(#), pos(master-bin.000001, ###), using_gtid(1), gtid('')"
diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
index 4c667bd7f5a..0c79b079bd6 100644
--- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result
+++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result
@@ -232,6 +232,9 @@ connection master;
#######################################################################
include/rpl_reset.inc
connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
call mtr.add_suppression("Slave I/O: Relay log write failure: could not queue event from master.*");
call mtr.add_suppression("Error writing file .*");
call mtr.add_suppression("Could not use .*");
@@ -277,5 +280,7 @@ include/stop_slave_sql.inc
Warnings:
Note 1255 Slave already has been stopped
RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
RESET MASTER;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
index 53420891754..2c602ea53aa 100644
--- a/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
+++ b/mysql-test/suite/rpl/r/rpl_blackhole_row_annotate.result
@@ -200,7 +200,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=#/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result b/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
index 5aff978538f..86659816f6c 100644
--- a/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
+++ b/mysql-test/suite/rpl/r/rpl_cant_read_event_incident.result
@@ -2,6 +2,9 @@ include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+include/stop_slave.inc
connection master;
call mtr.add_suppression("Error in Log_event::read_log_event()");
include/rpl_stop_server.inc [server_number=1]
@@ -10,7 +13,9 @@ show binlog events;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Wrong offset or I/O error
connection slave;
call mtr.add_suppression("Slave I/O: Got fatal error 1236 from master when reading data from binary log");
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
start slave;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
@@ -20,6 +25,8 @@ reset master;
connection slave;
stop slave;
reset slave;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
drop table if exists t;
reset master;
End of the tests
diff --git a/mysql-test/suite/rpl/r/rpl_change_master.result b/mysql-test/suite/rpl/r/rpl_change_master.result
index 48cec72d917..88801b07bba 100644
--- a/mysql-test/suite/rpl/r/rpl_change_master.result
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result
@@ -26,4 +26,9 @@ connection master;
CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_CERT='',
MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
+"Usage of CURRENT_POS in CHANGE MASTER MASTER_USE_GTID is dreprecated.
+CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
+CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_change_master_demote.result b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
new file mode 100644
index 00000000000..38cff83829e
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_change_master_demote.result
@@ -0,0 +1,687 @@
+include/master-slave.inc
+[connection master]
+connection slave;
+include/stop_slave.inc
+change master to master_use_gtid=slave_pos;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+#
+# Test Case 1: When both gtid_binlog_pos and gtid_slave_pos are
+# empty, MASTER_DEMOTE_TO_SLAVE=1 results in no change to replication
+# state.
+#
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS
+GTID_CURRENT_POS
+GTID_SLAVE_POS
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS
+GTID_CURRENT_POS
+GTID_SLAVE_POS
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS
+GTID_CURRENT_POS 0-2-3
+GTID_SLAVE_POS 0-2-3
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
+# completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
+#
+connection slave;
+include/stop_slave.inc
+RESET MASTER;
+set @@global.gtid_slave_pos="";
+include/start_slave.inc
+connection master;
+RESET MASTER;
+set @@global.gtid_slave_pos="";
+set session gtid_domain_id= 0;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-2
+GTID_CURRENT_POS 0-1-2
+GTID_SLAVE_POS
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-2
+GTID_CURRENT_POS 0-1-2
+GTID_SLAVE_POS 0-1-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-2
+GTID_CURRENT_POS 0-2-5
+GTID_SLAVE_POS 0-2-5
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
+# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
+# gtid_binlog_pos will overwrite gtid_slave_pos when
+# MASTER_DEMOTE_TO_SLAVE=1.
+#
+connection master;
+INSERT INTO t1 VALUES (2);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-6
+GTID_CURRENT_POS 0-1-6
+GTID_SLAVE_POS 0-2-5
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-6
+GTID_CURRENT_POS 0-1-6
+GTID_SLAVE_POS 0-1-6
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-6
+GTID_CURRENT_POS 0-2-9
+GTID_SLAVE_POS 0-2-9
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
+# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
+#
+connection master;
+# update gtid_binlog_pos and demote it (we have proven this works)
+INSERT INTO t1 VALUES (3);
+# Update to account for statements to verify replication in include file
+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=1;
+RESET SLAVE ALL;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-10
+GTID_CURRENT_POS 0-1-10
+GTID_SLAVE_POS 0-1-10
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-10
+GTID_CURRENT_POS 0-1-10
+GTID_SLAVE_POS 0-1-10
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-10
+GTID_CURRENT_POS 0-2-13
+GTID_SLAVE_POS 0-2-13
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 5: If a new domain id is added into gtid_binlog_pos while
+# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
+# append a new GTID to gtid_slave_pos with the latest seq_no from that
+# domain.
+#
+connection master;
+# Domain_id
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (4);
+set session gtid_domain_id= 1;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-14,1-1-2
+GTID_CURRENT_POS 0-1-14,1-1-2
+GTID_SLAVE_POS 0-2-13
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-14,1-1-2
+GTID_CURRENT_POS 0-1-14,1-1-2
+GTID_SLAVE_POS 0-1-14,1-1-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-14,1-1-2
+GTID_CURRENT_POS 0-2-17,1-1-2
+GTID_SLAVE_POS 0-2-17,1-1-2
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 6: If gtid_slave_pos has multiple GTID positions and
+# gtid_binlog_pos contains updates on existing domain ids, new
+# domains, and differing server_ids, MASTER_DEMOTE_TO_SLAVE=1 will
+# update gtid_slave_pos such that it will have the seq_nos only from
+# the GTIDs last applied by this server. In other words, any GTIDs
+# with server ids that don't match that of the demoting server will be
+# ignored in the update.
+#
+connection master;
+# Update to account for statements to verify replication in include file
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (5);
+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=1;
+RESET SLAVE ALL;
+set session gtid_domain_id= 1;
+INSERT INTO t2 VALUES (2);
+set session gtid_domain_id= 2;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 VALUES (1);
+# The following events have a different server_id and should not go into
+# gtid_slave_pos
+set @old_server_id = @@server_id;
+set session gtid_domain_id= 1;
+set session server_id= 3;
+INSERT INTO t2 VALUES (3);
+set session gtid_domain_id= 4;
+set session server_id= 3;
+CREATE TABLE t5 (a int);
+INSERT INTO t5 VALUES (1);
+set session server_id= @old_server_id;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-2,4-3-2
+GTID_CURRENT_POS 0-1-18,1-1-2,2-1-2
+GTID_SLAVE_POS 0-1-18,1-1-2
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 ;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-2,4-3-2
+GTID_CURRENT_POS 0-1-18,1-1-2,2-1-2
+GTID_SLAVE_POS 0-1-18,1-1-2,2-1-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-2,4-3-2
+GTID_CURRENT_POS 0-2-21,1-3-4,2-1-2,4-3-2
+GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
+# IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
+# than gtid_slave_pos in ignored domains, the CHANGE MASTER TO command
+# will still update gtid_slave_pos with the most recent transactions
+# from gtid_binlog_pos, despite being ignored by CHANGE MASTER TO
+# because they were already applied on the server.
+#
+connection master;
+set session gtid_domain_id= 2;
+INSERT INTO t3 VALUES (2);
+set session gtid_domain_id= 3;
+CREATE TABLE t4 (a int);
+INSERT INTO t4 VALUES (1);
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-21,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-21,1-3-4,2-1-2,4-3-2
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 , ignore_domain_ids=(2,3);
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-21,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-21,1-3-4,2-1-3,3-1-2,4-3-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-18,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+#
+# Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
+# and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
+# START SLAVE UNTIL master_gtid_pos=<G> such that
+# gtid_slave_pos < G < gtid_binlog_pos, then the slave should stop
+# immediately after SSU because gtid_slave_pos should be updated to be
+# after G.
+#
+connection master;
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (6);
+# Tagging ssu_middle_binlog_pos here to be used for START SLAVE UNTIL
+INSERT INTO t1 VALUES (7);
+include/save_master_gtid.inc
+# Ensure slave is up-to-date with master and then disable slave status
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-24,1-3-4,2-1-3,3-1-2,4-3-2
+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=1;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+# GTID ssu_middle_binlog_pos should be considered in the past because
+# gtid_slave_pos should be updated using the latest binlog gtids.
+# The following call to sync_with_master_gtid.inc uses the latest
+# binlog position and should still succeed despite the SSU stop
+# position pointing to a previous event (because
+# master_demote_to_slave=1 merges gtid_binlog_pos into gtid_slave_pos).
+START SLAVE UNTIL master_gtid_pos="ssu_middle_binlog_pos";
+Warnings:
+Note 1278 It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL; otherwise, you will get problems if you get an unexpected slave's mariadbd restart
+# Slave needs time to start and stop automatically
+# Validating neither SQL nor IO threads are running..
+# ..success
+# Clean slave state of master
+RESET SLAVE ALL;
+#
+# Test Case 9: If gtid_slave_pos is more recent than gtid_binlog_pos
+# when demoting the master to become a slave, the replication state
+# should be preserved.
+#
+# rpl_change_master_demote.inc should force
+# gtid_slave_pos > gtid_binlog_pos in domain 0 (due to the step which
+# validates replication works)
+connection master;
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 , ignore_domain_ids=(2,3);
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+Warnings:
+Note 1255 Slave already has been stopped
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+# Demote master to slave with the more recent gtid_slave_pos
+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=1;
+# Validating gtid_slave_pos is unchanged..
+# ..success
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+# Clean slave state of master
+RESET SLAVE ALL;
+#
+# Test Case 10: MASTER_DEMOTE_TO_SLAVE=0 should not change replication
+# state, regardless of gtid_slave_pos in comparison to gtid_binlog_pos.
+#
+# In domain 0, make gtid_slave_pos > gtid_binlog_pos
+connection master;
+include/rpl_change_master_demote.inc
+##############################################
+# Connection semantics change:
+# * True primary is now connection 'slave'
+# * True replica is now connection 'master'
+##############################################
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+# First ensure gtid_slave_pos after master_demote_to_slave matches
+# gtid_current_pos calculation
+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=1 , ignore_domain_ids=(2,3);
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-29,1-3-4,2-1-3,3-1-2,4-3-2
+# Validating gtid_slave_pos == gtid_binlog_pos..
+# ..success
+connection slave;
+# Ensuring replication works correctly after role swap
+connection slave;
+set session gtid_domain_id= 0;
+CREATE TABLE repl_t (a int);
+INSERT INTO repl_t VALUES (1);
+connection master;
+# Validating that replication works..
+# ..success
+# Cleaning up replication check data
+connection slave;
+DROP TABLE repl_t;
+connection master;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_CURRENT_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
+GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
+##############################################
+# Connection semantics change:
+# * True primary is back to connection 'master'
+# * True replica is back to connection 'slave'
+##############################################
+connection master;
+connection slave;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=slave_pos, master_demote_to_slave=1;
+# Tag gtid_slave_pos now (before binlog updates) for later comparison
+connection master;
+# In domain 1, make gtid_slave_pos < gtid_binlog_pos
+set session gtid_domain_id= 1;
+INSERT INTO t2 VALUES (4);
+# In domains 2, 3 and 4, gtid_slave_pos == gtid_binlog_pos
+# Include a new domain id (5)
+set session gtid_domain_id= 5;
+CREATE TABLE t6 (a int);
+INSERT INTO t6 VALUES (1);
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-1-5,2-1-3,3-1-2,4-3-2,5-1-2
+GTID_SLAVE_POS 0-2-32,1-3-4,2-1-3,3-1-2,4-3-2
+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=0;
+# Validating gtid_slave_pos is unchanged..
+# ..success
+# Clean slave state of 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=1;
+RESET SLAVE ALL;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+VARIABLE_NAME GLOBAL_VALUE
+GTID_BINLOG_POS 0-1-26,1-1-5,2-1-3,3-1-2,4-3-2,5-1-2
+GTID_SLAVE_POS 0-2-32,1-1-5,2-1-3,3-1-2,4-3-2,5-1-2
+#
+#
+# Stop slave for error test cases
+connection slave;
+include/stop_slave.inc
+#
+# Error Case 1: MASTER_DEMOTE_TO_SLAVE=1 combined with
+# MASTER_USE_GTID=NO should result in an error.
+#
+connection master;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SLAVE_PORT, master_user='root', master_use_gtid=no, master_demote_to_slave=1;
+ERROR HY000: CHANGE MASTER TO option 'MASTER_DEMOTE_TO_SLAVE=TRUE' is missing requirement Using_Gtid=Slave_Pos
+#
+# Error Case 2: Error when MASTER_DEMOTE_TO_SLAVE=1 is used without
+# binary logging enabled.
+#
+connection master;
+# Restarting master without binary log
+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=1;
+ERROR HY000: You are not using binary logging
+# Restarting master to re-enable binary log
+connection server_1;
+connection default;
+#
+# Error Case 3: Error when MASTER_DEMOTE_TO_SLAVE is provided a
+# non-boolean value.
+#
+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;
+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
+#
+# Cleanup
+#
+connection master;
+DROP TABLE t1, t2, t3, t4, t5, t6;
+include/save_master_gtid.inc
+connection slave;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+include/rpl_end.inc
+#
+### End rpl_change_master_demote.test
diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result
index 21d8ca22feb..7ade3067eae 100644
--- a/mysql-test/suite/rpl/r/rpl_checksum.result
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
call mtr.add_suppression('Slave can not handle replication events with the checksum that master is configured to log');
call mtr.add_suppression('Replication event checksum verification failed');
call mtr.add_suppression('Relay log write failure: could not queue event from master');
@@ -122,7 +127,9 @@ must be zero
0
connection slave;
stop slave;
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
set @@global.binlog_checksum= IF(floor((rand()*1000)%2), "CRC32", "NONE");
flush logs;
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
index 4ec1e2512d2..85cc0cc7ebc 100644
--- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
+++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
@@ -184,6 +184,8 @@ connection server_3;
RESET MASTER;
connection server_4;
RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
include/rpl_change_topology.inc [new topology=1->2->3->4->1]
include/start_slave.inc
connection server_3;
diff --git a/mysql-test/suite/rpl/r/rpl_colSize.result b/mysql-test/suite/rpl/r/rpl_colSize.result
index 5d72ddcec09..95a30c6ee4d 100644
--- a/mysql-test/suite/rpl/r/rpl_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_colSize.result
@@ -6,7 +6,7 @@ DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
include/wait_for_slave_to_stop.inc
-RESET SLAVE;
+include/reset_slave.inc
SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (
diff --git a/mysql-test/suite/rpl/r/rpl_corruption.result b/mysql-test/suite/rpl/r/rpl_corruption.result
index 73bb373d6be..7c60e15a567 100644
--- a/mysql-test/suite/rpl/r/rpl_corruption.result
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
call mtr.add_suppression('Found invalid event in binary log');
call mtr.add_suppression('Slave I/O: Relay log write failure: could not queue event from master');
call mtr.add_suppression('event read from binlog did not pass crc check');
diff --git a/mysql-test/suite/rpl/r/rpl_cross_version.result b/mysql-test/suite/rpl/r/rpl_cross_version.result
index b94b02a24ff..1b67542c106 100644
--- a/mysql-test/suite/rpl/r/rpl_cross_version.result
+++ b/mysql-test/suite/rpl/r/rpl_cross_version.result
@@ -16,5 +16,7 @@ zero
==== Clean up ====
include/stop_slave_sql.inc
include/cleanup_fake_relay_log.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
drop table t1, t3;
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
index 491b27252b4..16b00cee123 100644
--- a/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_deadlock_innodb.result
@@ -63,7 +63,7 @@ include/check_slave_is_running.inc
connection slave;
include/stop_slave.inc
DELETE FROM t2;
-CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>;
+CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>, MASTER_USE_GTID=NO;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
@@ -95,7 +95,7 @@ Warnings:
Warning 1292 Truncated incorrect max_relay_log_size value: '0'
include/stop_slave.inc
DELETE FROM t2;
-CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>;
+CHANGE MASTER TO MASTER_LOG_POS=<master_pos_begin>, MASTER_USE_GTID=NO;
BEGIN;
SELECT * FROM t1 FOR UPDATE;
a
diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave.result b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
index e7daa3328ce..c8c3bc36485 100644
--- a/mysql-test/suite/rpl/r/rpl_delayed_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_delayed_slave.result
@@ -3,6 +3,9 @@ include/master-slave.inc
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
connection slave;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
connection master;
[on master]
CREATE TABLE t1 (a VARCHAR(100), b INT);
@@ -153,7 +156,9 @@ CHANGE MASTER TO MASTER_DELAY = 71;
include/start_slave.inc
# Asserted this: Delay should be 71 when we set it to 71
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
[on master]
connection master;
RESET MASTER;
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
index 5865b75550f..be98b7e3dcd 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_innodb.result
@@ -437,7 +437,7 @@ connection master;
** Stop and Reset Slave **
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
** create table slave side **
CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
@@ -482,7 +482,7 @@ connection slave;
*** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
) ENGINE='InnoDB';
@@ -524,7 +524,7 @@ connection slave;
*** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
) ENGINE='InnoDB';
@@ -573,7 +573,7 @@ connection slave;
*** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
@@ -638,7 +638,7 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP COLUMN `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
*** Drop t14 ***
DROP TABLE t14;
@@ -655,7 +655,9 @@ START SLAVE;
*** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-103. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
@@ -693,7 +695,9 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1054]
Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-104. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
*** Drop t15 ***
DROP TABLE t15;
@@ -710,7 +714,9 @@ START SLAVE;
*** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-105. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
@@ -748,7 +754,9 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1072]
Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-106. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
*** Drop t16 ***
DROP TABLE t16;
@@ -765,7 +773,9 @@ START SLAVE;
*** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-107. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
@@ -831,7 +841,7 @@ connection slave;
*** Create t18 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
@@ -896,7 +906,7 @@ connection slave;
*** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='InnoDB';
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
index f47d79b5b86..53b20b188ba 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_master_myisam.result
@@ -437,7 +437,7 @@ connection master;
** Stop and Reset Slave **
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
** create table slave side **
CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
@@ -482,7 +482,7 @@ connection slave;
*** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
) ENGINE='MyISAM';
@@ -524,7 +524,7 @@ connection slave;
*** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
) ENGINE='MyISAM';
@@ -573,7 +573,7 @@ connection slave;
*** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
@@ -638,7 +638,7 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1091]
Last_SQL_Error = 'Error 'Can't DROP COLUMN `c7`; check that it exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
*** Drop t14 ***
DROP TABLE t14;
@@ -655,7 +655,9 @@ START SLAVE;
*** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-103. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
@@ -693,7 +695,9 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1054]
Last_SQL_Error = 'Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-104. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
*** Drop t15 ***
DROP TABLE t15;
@@ -710,7 +714,9 @@ START SLAVE;
*** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-105. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
@@ -748,7 +754,9 @@ connection slave;
include/wait_for_slave_sql_error.inc [errno=1072]
Last_SQL_Error = 'Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-106. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
*** Drop t16 ***
DROP TABLE t16;
@@ -765,7 +773,9 @@ START SLAVE;
*** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-107. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
@@ -831,7 +841,7 @@ connection slave;
*** Create t18 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
@@ -896,7 +906,7 @@ connection slave;
*** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
) ENGINE='MyISAM';
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result
index 13077c08e89..ea784e7fc21 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_innodb.result
@@ -5,7 +5,7 @@ call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot
**** Diff Table Def Start ****
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
@@ -42,7 +42,7 @@ DROP TABLE t1;
connection slave;
*** Create t2 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -66,7 +66,9 @@ START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1677]
Last_SQL_Error = 'Column 2 of table 'test.t2' cannot be converted from type 'char(10 octets)' to type 'char(5 octets) character set latin1''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
SELECT * FROM t2 ORDER BY a;
a b c d e
connection master;
@@ -79,7 +81,7 @@ DROP TABLE t2;
connection slave;
*** Create t3 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -109,7 +111,7 @@ DROP TABLE t3;
connection slave;
*** Create t4 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -138,7 +140,7 @@ DROP TABLE t4;
connection slave;
*** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT, e DOUBLE,
f DECIMAL(8,2))ENGINE='InnoDB';
@@ -167,7 +169,7 @@ DROP TABLE t5;
connection slave;
*** Create t6 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT)ENGINE='InnoDB';
*** Create t6 on Master ***
@@ -198,7 +200,7 @@ connection slave;
**** Extra Colums Start ****
*** Create t7 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e CHAR(20) DEFAULT 'Extra Column Testing')
@@ -234,7 +236,7 @@ DROP TABLE t7;
connection slave;
*** Create t8 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e INT)ENGINE='InnoDB';
@@ -256,7 +258,7 @@ connection master;
DROP TABLE t8;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
@@ -289,7 +291,7 @@ DROP TABLE t9;
connection slave;
*** Create t10 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
c CHAR(5), e INT DEFAULT '1')ENGINE='InnoDB';
*** Create t10 on Master ***
@@ -317,7 +319,7 @@ DROP TABLE t10;
connection slave;
*** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
*** Create t11 on Master ***
@@ -345,7 +347,7 @@ DROP TABLE t11;
connection slave;
*** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='InnoDB';
*** Create t12 on Master ***
@@ -381,7 +383,7 @@ connection slave;
*** BUG 22177 Start ***
*** Create t13 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
d INT DEFAULT '1',
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -419,7 +421,7 @@ connection slave;
*** Alter Master Table Testing Start ***
*** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -455,7 +457,7 @@ c1 c2 c3 c4 c5 c6 c7
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
*** Create t14a on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -488,7 +490,7 @@ c1 c4 c5 c6 c7
2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
*** Master Drop c5 ***
connection master;
ALTER TABLE t14a DROP COLUMN c5;
@@ -547,7 +549,7 @@ DROP TABLE t14;
connection slave;
*** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -615,7 +617,7 @@ DROP TABLE t15;
connection slave;
*** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -687,7 +689,7 @@ connection slave;
*** Alter Master End ***
*** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
diff --git a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result
index 897a87db66f..8ad7e98798a 100644
--- a/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result
+++ b/mysql-test/suite/rpl/r/rpl_extra_col_slave_myisam.result
@@ -5,7 +5,7 @@ call mtr.add_suppression("Slave SQL.*Column [0-9] of table .test.t[0-9]*. cannot
**** Diff Table Def Start ****
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
@@ -42,7 +42,7 @@ DROP TABLE t1;
connection slave;
*** Create t2 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -66,7 +66,9 @@ START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1677]
Last_SQL_Error = 'Column 2 of table 'test.t2' cannot be converted from type 'char(10 octets)' to type 'char(5 octets) character set latin1''
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
SELECT * FROM t2 ORDER BY a;
a b c d e
connection master;
@@ -79,7 +81,7 @@ DROP TABLE t2;
connection slave;
*** Create t3 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -109,7 +111,7 @@ DROP TABLE t3;
connection slave;
*** Create t4 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
@@ -138,7 +140,7 @@ DROP TABLE t4;
connection slave;
*** Create t5 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT, e DOUBLE,
f DECIMAL(8,2))ENGINE='MyISAM';
@@ -167,7 +169,7 @@ DROP TABLE t5;
connection slave;
*** Create t6 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
c FLOAT, d INT)ENGINE='MyISAM';
*** Create t6 on Master ***
@@ -198,7 +200,7 @@ connection slave;
**** Extra Colums Start ****
*** Create t7 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e CHAR(20) DEFAULT 'Extra Column Testing')
@@ -234,7 +236,7 @@ DROP TABLE t7;
connection slave;
*** Create t8 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
e INT)ENGINE='MyISAM';
@@ -256,7 +258,7 @@ connection master;
DROP TABLE t8;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
d TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
@@ -289,7 +291,7 @@ DROP TABLE t9;
connection slave;
*** Create t10 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
c CHAR(5), e INT DEFAULT '1')ENGINE='MyISAM';
*** Create t10 on Master ***
@@ -317,7 +319,7 @@ DROP TABLE t10;
connection slave;
*** Create t11 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t11 (a INT KEY, b BLOB, f INT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
*** Create t11 on Master ***
@@ -345,7 +347,7 @@ DROP TABLE t11;
connection slave;
*** Create t12 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='MyISAM';
*** Create t12 on Master ***
@@ -381,7 +383,7 @@ connection slave;
*** BUG 22177 Start ***
*** Create t13 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
d INT DEFAULT '1',
e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -419,7 +421,7 @@ connection slave;
*** Alter Master Table Testing Start ***
*** Create t14 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -455,7 +457,7 @@ c1 c2 c3 c4 c5 c6 c7
3 3.00 If is does not, I will open a bug b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
*** Create t14a on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
@@ -488,7 +490,7 @@ c1 c4 c5 c6 c7
2 b1b1b1b1b1b1b1b1 JOE 1 CURRENT_TIMESTAMP
3 b1b1b1b1b1b1b1b1 QA 1 CURRENT_TIMESTAMP
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
*** Master Drop c5 ***
connection master;
ALTER TABLE t14a DROP COLUMN c5;
@@ -547,7 +549,7 @@ DROP TABLE t14;
connection slave;
*** Create t15 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -615,7 +617,7 @@ DROP TABLE t15;
connection slave;
*** Create t16 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
c4 BLOB, c5 CHAR(5),
c6 INT DEFAULT '1',
@@ -687,7 +689,7 @@ connection slave;
*** Alter Master End ***
*** Create t17 on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
d FLOAT DEFAULT '2.00',
e CHAR(5) DEFAULT 'TEST2')
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_basic.result b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
index 32df09789cc..fc7505e144f 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_basic.result
@@ -69,6 +69,8 @@ INSERT INTO t2 VALUES (5, "i1a");
connection server_4;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a b
@@ -89,6 +91,8 @@ connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_4;
UPDATE t2 SET b="j1a" WHERE a=5;
@@ -117,6 +121,8 @@ include/save_master_gtid.inc
connection server_3;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_4,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t2 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
index 153081d9ca5..fc8e69af861 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result
@@ -15,6 +15,8 @@ SET sql_log_bin=1;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_1;
INSERT INTO t1 VALUES (2,1);
INSERT INTO t1 VALUES (3,1);
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
index 4c35d42d90a..a7cb710cc07 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_errorhandling.result
@@ -75,6 +75,8 @@ INSERT INTO t1 VALUES (2);
SET sql_log_bin = 1;
INSERT INTO t1 VALUES (3);
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
BEGIN;
SET GLOBAL gtid_slave_pos = "100-100-100";
ERROR 25000: You are not allowed to execute this command in a transaction
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result b/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result
index 641d186ab78..302bf182ac2 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_excess_initial_delay.result
@@ -4,6 +4,8 @@ CREATE TABLE t1 (i INT);
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID= current_pos, MASTER_DELAY= 10;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection master;
INSERT INTO t1 VALUES (1);
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result
index 15bcb6621ff..19229a3c6c2 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_master_promote.result
@@ -13,15 +13,23 @@ END|
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_3;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_4;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_5;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_1;
SET gtid_domain_id= 1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
@@ -340,6 +348,8 @@ a b
connection server_1;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
master_user = "root", master_use_gtid = current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
@@ -377,6 +387,8 @@ a b
connection server_1;
include/stop_slave.inc
RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
connection server_2;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result
index 5c80e64dc9b..e61df488d62 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4473.result
@@ -13,6 +13,8 @@ reset slave all;
connection server_1;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
master_user='root', MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
include/wait_for_slave_to_start.inc
connection server_2;
@@ -23,6 +25,8 @@ flush logs;
connection server_3;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
select * from t1 order by n;
n
@@ -53,14 +57,20 @@ connection server_1;
include/stop_slave.inc
include/wait_for_slave_to_stop.inc
reset slave all;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
connection server_2;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
master_user = 'root', MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_3;
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_1;
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
index 606207c1d99..cea5aaaeacd 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev4820.result
@@ -45,6 +45,8 @@ SET GLOBAL gtid_slave_pos= '0-2-10';
connection server_1;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_2,
master_user= 'root', master_use_gtid=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE;
connection server_2;
INSERT INTO t1 VALUES (11);
@@ -67,11 +69,15 @@ a
11
include/stop_slave.inc
RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
INSERT INTO t1 VALUES (12);
connection server_2;
INSERT INTO t1 VALUES (22);
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
master_user= 'root', master_use_gtid=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE;
SET sql_log_bin= 0;
CALL mtr.add_suppression("which is not in the master's binlog. Since the master's binlog contains GTIDs with higher sequence numbers, it probably means that the slave has diverged");
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result b/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result
index 9f0ad66bb83..2471f26bc04 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_mdev9033.result
@@ -58,8 +58,8 @@ connection server_3;
include/sync_with_master_gtid.inc
connection server_2;
STOP SLAVE;
-CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
+CHANGE MASTER TO IGNORE_DOMAIN_IDS = ();
connection server_3;
STOP SLAVE;
-CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
+CHANGE MASTER TO IGNORE_DOMAIN_IDS = ();
# End of test.
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_misc.result b/mysql-test/suite/rpl/r/rpl_gtid_misc.result
index a5c61759ed6..ad77aa2350e 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_misc.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_misc.result
@@ -10,6 +10,8 @@ SET sql_log_bin= 0;
INSERT INTO t1 VALUES (1);
SET sql_log_bin= 1;
CHANGE MASTER TO master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection master;
CREATE TEMPORARY TABLE t2 LIKE t1;
INSERT INTO t2 VALUE (1);
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result
index c42348d40ee..de5f30696fe 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_nobinlog.result
@@ -22,6 +22,8 @@ include/stop_slave.inc
connection server_1;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SLAVE_PORT,
master_user = 'root', master_use_gtid = current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE;
include/wait_for_slave_to_start.inc
connection server_2;
@@ -46,12 +48,16 @@ a b
4 2
include/stop_slave.inc
RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
INSERT INTO t1 VALUES (5, 1);
INSERT INTO t1 VALUES (6, 1);
include/save_master_gtid.inc
connection server_2;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
master_use_gtid = current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE;
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER BY a;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
index 4f50d7c6d85..6282e116733 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_reconnect.result
@@ -2,6 +2,8 @@ include/rpl_init.inc [topology=1->2]
connection server_2;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_1;
CREATE TABLE t1 (a INT);
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_sort.result b/mysql-test/suite/rpl/r/rpl_gtid_sort.result
index 34c0fd32766..bb1fb28e0e9 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_sort.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_sort.result
@@ -59,6 +59,8 @@ Variable_name Value
gtid_binlog_state
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
SHOW VARIABLES LIKE 'gtid_binlog_pos';
Variable_name Value
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
index 3c363004170..846854f8668 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_startpos.result
@@ -12,6 +12,8 @@ connection server_2;
SET GLOBAL gtid_slave_pos="";
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
SELECT * FROM t1;
a
@@ -34,11 +36,13 @@ connection server_2;
SET GLOBAL gtid_slave_pos="";
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE;
include/wait_for_slave_io_error.inc [errno=1236]
include/stop_slave.inc
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
-MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4;
+MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4, MASTER_USE_GTID=NO;
include/start_slave.inc
SELECT * FROM t1 ORDER BY a;
a
@@ -56,6 +60,8 @@ connection server_2;
SET GLOBAL gtid_slave_pos='0-1-3';
CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT,
MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
include/sync_with_master_gtid.inc
SELECT * FROM t1 ORDER by a;
@@ -90,12 +96,16 @@ connection server_2;
connection server_2;
include/stop_slave.inc
RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
RESET MASTER;
connection server_1;
RESET MASTER;
connection server_2;
SET GLOBAL gtid_slave_pos='';
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY);
@@ -119,6 +129,8 @@ connection server_2;
include/stop_slave.inc
DROP TABLE t1;
RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
SET GLOBAL gtid_slave_pos="";
Warnings:
Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-4. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
@@ -145,12 +157,14 @@ a
2
*** Test that RESET SLAVE clears the Using_Gtid flag. ***
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
Using_Gtid = 'No'
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1050]
STOP SLAVE IO_THREAD;
CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_1;
INSERT INTO t1 VALUES(3);
@@ -238,6 +252,9 @@ connection server_2;
include/stop_slave.inc
DROP TABLE t1;
RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
+CHANGE MASTER TO MASTER_USE_GTID=NO;
RESET MASTER;
SET GLOBAL gtid_slave_pos= "";
CHANGE MASTER TO master_host='127.0.0.1', master_port=MASTER_PORT, master_user='root', master_use_gtid=no, master_log_file="", master_log_pos= 4;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
index 50f24d56e9a..2bdfcb14123 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_stop_start.result
@@ -6,8 +6,10 @@ INSERT INTO t1 VALUES (1);
connection server_2;
include/stop_slave.inc
Master_Log_File = 'master-bin.000001'
-Using_Gtid = 'No'
+Using_Gtid = 'Slave_Pos'
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
FLUSH LOGS;
connection server_1;
FLUSH LOGS;
diff --git a/mysql-test/suite/rpl/r/rpl_gtid_until.result b/mysql-test/suite/rpl/r/rpl_gtid_until.result
index 1032b8ddd5c..85b066608e5 100644
--- a/mysql-test/suite/rpl/r/rpl_gtid_until.result
+++ b/mysql-test/suite/rpl/r/rpl_gtid_until.result
@@ -1,4 +1,8 @@
include/rpl_init.inc [topology=1->2]
+connection server_2;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
connection server_1;
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
CREATE FUNCTION extract_gtid(d VARCHAR(100), s VARCHAR(100))
@@ -26,6 +30,8 @@ include/stop_slave_io.inc
START SLAVE UNTIL master_gtid_pos = "";
ERROR HY000: START SLAVE UNTIL master_gtid_pos requires that slave is using GTID
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
@@ -199,6 +205,8 @@ include/start_slave.inc
connection server_2;
include/stop_slave.inc
RESET SLAVE ALL;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
RESET MASTER;
SET GLOBAL gtid_slave_pos='';
connection server_1;
@@ -212,6 +220,8 @@ INSERT INTO t1 VALUES (10);
connection server_2;
CHANGE MASTER TO master_host = '127.0.0.1', master_port = SERVER_MYPORT_1,
master_user = "root", master_use_gtid = current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
START SLAVE UNTIL master_gtid_pos = '0-1-2';
include/wait_for_slave_to_start.inc
connection server_1;
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
index 1db69ea4b83..88e0214150b 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result
@@ -14,12 +14,12 @@ connection slave;
*** Default value ***
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root';
slave_net_timeout/slave_heartbeat_timeout=2.0000
-RESET SLAVE;
+include/reset_slave.inc
*** Reset slave affect ***
SET @@global.slave_net_timeout=30;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
-RESET SLAVE;
+include/reset_slave.inc
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 15.000
@@ -31,7 +31,7 @@ SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
Variable_name Value
Slave_heartbeat_period 25.000
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
-RESET SLAVE;
+include/reset_slave.inc
*** Warning if updated slave_net_timeout < slave_heartbeat_timeout ***
SET @@global.slave_net_timeout=FLOOR(SLAVE_HEARTBEAT_TIMEOUT)-1;
@@ -223,11 +223,15 @@ INSERT INTO t1 VALUES (1, 'on slave', NULL);
connection master;
INSERT INTO t1 VALUES (1, 'on master', NULL);
connection slave;
+set sql_log_bin= 0;
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* error.* 1062");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin= 1;
Heartbeat events are received while sql thread stopped (1 means 'yes'): 1
include/stop_slave.inc
+set sql_log_bin= 0;
DROP TABLE t1;
+set sql_log_bin= 1;
*** Master send to slave ***
connection master;
@@ -240,7 +244,9 @@ END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
connection slave;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-2. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;
include/start_slave.inc
connection master;
@@ -256,8 +262,10 @@ connection slave;
*** Flush logs on slave ***
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+set sql_log_bin= 0;
DROP TABLE t1;
+set sql_log_bin= 1;
connection master;
DROP TABLE t1;
RESET MASTER;
@@ -271,7 +279,7 @@ connection master;
SET @@global.slave_compressed_protocol=1;
connection slave;
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
SET @@global.slave_compressed_protocol=1;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
include/start_slave.inc
@@ -283,7 +291,7 @@ SET @@global.slave_compressed_protocol=0;
*** Reset master ***
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
include/start_slave.inc
connection master;
@@ -294,7 +302,7 @@ Heartbeat events are received after reset of master (1 means 'yes'): 1
*** Reload master ***
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=0.1;
include/start_slave.inc
Heartbeat event received
diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
index ff7178ae700..533290d25ca 100644
--- a/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
+++ b/mysql-test/suite/rpl/r/rpl_heartbeat_ssl.result
@@ -15,7 +15,8 @@ MASTER_LOG_FILE='MASTER_BINLOG',
MASTER_SSL=1,
MASTER_SSL_CA='MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CERT='MYSQL_TEST_DIR/std_data/client-cert.pem',
-MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem';
+MASTER_SSL_KEY='MYSQL_TEST_DIR/std_data/client-key.pem',
+MASTER_USE_GTID=NO;
include/start_slave.inc
Master_SSL_Allowed: Yes
Heartbeat event has received
diff --git a/mysql-test/suite/rpl/r/rpl_hrtime.result b/mysql-test/suite/rpl/r/rpl_hrtime.result
index 5f0b8f4123a..230029d9119 100644
--- a/mysql-test/suite/rpl/r/rpl_hrtime.result
+++ b/mysql-test/suite/rpl/r/rpl_hrtime.result
@@ -37,7 +37,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1293832861/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result b/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result
deleted file mode 100644
index a9c8c6d612f..00000000000
--- a/mysql-test/suite/rpl/r/rpl_innodb_bug68220.result
+++ /dev/null
@@ -1,233 +0,0 @@
-include/master-slave.inc
-[connection master]
-connection master;
-select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-connection slave;
-select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-connection master;
-CREATE DATABASE testdb;
-USE testdb;
-CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB;
-INSERT INTO testdb.t1 VALUES (1);
-connection master;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @master_rows_read;
-@rows_read - @master_rows_read
-0
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @master_rows_updated;
-@rows_updated - @master_rows_updated
-0
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @master_rows_deleted;
-@rows_deleted - @master_rows_deleted
-0
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @master_rows_inserted;
-@rows_inserted - @master_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @master_system_rows_read;
-@system_rows_read - @master_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @master_system_rows_updated;
-@system_rows_updated - @master_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @master_system_rows_deleted;
-@system_rows_deleted - @master_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @master_system_rows_inserted;
-@system_rows_inserted - @master_system_rows_inserted
-0
-connection slave;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @slave_rows_read;
-@rows_read - @slave_rows_read
-0
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @slave_rows_updated;
-@rows_updated - @slave_rows_updated
-0
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @slave_rows_deleted;
-@rows_deleted - @slave_rows_deleted
-0
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @slave_rows_inserted;
-@rows_inserted - @slave_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @slave_system_rows_read;
-@system_rows_read - @slave_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @slave_system_rows_updated;
-@system_rows_updated - @slave_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @slave_system_rows_deleted;
-@system_rows_deleted - @slave_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @slave_system_rows_inserted;
-@system_rows_inserted - @slave_system_rows_inserted
-0
-connection master;
-UPDATE t1 SET i=2 WHERE i=1;
-connection slave;
-connection master;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @master_rows_read;
-@rows_read - @master_rows_read
-1
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @master_rows_updated;
-@rows_updated - @master_rows_updated
-1
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @master_rows_deleted;
-@rows_deleted - @master_rows_deleted
-0
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @master_rows_inserted;
-@rows_inserted - @master_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @master_system_rows_read;
-@system_rows_read - @master_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @master_system_rows_updated;
-@system_rows_updated - @master_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @master_system_rows_deleted;
-@system_rows_deleted - @master_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @master_system_rows_inserted;
-@system_rows_inserted - @master_system_rows_inserted
-0
-connection slave;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @slave_rows_read;
-@rows_read - @slave_rows_read
-1
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @slave_rows_updated;
-@rows_updated - @slave_rows_updated
-1
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @slave_rows_deleted;
-@rows_deleted - @slave_rows_deleted
-0
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @slave_rows_inserted;
-@rows_inserted - @slave_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @slave_system_rows_read;
-@system_rows_read - @slave_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @slave_system_rows_updated;
-@system_rows_updated - @slave_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @slave_system_rows_deleted;
-@system_rows_deleted - @slave_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @slave_system_rows_inserted;
-@system_rows_inserted - @slave_system_rows_inserted
-0
-connection master;
-DELETE FROM t1 WHERE i=2;
-connection master;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @master_rows_read;
-@rows_read - @master_rows_read
-2
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @master_rows_updated;
-@rows_updated - @master_rows_updated
-1
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @master_rows_deleted;
-@rows_deleted - @master_rows_deleted
-1
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @master_rows_inserted;
-@rows_inserted - @master_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @master_system_rows_read;
-@system_rows_read - @master_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @master_system_rows_updated;
-@system_rows_updated - @master_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @master_system_rows_deleted;
-@system_rows_deleted - @master_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @master_system_rows_inserted;
-@system_rows_inserted - @master_system_rows_inserted
-0
-connection slave;
-select variable_value into @rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select @rows_read - @slave_rows_read;
-@rows_read - @slave_rows_read
-2
-select variable_value into @rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select @rows_updated - @slave_rows_updated;
-@rows_updated - @slave_rows_updated
-1
-select variable_value into @rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select @rows_deleted - @slave_rows_deleted;
-@rows_deleted - @slave_rows_deleted
-1
-select variable_value into @rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select @rows_inserted - @slave_rows_inserted;
-@rows_inserted - @slave_rows_inserted
-1
-select variable_value into @system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select @system_rows_read - @slave_system_rows_read;
-@system_rows_read - @slave_system_rows_read
-0
-select variable_value into @system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select @system_rows_updated - @slave_system_rows_updated;
-@system_rows_updated - @slave_system_rows_updated
-0
-select variable_value into @system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select @system_rows_deleted - @slave_system_rows_deleted;
-@system_rows_deleted - @slave_system_rows_deleted
-0
-select variable_value into @system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-select @system_rows_inserted - @slave_system_rows_inserted;
-@system_rows_inserted - @slave_system_rows_inserted
-0
-connection master;
-DROP TABLE t1;
-DROP DATABASE testdb;
-connection slave;
-include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/rpl_loaddata.result b/mysql-test/suite/rpl/r/rpl_loaddata.result
index e759f34bb9d..0be197642e9 100644
--- a/mysql-test/suite/rpl/r/rpl_loaddata.result
+++ b/mysql-test/suite/rpl/r/rpl_loaddata.result
@@ -57,7 +57,9 @@ load data infile '../../std_data/rpl_loaddata.dat' into table t1;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1062]
stop slave;
-reset slave;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-14. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
include/check_slave_no_error.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_log_pos.result b/mysql-test/suite/rpl/r/rpl_log_pos.result
index 7f5f34bf831..74080b3936f 100644
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result
@@ -9,7 +9,7 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 # <Binlog_Do_DB> <Binlog_Ignore_DB>
connection slave;
include/stop_slave.inc
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=MASTER_LOG_POS, master_use_gtid=no;
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'binlog truncated in the middle of event; consider out of disk space on master; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
@@ -23,7 +23,7 @@ drop table if exists t1;
create table t1 (n int);
insert into t1 values (1),(2),(3);
connection slave;
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=MASTER_LOG_POS, master_use_gtid=no;
start slave;
select * from t1 ORDER BY n;
n
diff --git a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
index 78a86437867..9de66d179a6 100644
--- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
+++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
FLUSH LOGS;
CREATE TABLE t1(c1 INT);
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
index ac846ac6c00..68e8b22dd02 100644
--- a/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
+++ b/mysql-test/suite/rpl/r/rpl_mariadb_slave_capability.result
@@ -4,6 +4,9 @@ connection master;
set @old_master_binlog_checksum= @@global.binlog_checksum;
connection slave;
include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+include/stop_slave.inc
# Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
SET @@global.debug_dbug='+d,simulate_slave_capability_none';
diff --git a/mysql-test/suite/rpl/r/rpl_mdev382.result b/mysql-test/suite/rpl/r/rpl_mdev382.result
index b88b47b2dfa..6a91d9d89de 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev382.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev382.result
@@ -179,7 +179,7 @@ ROLLBACK/*!*/;
use `db1``; select 'oops!'`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -279,7 +279,7 @@ ROLLBACK/*!*/;
use `db1``; select 'oops!'`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -388,7 +388,7 @@ START TRANSACTION
use `ts``et`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev6020.result b/mysql-test/suite/rpl/r/rpl_mdev6020.result
index b0cb392b04c..fbea6ac38d2 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev6020.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev6020.result
@@ -13,7 +13,7 @@ SET @old_engine= @@GLOBAL.default_storage_engine;
SET GLOBAL default_storage_engine=InnoDB;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=12;
-CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
include/start_slave.inc
connection master;
SET SQL_LOG_BIN=0;
diff --git a/mysql-test/suite/rpl/r/rpl_mdev6386.result b/mysql-test/suite/rpl/r/rpl_mdev6386.result
index d0e5144857a..d62543d8488 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev6386.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev6386.result
@@ -11,6 +11,8 @@ CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on w
INSERT INTO t1 VALUES (1, 2);
SET sql_log_bin= 1;
CHANGE MASTER TO master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
Contents on slave before:
SELECT * FROM t1 ORDER BY a;
a b
diff --git a/mysql-test/suite/rpl/r/rpl_mdev_17614.result b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
index ba077111522..0cc924749c8 100644
--- a/mysql-test/suite/rpl/r/rpl_mdev_17614.result
+++ b/mysql-test/suite/rpl/r/rpl_mdev_17614.result
@@ -31,7 +31,7 @@ a b c
2 2 3
stop slave;
include/wait_for_slave_to_stop.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
drop table t1;
@@ -191,7 +191,7 @@ a b c
2 2 3
stop slave;
include/wait_for_slave_to_stop.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
drop table t1;
diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
index 944ad9331ad..e94e097f41f 100644
--- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
diff --git a/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result b/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result
index bedd103c2a0..7a5cf257458 100644
--- a/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result
+++ b/mysql-test/suite/rpl/r/rpl_mysql57_stm_temporal_round.result
@@ -10,7 +10,7 @@ connection master;
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
connection slave;
-CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result b/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result
index 23b3217895a..8e1d3d03952 100644
--- a/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result
+++ b/mysql-test/suite/rpl/r/rpl_mysql80_stm_temporal_round.result
@@ -10,7 +10,7 @@ connection master;
include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
connection slave;
-CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
include/start_slave.inc
connection master;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_old_master.result b/mysql-test/suite/rpl/r/rpl_old_master.result
index f985bee6832..5e9d8a88a20 100644
--- a/mysql-test/suite/rpl/r/rpl_old_master.result
+++ b/mysql-test/suite/rpl/r/rpl_old_master.result
@@ -8,7 +8,7 @@ include/rpl_start_server.inc [server_number=1]
connection slave;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10;
-CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
FLUSH TABLES WITH READ LOCK;
include/start_slave.inc
include/wait_for_slave_param.inc [Seconds_Behind_Master]
diff --git a/mysql-test/suite/rpl/r/rpl_old_master_29078.result b/mysql-test/suite/rpl/r/rpl_old_master_29078.result
index 944c6c2a0bb..093e2ae0c24 100644
--- a/mysql-test/suite/rpl/r/rpl_old_master_29078.result
+++ b/mysql-test/suite/rpl/r/rpl_old_master_29078.result
@@ -47,45 +47,47 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
connection slave;
-set global explicit_defaults_for_timestamp=1;
-reset slave;
+set global explicit_defaults_for_timestamp=0;
+include/reset_slave.inc
include/start_slave.inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` timestamp NULL DEFAULT NULL,
- `f2` timestamp NULL DEFAULT NULL
+ `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp NULL DEFAULT NULL
+ `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
set time_zone='+2:00';
select * from t1;
f1 f2
-NULL NULL
-NULL NULL
+2022-07-23 16:24:48 2022-07-23 16:24:48
+2022-07-23 16:25:35 0000-00-00 00:00:00
drop table t1;
include/stop_slave.inc
-set global explicit_defaults_for_timestamp=0;
-reset slave;
+set global explicit_defaults_for_timestamp=1;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
include/start_slave.inc
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
- `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
+ `f1` timestamp NULL DEFAULT NULL,
+ `f2` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
+ `a` timestamp NULL DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t1;
f1 f2
-2022-07-23 16:24:48 2022-07-23 16:24:48
-2022-07-23 16:25:35 0000-00-00 00:00:00
+NULL NULL
+NULL NULL
drop table t1;
connection master;
drop table t2;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_29322.result b/mysql-test/suite/rpl/r/rpl_parallel_29322.result
index 55fa6a4acc3..205a7dbc9cf 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_29322.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_29322.result
@@ -16,7 +16,7 @@ set @@global.slave_parallel_workers = 1;
include/start_slave.inc
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
create table t2 (a timestamp, b int);
@@ -109,7 +109,9 @@ connection slave;
set @@global.explicit_defaults_for_timestamp = 1;
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
reset master;
create table t2 (a timestamp, b int);
@@ -201,7 +203,9 @@ set @@global.slave_parallel_workers = 4;
include/start_slave.inc
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
reset master;
create table t2 (a timestamp, b int);
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result
index 47cdb3496da..ed297d10f2a 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_mdev6589.result
@@ -5,6 +5,8 @@ SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
*** MDEV-6589: Incorrect relay log start position when restarting SQL thread after error in parallel replication ***
connection server_1;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result
index 674cd7a32b4..13508815877 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_multilevel2.result
@@ -18,11 +18,15 @@ SET @old_updates= @@GLOBAL.binlog_direct_non_transactional_updates;
SET GLOBAL binlog_direct_non_transactional_updates=OFF;
SET SESSION binlog_direct_non_transactional_updates=OFF;
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_3;
SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=10;
CHANGE MASTER TO master_use_gtid=current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
connection server_1;
BEGIN;
CREATE TEMPORARY TABLE t2 (a INT PRIMARY KEY) ENGINE=MEMORY;
diff --git a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
index 1a1c12f836d..9519bffaa27 100644
--- a/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
+++ b/mysql-test/suite/rpl/r/rpl_parallel_temptable.result
@@ -5,6 +5,8 @@ SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads=5;
CHANGE MASTER TO master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/start_slave.inc
connection server_1;
CREATE TABLE t1 (a INT PRIMARY KEY, b VARCHAR(100) CHARACTER SET utf8);
diff --git a/mysql-test/suite/rpl/r/rpl_perfschema_applier_status_by_coordinator.result b/mysql-test/suite/rpl/r/rpl_perfschema_applier_status_by_coordinator.result
index 88e1848d46e..ffffb580518 100644
--- a/mysql-test/suite/rpl/r/rpl_perfschema_applier_status_by_coordinator.result
+++ b/mysql-test/suite/rpl/r/rpl_perfschema_applier_status_by_coordinator.result
@@ -55,6 +55,7 @@ connection slave;
include/stop_slave.inc
reset slave;
reset master;
+set @@global.gtid_slave_pos= "";
set @saved_slave_trans_retry_interval= @@GLOBAL.slave_transaction_retry_interval;
set global slave_transaction_retry_interval=1;
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_perfschema_connect_config.result b/mysql-test/suite/rpl/r/rpl_perfschema_connect_config.result
index 4ace84ffac4..27cb29d3968 100644
--- a/mysql-test/suite/rpl/r/rpl_perfschema_connect_config.result
+++ b/mysql-test/suite/rpl/r/rpl_perfschema_connect_config.result
@@ -87,6 +87,8 @@ include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be
change master to
master_user = 'root',
master_use_gtid= CURRENT_POS;
+Warnings:
+Warning #### 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/assert.inc [Value returned by SSS and PS table for Using_Gtid should be same.]
# 3) Test for Auto_position= SLAVE_POS
diff --git a/mysql-test/suite/rpl/r/rpl_read_new_relay_log_info.result b/mysql-test/suite/rpl/r/rpl_read_new_relay_log_info.result
index 5c0002a911a..e193a7e1126 100644
--- a/mysql-test/suite/rpl/r/rpl_read_new_relay_log_info.result
+++ b/mysql-test/suite/rpl/r/rpl_read_new_relay_log_info.result
@@ -6,7 +6,7 @@ DROP TABLE t1;
connection slave;
==== Check that we can understand the new format of relay-log.info ====
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
# Read relay-log.info
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
diff --git a/mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result b/mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
index 217bc726e0e..151a00a514b 100644
--- a/mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
+++ b/mysql-test/suite/rpl/r/rpl_read_old_relay_log_info.result
@@ -6,7 +6,7 @@ DROP TABLE t1;
connection slave;
==== Check that we still understand the old format of relay-log.info ====
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
# Read relay-log.info
START SLAVE IO_THREAD;
include/wait_for_slave_io_to_start.inc
diff --git a/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result b/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
index 34ce68cb079..ff2da0a900a 100644
--- a/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
+++ b/mysql-test/suite/rpl/r/rpl_reset_slave_fail.result
@@ -22,7 +22,7 @@ START SLAVE;
ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
START SLAVE;
ERROR HY000: Could not initialize master info structure for ''; more error messages can be found in the MariaDB error log
-RESET SLAVE;
+include/reset_slave.inc
DROP TABLE t1;
START SLAVE UNTIL MASTER_LOG_FILE= 'MASTER_LOG_FILE', MASTER_LOG_POS= MASTER_LOG_POS;;
include/wait_for_slave_sql_to_stop.inc
diff --git a/mysql-test/suite/rpl/r/rpl_row_001.result b/mysql-test/suite/rpl/r/rpl_row_001.result
index 976ac0996bf..926404d29be 100644
--- a/mysql-test/suite/rpl/r/rpl_row_001.result
+++ b/mysql-test/suite/rpl/r/rpl_row_001.result
@@ -6,7 +6,7 @@ connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
connection master;
SELECT COUNT(*) FROM t1;
COUNT(*)
diff --git a/mysql-test/suite/rpl/r/rpl_row_colSize.result b/mysql-test/suite/rpl/r/rpl_row_colSize.result
index 748d83a7f8e..dbfb9325f9c 100644
--- a/mysql-test/suite/rpl/r/rpl_row_colSize.result
+++ b/mysql-test/suite/rpl/r/rpl_row_colSize.result
@@ -11,7 +11,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
CREATE TABLE t1 (a DECIMAL(5,2));
connection master;
CREATE TABLE t1 (a DECIMAL(20, 10));
@@ -25,7 +25,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -34,7 +36,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a DECIMAL(27, 9));
connection master;
CREATE TABLE t1 (a DECIMAL(27, 18));
@@ -48,7 +52,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -57,7 +63,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a NUMERIC(5,2));
connection master;
CREATE TABLE t1 (a NUMERIC(20, 10));
@@ -71,7 +79,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -81,7 +91,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a FLOAT(20));
connection master;
CREATE TABLE t1 (a FLOAT(47));
@@ -95,7 +107,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -105,7 +119,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a BIT(5));
connection master;
CREATE TABLE t1 (a BIT(64));
@@ -119,7 +135,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -128,7 +146,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a BIT(11));
connection master;
CREATE TABLE t1 (a BIT(12));
@@ -142,7 +162,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -152,7 +174,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a SET('4'));
connection master;
CREATE TABLE t1 (a SET('1','2','3','4','5','6','7','8','9'));
@@ -166,7 +190,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -176,7 +202,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a CHAR(10));
connection master;
CREATE TABLE t1 (a CHAR(20));
@@ -190,7 +218,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -200,7 +230,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a ENUM('44','54'));
connection master;
CREATE TABLE t1 (a ENUM(
@@ -245,7 +277,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -255,7 +289,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a VARCHAR(100));
connection master;
CREATE TABLE t1 (a VARCHAR(2000));
@@ -269,7 +305,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -278,7 +316,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a VARCHAR(10));
connection master;
CREATE TABLE t1 (a VARCHAR(200));
@@ -292,7 +332,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -301,7 +343,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a VARCHAR(1000));
connection master;
CREATE TABLE t1 (a VARCHAR(2000));
@@ -315,7 +359,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
@@ -325,7 +371,9 @@ connection master;
DROP TABLE IF EXISTS t1;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
CREATE TABLE t1 (a TINYBLOB);
connection master;
CREATE TABLE t1 (a LONGBLOB);
@@ -339,7 +387,9 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
0
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
index 660c736795b..8ce08e9d550 100644
--- a/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_row_flsh_tbls.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+change master to master_use_gtid=no;
+include/start_slave.inc
+connection master;
create table t1 (a int) ENGINE=MyISAM;
insert into t1 values (10);
create table t2 (a int) ENGINE=MyISAM;
diff --git a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
index 0704f5c69a1..bf63dc57c4b 100644
--- a/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
+++ b/mysql-test/suite/rpl/r/rpl_row_loaddata_concurrent.result
@@ -75,7 +75,9 @@ load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1062]
stop slave;
-reset slave;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-11. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
include/check_slave_no_error.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
index 83f16122d96..67251e2ef72 100644
--- a/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
+++ b/mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result
@@ -91,7 +91,7 @@ include/wait_for_slave_to_stop.inc
connection master;
reset master;
connection slave;
-reset slave;
+include/reset_slave.inc
start slave;
include/wait_for_slave_to_start.inc
connection master;
@@ -168,7 +168,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -191,7 +191,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -221,7 +221,7 @@ include/wait_for_slave_to_stop.inc
connection master;
reset master;
connection slave;
-reset slave;
+include/reset_slave.inc
start slave;
include/wait_for_slave_to_start.inc
connection master;
@@ -306,7 +306,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -335,7 +335,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
@@ -356,7 +356,7 @@ include/wait_for_slave_to_stop.inc
connection master;
reset master;
connection slave;
-reset slave;
+include/reset_slave.inc
start slave;
include/wait_for_slave_to_start.inc
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
index b9e98d5a97d..5e595447e50 100644
--- a/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_row_reset_slave.result
@@ -7,7 +7,7 @@ include/stop_slave.inc
change master to master_user='test';
Master_User = 'test'
Master_Host = '127.0.0.1'
-reset slave;
+include/reset_slave.inc
Master_User = 'test'
Master_Host = '127.0.0.1'
change master to master_user='root';
@@ -15,13 +15,13 @@ include/start_slave.inc
Master_User = 'root'
Master_Host = '127.0.0.1'
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
connection master;
create temporary table t1 (a int);
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
@@ -30,7 +30,7 @@ connection master;
drop temporary table if exists t1;
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
@@ -44,13 +44,14 @@ change master to master_user='impossible_user_name';
start slave;
include/wait_for_slave_io_error.inc [errno=1045]
include/stop_slave_sql.inc
-reset slave;
+include/reset_slave.inc
include/check_slave_no_error.inc
change master to master_user='root';
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
include/stop_slave.inc
reset slave all;
+set @@global.gtid_slave_pos= "";
start slave;
ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
diff --git a/mysql-test/suite/rpl/r/rpl_row_until.result b/mysql-test/suite/rpl/r/rpl_row_until.result
index 82268ce72eb..8ef10bf47b5 100644
--- a/mysql-test/suite/rpl/r/rpl_row_until.result
+++ b/mysql-test/suite/rpl/r/rpl_row_until.result
@@ -10,7 +10,7 @@ INSERT INTO t2 VALUES (3),(4);
DROP TABLE t2;
connection slave;
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT;
connection slave;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=master_pos_drop_t1;
@@ -52,7 +52,7 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=MASTER
ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=MASTER_LOG_POS;
include/stop_slave.inc
-RESET SLAVE;
+include/reset_slave.inc
include/start_slave.inc
include/rpl_reset.inc
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
index 4eeb863bb40..eeafd679187 100644
--- a/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
+++ b/mysql-test/suite/rpl/r/rpl_seconds_behind_master_spike.result
@@ -2,6 +2,9 @@ include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
include/start_slave.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync.result
index d18bd1efda7..edd5e7748e0 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync.result
@@ -6,16 +6,18 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
+set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin=1;
connection master;
#
# Uninstall semi-sync plugins on master and slave
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
connection master;
@@ -310,7 +312,7 @@ Variable_name Value
Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
@@ -340,7 +342,7 @@ Rpl_semi_sync_master_yes_tx 3
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
include/kill_binlog_dump_threads.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
index f2240817489..7341eb547f3 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync.result
@@ -7,16 +7,18 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
+set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin=1;
connection master;
#
# Uninstall semi-sync plugins on master and slave
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
connection master;
@@ -311,7 +313,7 @@ Variable_name Value
Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
@@ -341,7 +343,7 @@ Rpl_semi_sync_master_yes_tx 3
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
include/kill_binlog_dump_threads.inc
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
index fcced801d65..d75a3a2c9b7 100644
--- a/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_after_sync_row.result
@@ -7,16 +7,18 @@ call mtr.add_suppression("Read semi-sync reply");
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.");
call mtr.add_suppression("mysqld: Got an error reading communication packets");
connection slave;
+set sql_log_bin=0;
call mtr.add_suppression("Master server does not support semi-sync");
call mtr.add_suppression("Semi-sync slave .* reply");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin=1;
connection master;
#
# Uninstall semi-sync plugins on master and slave
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
set global rpl_semi_sync_master_enabled= 0;
set global rpl_semi_sync_slave_enabled= 0;
connection master;
@@ -311,7 +313,7 @@ Variable_name Value
Rpl_semi_sync_master_yes_tx 0
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/kill_binlog_dump_threads.inc
connection slave;
include/start_slave.inc
@@ -341,7 +343,7 @@ Rpl_semi_sync_master_yes_tx 3
#
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
connection master;
reset master;
include/kill_binlog_dump_threads.inc
diff --git a/mysql-test/suite/rpl/r/rpl_server_id2.result b/mysql-test/suite/rpl/r/rpl_server_id2.result
index 74145645920..3d8eeb02ca6 100644
--- a/mysql-test/suite/rpl/r/rpl_server_id2.result
+++ b/mysql-test/suite/rpl/r/rpl_server_id2.result
@@ -1,6 +1,9 @@
include/master-slave.inc
[connection master]
connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
create table t1 (n int);
reset master;
stop slave;
diff --git a/mysql-test/suite/rpl/r/rpl_server_id_ignore.result b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
index 22f739d1ec0..3c7f2950d16 100644
--- a/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
+++ b/mysql-test/suite/rpl/r/rpl_server_id_ignore.result
@@ -11,7 +11,7 @@ ignore server id list:
change master to IGNORE_SERVER_IDS= (10, 100);
*** must be 10, 100 ***
ignore server id list: 10, 100
-reset slave;
+include/reset_slave.inc
*** must be empty due to reset slave ***
ignore server id list: 10, 100
change master to IGNORE_SERVER_IDS= (10, 100);
@@ -33,7 +33,7 @@ Tables_in_test
*** allowing events from master ***
stop slave;
include/wait_for_slave_to_stop.inc
-reset slave;
+include/reset_slave.inc
change master to IGNORE_SERVER_IDS= (10, 100);
*** the list must remain (10, 100) after reset slave ***
change master to IGNORE_SERVER_IDS= ();
diff --git a/mysql-test/suite/rpl/r/rpl_skip_replication.result b/mysql-test/suite/rpl/r/rpl_skip_replication.result
index 59d5b50e5cc..96e0a30331d 100644
--- a/mysql-test/suite/rpl/r/rpl_skip_replication.result
+++ b/mysql-test/suite/rpl/r/rpl_skip_replication.result
@@ -1,6 +1,11 @@
include/master-slave.inc
[connection master]
connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
+connection slave;
CREATE USER 'nonsuperuser'@'127.0.0.1';
GRANT ALTER,CREATE,DELETE,DROP,EVENT,INSERT,PROCESS,REPLICATION SLAVE,
SELECT,UPDATE ON *.* TO 'nonsuperuser'@'127.0.0.1';
diff --git a/mysql-test/suite/rpl/r/rpl_slave_alias_replica.result b/mysql-test/suite/rpl/r/rpl_slave_alias_replica.result
index 2a49e80075f..0ede17132df 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_alias_replica.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_alias_replica.result
@@ -30,6 +30,7 @@ include/wait_for_slave_io_to_stop.inc
include/wait_for_slave_sql_to_stop.inc
"Command: RESET SLAVE ALL --> RESET REPLICA ALL"
RESET REPLICA ALL;
+set @@global.gtid_slave_pos= "";
connection master;
RESET MASTER;
CREATE TABLE t(f INT) ENGINE=INNODB;
diff --git a/mysql-test/suite/rpl/r/rpl_slave_max_statement_time.result b/mysql-test/suite/rpl/r/rpl_slave_max_statement_time.result
new file mode 100644
index 00000000000..0314797f6be
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_slave_max_statement_time.result
@@ -0,0 +1,170 @@
+include/master-slave.inc
+[connection master]
+#
+# Set up
+#
+connection master;
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+connection slave;
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Slave log event execution was interrupted");
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+SET @save_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+#
+# Test Case 1) Using a serial slave, the SQL thread should time out when
+# its underlying event executes for longer than @@slave_max_statement_time.
+#
+connection master;
+create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET GLOBAL slave_max_statement_time=0.75;
+connection master;
+# Long running command due to a lock conflict
+INSERT INTO t1(b) VALUES (1);
+include/save_master_gtid.inc
+connection slave1;
+BEGIN;
+INSERT INTO t1(b) VALUES (1);
+connection slave;
+# Starting slave to receive event which will take longer to execute
+# than slave_max_statement_time
+START SLAVE;
+include/wait_for_slave_sql_error.inc [errno=4192]
+# Ensuring event was not processed..
+# ..success
+# Remove slave timeout and catch up to master
+SET GLOBAL slave_max_statement_time=0;
+connection slave1;
+ROLLBACK;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+# Test case cleanup
+connection master;
+DROP TABLE t1;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+include/start_slave.inc
+#
+# Test Case 2) Using a parallel slave, a worker thread should time out
+# when its underlying event executes for longer than
+# @@slave_max_statement_time
+#
+include/stop_slave.inc
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_threads=2;
+SET GLOBAL slave_parallel_mode='optimistic';
+include/start_slave.inc
+connection master;
+create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET GLOBAL slave_max_statement_time=0.75;
+connection master;
+# Long running command due to a lock conflict
+INSERT INTO t1(b) VALUES (1);
+include/save_master_gtid.inc
+connection slave1;
+BEGIN;
+INSERT INTO t1(b) VALUES (1);
+connection slave;
+# Starting slave to receive event which will take longer to execute
+# than slave_max_statement_time
+START SLAVE;
+include/wait_for_slave_sql_error.inc [errno=4192]
+# Ensuring event was not processed..
+# ..success
+# Remove slave timeout and catch up to master
+SET GLOBAL slave_max_statement_time=0;
+connection slave1;
+ROLLBACK;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+# Test case cleanup
+connection master;
+DROP TABLE t1;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+include/start_slave.inc
+include/stop_slave.inc
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+include/start_slave.inc
+#
+# Test Case 3) Load-based log events (from LOAD DATA INFILE) should time
+# out if their execution time exceeds @@slave_max_statement_time
+#
+connection master;
+create table t1(a int not null auto_increment, b int, primary key(a)) engine=InnoDB;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET GLOBAL slave_max_statement_time=0.75;
+connection master;
+# Long running command due to a lock conflict
+load data infile '../../std_data/rpl_loaddata.dat' into table t1;
+include/save_master_gtid.inc
+connection slave1;
+BEGIN;
+INSERT INTO t1(b) VALUES (1);
+connection slave;
+# Starting slave to receive event which will take longer to execute
+# than slave_max_statement_time
+START SLAVE;
+include/wait_for_slave_sql_error.inc [errno=4192]
+# Ensuring event was not processed..
+# ..success
+# Remove slave timeout and catch up to master
+SET GLOBAL slave_max_statement_time=0;
+connection slave1;
+ROLLBACK;
+include/start_slave.inc
+include/sync_with_master_gtid.inc
+# Test case cleanup
+connection master;
+DROP TABLE t1;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+include/start_slave.inc
+#
+# Test Case 4) Locally executed long running statements should not time
+# out due to @@slave_max_statement_time
+#
+connection slave;
+include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET @old_gtid_domain_id=@@GLOBAL.gtid_domain_id;
+SET @@GLOBAL.slave_max_statement_time=0.75;
+SET @@GLOBAL.gtid_domain_id=1;
+include/start_slave.inc
+CREATE TABLE t2 (a int);
+SET STATEMENT sql_log_bin=0 FOR INSERT INTO t2 SELECT SLEEP(1);
+DROP TABLE t2;
+include/stop_slave.inc
+SET GLOBAL gtid_domain_id=@old_gtid_domain_id;
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+include/start_slave.inc
+# Cleanup
+include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@save_slave_max_statement_time;
+include/start_slave.inc
+include/rpl_end.inc
+# End of rpl_slave_max_statement_time.test
diff --git a/mysql-test/suite/rpl/r/rpl_slave_skip.result b/mysql-test/suite/rpl/r/rpl_slave_skip.result
index b9fe6842a11..8896199f499 100644
--- a/mysql-test/suite/rpl/r/rpl_slave_skip.result
+++ b/mysql-test/suite/rpl/r/rpl_slave_skip.result
@@ -63,7 +63,7 @@ c d
3 27
STOP SLAVE;
include/wait_for_slave_to_stop.inc
-RESET SLAVE;
+include/reset_slave.inc
connection master;
RESET MASTER;
SET SESSION BINLOG_FORMAT=STATEMENT;
diff --git a/mysql-test/suite/rpl/r/rpl_sp.result b/mysql-test/suite/rpl/r/rpl_sp.result
index 0bb3d9dc52a..55a826b3213 100644
--- a/mysql-test/suite/rpl/r/rpl_sp.result
+++ b/mysql-test/suite/rpl/r/rpl_sp.result
@@ -784,7 +784,7 @@ DELIMITER /*!*/;
ROLLBACK/*!*/;
SET TIMESTAMP=t/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
SET @@session.sql_mode=0/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
index e008bbc81a7..2c3b694c45d 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_mysqlbinlog_1.result
@@ -5,6 +5,8 @@ set global binlog_alter_two_phase=true;
connection slave;
include/stop_slave.inc
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
set global gtid_strict_mode=1;
# Legacy Master Slave
connect master_node,127.0.0.1,root,,$db_name, $M_port;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_options.result b/mysql-test/suite/rpl/r/rpl_start_alter_options.result
index 30854b12be1..4c6135aaf5e 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_options.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_options.result
@@ -3,6 +3,8 @@ include/master-slave.inc
connection slave;
stop slave;
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
@@ -94,6 +96,8 @@ include/start_slave.inc
connection slave;
stop slave;
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
@@ -185,6 +189,8 @@ include/start_slave.inc
connection slave;
stop slave;
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
@@ -315,6 +321,8 @@ include/start_slave.inc
connection slave;
stop slave;
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
@@ -406,6 +414,8 @@ include/start_slave.inc
connection slave;
stop slave;
change master to master_use_gtid= current_pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
SET GLOBAL slave_parallel_threads=4;
set global slave_parallel_mode=optimistic;
set global gtid_strict_mode=1;
diff --git a/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result b/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result
index a2aba33aee0..2b53fde52a7 100644
--- a/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result
+++ b/mysql-test/suite/rpl/r/rpl_start_alter_restart_master.result
@@ -1,6 +1,10 @@
include/master-slave.inc
[connection master]
connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection slave;
SET @old_debug_slave= @@global.debug;
stop slave;
SET GLOBAL slave_parallel_threads=4;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_000001.result b/mysql-test/suite/rpl/r/rpl_stm_000001.result
index 9ef2ca3bc53..5d6d61d175b 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_000001.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_000001.result
@@ -49,7 +49,7 @@ connection master;
reset master;
connection slave;
stop slave;
-reset slave;
+include/reset_slave.inc
connection master;
connection slave;
lock tables t1 read;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
index 944ad9331ad..e94e097f41f 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
call mtr.add_suppression("Write to binary log failed: Multi-row statements required more than .max_binlog_stmt_cache_size");
call mtr.add_suppression("Write to binary log failed: Multi-statement transaction required more than .max_binlog_cache_size");
diff --git a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
index 660c736795b..8ce08e9d550 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_flsh_tbls.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+change master to master_use_gtid=no;
+include/start_slave.inc
+connection master;
create table t1 (a int) ENGINE=MyISAM;
insert into t1 values (10);
create table t2 (a int) ENGINE=MyISAM;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
index f510eae74f8..a437b66dd78 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_loaddata_concurrent.result
@@ -74,7 +74,9 @@ load data CONCURRENT infile '../../std_data/rpl_loaddata.dat' into table t1;
connection slave;
include/wait_for_slave_sql_error.inc [errno=1062]
stop slave;
-reset slave;
+include/reset_slave.inc
+Warnings:
+Warning 1948 Specified value for @@gtid_slave_pos contains no value for replication domain 0. This conflicts with the binary log which contains GTID 0-2-14. If MASTER_GTID_POS=CURRENT_POS is used, the binlog position will override the new value of @@gtid_slave_pos
include/check_slave_no_error.inc
connection master;
reset master;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
index 1ba2d1b624b..0a365b30b38 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_reset_slave.result
@@ -7,7 +7,7 @@ include/stop_slave.inc
change master to master_user='test';
Master_User = 'test'
Master_Host = '127.0.0.1'
-reset slave;
+include/reset_slave.inc
Master_User = 'test'
Master_Host = '127.0.0.1'
change master to master_user='root';
@@ -15,13 +15,13 @@ include/start_slave.inc
Master_User = 'root'
Master_Host = '127.0.0.1'
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
connection master;
create temporary table t1 (a int);
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
show status like 'slave_open_temp_tables';
Variable_name Value
@@ -30,7 +30,7 @@ connection master;
drop temporary table if exists t1;
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
include/check_slave_no_error.inc
change master to master_user='impossible_user_name';
start slave;
@@ -44,13 +44,14 @@ change master to master_user='impossible_user_name';
start slave;
include/wait_for_slave_io_error.inc [errno=1045]
include/stop_slave_sql.inc
-reset slave;
+include/reset_slave.inc
include/check_slave_no_error.inc
change master to master_user='root';
-reset slave;
+include/reset_slave.inc
include/start_slave.inc
include/stop_slave.inc
reset slave all;
+set @@global.gtid_slave_pos= "";
start slave;
ERROR HY000: Misconfigured slave: MASTER_HOST was not set; Fix in config file or with CHANGE MASTER TO
CHANGE MASTER TO MASTER_HOST= 'MASTER_HOST', MASTER_USER= 'MASTER_USER', MASTER_PORT= MASTER_PORT;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
index 992e6c2181b..40910b8c1f2 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
@@ -104,13 +104,15 @@ connection master;
RESET MASTER;
connection slave;
include/stop_slave.inc
-CHANGE MASTER TO master_log_pos=MASTER_POS;
+CHANGE MASTER TO master_log_pos=MASTER_POS, master_use_gtid=no;
START SLAVE;
include/wait_for_slave_param.inc [Last_IO_Errno]
Last_IO_Errno = '1236'
Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the first event 'master-bin.000001' at XXX, the last event read from 'master-bin.000001' at XXX, the last byte read from 'master-bin.000001' at XXX.''
include/stop_slave.inc
RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
RESET MASTER;
connection slave;
diff --git a/mysql-test/suite/rpl/r/rpl_stm_until.result b/mysql-test/suite/rpl/r/rpl_stm_until.result
index 65f188c11a0..b51e3d847e3 100644
--- a/mysql-test/suite/rpl/r/rpl_stm_until.result
+++ b/mysql-test/suite/rpl/r/rpl_stm_until.result
@@ -69,7 +69,9 @@ Note 1254 Slave is already running
connection slave;
include/stop_slave.inc
drop table if exists t1;
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';
connection master;
drop table if exists t1;
diff --git a/mysql-test/suite/rpl/r/rpl_stop_slave.result b/mysql-test/suite/rpl/r/rpl_stop_slave.result
index a4dbf13290a..50a52d4d4b3 100644
--- a/mysql-test/suite/rpl/r/rpl_stop_slave.result
+++ b/mysql-test/suite/rpl/r/rpl_stop_slave.result
@@ -1,5 +1,10 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+connection master;
# BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
#
diff --git a/mysql-test/suite/rpl/r/rpl_timestamp.result b/mysql-test/suite/rpl/r/rpl_timestamp.result
index 5e38de40b42..d287bad4492 100644
--- a/mysql-test/suite/rpl/r/rpl_timestamp.result
+++ b/mysql-test/suite/rpl/r/rpl_timestamp.result
@@ -7,15 +7,15 @@ create table t1 (f1 timestamp, f2 timestamp);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` timestamp NULL DEFAULT NULL,
- `f2` timestamp NULL DEFAULT NULL
+ `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection slave;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `f1` timestamp NULL DEFAULT NULL,
- `f2` timestamp NULL DEFAULT NULL
+ `f1` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
+ `f2` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
connection master;
drop table t1;
@@ -28,7 +28,7 @@ ROLLBACK/*!*/;
use `test`/*!*/;
SET TIMESTAMP=1656940000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
-SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=1/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0, @@session.explicit_defaults_for_timestamp=0/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
diff --git a/mysql-test/suite/rpl/r/rpl_trigger.result b/mysql-test/suite/rpl/r/rpl_trigger.result
index 06d5a3c895f..f4f700ac477 100644
--- a/mysql-test/suite/rpl/r/rpl_trigger.result
+++ b/mysql-test/suite/rpl/r/rpl_trigger.result
@@ -1,5 +1,9 @@
include/master-slave.inc
[connection master]
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
connection master;
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
@@ -961,7 +965,9 @@ include/rpl_stop_server.inc [server_number=1]
include/rpl_start_server.inc [server_number=1]
--> Master binlog: Server ver: 5.0.16-debug-log, Binlog ver: 4
connection slave;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
START SLAVE;
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
MASTER_POS_WAIT('master-bin.000001', 513) >= 0
@@ -992,7 +998,9 @@ DROP TRIGGER trg1;
DROP TABLE t1;
DROP TABLE t2;
STOP SLAVE;
-RESET SLAVE;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection master;
SHOW TABLES LIKE 't_';
Tables_in_test (t_)
@@ -1083,7 +1091,12 @@ drop table t1;
connection slave;
connection master;
include/rpl_reset.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
connection master;
create table t1 ( f int ) engine = innodb;
create table log ( r int ) engine = myisam;
diff --git a/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result b/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result
index ffa041efd27..e58ea5eb0f2 100644
--- a/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result
+++ b/mysql-test/suite/rpl/r/rpl_upgrade_master_info.result
@@ -4,6 +4,8 @@ include/master-slave.inc
connection slave;
include/stop_slave.inc
CHANGE MASTER TO master_use_gtid=CURRENT_POS;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
include/rpl_stop_server.inc [server_number=2]
include/rpl_start_server.inc [server_number=2]
connection master;
diff --git a/mysql-test/suite/rpl/r/rpl_using_gtid_default.result b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
new file mode 100644
index 00000000000..e077bcd91a4
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_using_gtid_default.result
@@ -0,0 +1,144 @@
+include/master-slave.inc
+[connection master]
+#
+# Slave default configuration should be Slave_Pos
+connection slave;
+#
+# Ensure that a slave configured with Using_Gtid=Slave_Pos will remain
+# as Slave_Pos after RESET SLAVE
+include/stop_slave.inc
+RESET SLAVE;
+# No warning should be given because Slave_Pos never changed
+SHOW WARNINGS;
+Level Code Message
+include/start_slave.inc
+#
+# Ensure that a slave configured with Using_Gtid=No will revert to its
+# default of Slave_Pos after RESET SLAVE for a master which supports
+# GTIDs
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+include/start_slave.inc
+include/stop_slave.inc
+RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
+# A notification that Using_Gtid was reverted should exist
+SHOW WARNINGS;
+Level Code Message
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
+include/start_slave.inc
+# Clear SHOW WARNINGS
+#
+# If the primary does not support GTIDs (version < 10), the replica
+# should fall back to Using_Gtid=No on slave start, and should not
+# revert Using_Gtid to Slave_Pos after RESET SLAVE
+include/stop_slave.inc
+RESET SLAVE ALL;
+CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=1;
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set @@global.debug_dbug= "d,mock_mariadb_primary_v5_in_get_master_version";
+include/start_slave.inc
+# Replica should detect at start that the primary does not support GTIDs
+# and fall-back to Using_Gtid=No
+# Replica should have an informational message stating it is falling
+# back to Using_Gtid=No
+FOUND 1 /Falling back to Using_Gtid=No because master does not support GTIDs/ in mysqld.2.err
+include/stop_slave.inc
+RESET SLAVE;
+# Replica should know that the primary does not support GTIDs and
+# preserve Using_Gtid=No
+# 'No' was not reverted and therefore no note should be added
+SHOW WARNINGS;
+Level Code Message
+set @@global.debug_dbug= @saved_dbug;
+include/start_slave.inc
+#
+# Ensure that a slave configured with Using_Gtid=Current_Pos will revert
+# to its default of Slave_Pos after RESET SLAVE.
+include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=Current_Pos;
+Warnings:
+Warning 1681 'master_use_gtid=current_pos' is deprecated and will be removed in a future release. Please use master_demote_to_slave=1 instead
+include/start_slave.inc
+include/stop_slave.inc
+RESET SLAVE;
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
+# A notification that Using_Gtid was reverted should exist
+SHOW WARNINGS;
+Level Code Message
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'Current_Pos' to 'Slave_Pos'
+include/start_slave.inc
+# Clear SHOW WARNINGS
+# The MTR include file rpl_change_topology.inc should implicitly set
+# MASTER_USE_GTID=NO when provided with $rpl_master_log_file. Note that
+# this will switch master and slave roles.
+connection slave;
+include/stop_slave.inc
+include/rpl_change_topology.inc [new topology=2->1]
+# connection 'master' is the slave in this comparison
+connection master;
+# Validating Using_Gtid=No..
+# ..success
+include/rpl_change_topology.inc [new topology=1->2]
+# connection 'slave' is back to slave role
+connection slave;
+# Validating Using_Gtid=Slave_Pos..
+# ..success
+include/start_slave.inc
+#
+# The MTR include file reset_slave.inc should keep/delete GTID state
+# when reset_slave_keep_gtid_state is set, respectively.
+#
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+include/save_master_gtid.inc
+connection slave;
+include/sync_with_master_gtid.inc
+include/stop_slave.inc
+# Tagging gtid_slave_pos before reset_slave.inc as old_slave_pos
+# Using reset_slave_keep_gtid_state=1 should preserve GTID state
+include/reset_slave.inc
+# Tagging gtid_slave_pos after reset_slave.inc as new_slave_pos
+# Validating old_slave_pos == new_slave_pos..
+# ..success
+# Using reset_slave_keep_gtid_state=0 should empty GTID state
+include/reset_slave.inc
+# Tagging gtid_slave_pos as new_slave_pos
+# Validating new_slave_pos is empty..
+# ..success
+set global gtid_slave_pos="old_slave_pos";
+include/start_slave.inc
+#
+# A replica issued CHANGE MASTER TO specified with log coordinates but
+# not master_use_gtid=no should warn the user that Using_Gtid is being
+# changed to No.
+#
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file';
+Warnings:
+Note 4190 CHANGE MASTER TO is implicitly changing the value of 'Using_Gtid' from 'Slave_Pos' to 'No'
+include/start_slave.inc
+#
+# A replica issued CHANGE MASTER TO specified with log coordinates and
+# master_use_gtid=Slave_Pos should warn the user that the log
+# coordinates will be ignored.
+#
+connection slave;
+include/stop_slave.inc
+CHANGE MASTER TO master_log_pos=io_log_pos, master_log_file='io_log_file', master_use_gtid=Slave_Pos;
+Warnings:
+Note 1618 <MASTER_LOG_FILE> option ignored
+Note 1618 <MASTER_LOG_POS> option ignored
+CHANGE MASTER TO relay_log_pos=relay_log_pos, relay_log_file='relay_log_file', master_use_gtid=Slave_Pos;
+Warnings:
+Note 1618 <RELAY_LOG_FILE> option ignored
+Note 1618 <RELAY_LOG_POS> option ignored
+include/start_slave.inc
+include/rpl_end.inc
+#
+# End of rpl_using_gtid_default.test
diff --git a/mysql-test/suite/rpl/r/rpl_xa_gap_lock.result b/mysql-test/suite/rpl/r/rpl_xa_gap_lock.result
index cb760abe2d2..97e8f2105c4 100644
--- a/mysql-test/suite/rpl/r/rpl_xa_gap_lock.result
+++ b/mysql-test/suite/rpl/r/rpl_xa_gap_lock.result
@@ -38,7 +38,7 @@ include/diff_tables.inc [master:test.t1, slave:test.t1]
include/diff_tables.inc [master:test.t2, slave:test.t2]
DROP TABLE t2, t1;
connection slave;
-CHANGE MASTER TO MASTER_LOG_FILE='LOG_FILE', MASTER_LOG_POS=LOG_POS;
+CHANGE MASTER TO MASTER_LOG_FILE='LOG_FILE', MASTER_LOG_POS=LOG_POS, MASTER_USE_GTID=NO;
SET @@GLOBAL.innodb_limit_optimistic_insert_debug = @saved_innodb_limit_optimistic_insert_debug;
include/start_slave.inc
include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/r/semisync_future-7591.result b/mysql-test/suite/rpl/r/semisync_future-7591.result
index 9dc0ee51e53..80414ac1f8d 100644
--- a/mysql-test/suite/rpl/r/semisync_future-7591.result
+++ b/mysql-test/suite/rpl/r/semisync_future-7591.result
@@ -6,7 +6,7 @@ set global rpl_semi_sync_master_enabled = ON;
connection slave;
include/stop_slave.inc
set global rpl_semi_sync_slave_enabled = ON;
-change master to master_log_file='master-bin.000002', master_log_pos = 320;
+change master to master_log_file='master-bin.000002', master_log_pos = 320, master_use_gtid=no;
start slave;
include/wait_for_slave_io_error.inc [errno=1236]
connection master;
@@ -14,7 +14,9 @@ insert into t1 values (1);
reset master;
connection slave;
include/stop_slave.inc
-reset slave;
+include/reset_slave.inc
+Warnings:
+Note 4190 RESET SLAVE is implicitly changing the value of 'Using_Gtid' from 'No' to 'Slave_Pos'
include/start_slave.inc
set global rpl_semi_sync_slave_enabled = OFF;
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_000010.test b/mysql-test/suite/rpl/t/rpl_000010.test
index de6337dd723..9ff2d6c562d 100644
--- a/mysql-test/suite/rpl/t/rpl_000010.test
+++ b/mysql-test/suite/rpl/t/rpl_000010.test
@@ -3,6 +3,12 @@
source include/master-slave.inc;
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
create table t1 (n int not null auto_increment primary key);
insert into t1 values(NULL);
insert into t1 values(2);
diff --git a/mysql-test/suite/rpl/t/rpl_change_master.test b/mysql-test/suite/rpl/t/rpl_change_master.test
index 9ab49a585e6..2758f9d6e27 100644
--- a/mysql-test/suite/rpl/t/rpl_change_master.test
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test
@@ -108,4 +108,10 @@ CHANGE MASTER TO MASTER_USER='root', MASTER_SSL=0, MASTER_SSL_CA='', MASTER_SSL_
MASTER_SSL_KEY='', MASTER_SSL_CRL='', MASTER_SSL_CRLPATH='';
CHANGE MASTER TO MASTER_USER='root', MASTER_PASSWORD='', MASTER_SSL=0;
+
+# MDEV-20122: Deprecate MASTER_USE_GTID=Current_Pos to favor new MASTER_DEMOTE_TO_SLAVE option
+--echo "Usage of CURRENT_POS in CHANGE MASTER MASTER_USE_GTID is dreprecated.
+CHANGE MASTER TO MASTER_USE_GTID=CURRENT_POS;
+CHANGE MASTER TO MASTER_USE_GTID=SLAVE_POS;
+
--source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_change_master_demote.test b/mysql-test/suite/rpl/t/rpl_change_master_demote.test
new file mode 100644
index 00000000000..15b55014975
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_change_master_demote.test
@@ -0,0 +1,470 @@
+#
+# Purpose:
+#
+# This test suite ensures that the MASTER_DEMOTE_TO_SLAVE option of
+# CHANGE MASTER TO will merge the binlog GTID position (gtid_binlog_pos) into
+# the replication state (gtid_slave_pos).
+#
+#
+# Methodology:
+#
+# A series of test cases validate that MASTER_DEMOTE_TO_SLAVE correctly
+# merges the binlog GTID state into the replication state. Each test case
+# sets up the context in which it will demote the master to a slave, and then
+# calls into an include file to perform the actual demotion and validation.
+# Specifically, the include file will demote the master to be the slave,
+# promote the slave to be the master, ensure that gtid_slave_pos matches
+# gtid_current_pos, ensure replication works correctly in this new
+# configuration, and return the master and slave to their previous roles.
+#
+# The test cases are as follows:
+# 1) When both gtid_binlog_pos and gtid_slave_pos are empty,
+# MASTER_DEMOTE_TO_SLAVE=1 results in no change to replication state.
+#
+# 2) If gtid_slave_pos is empty, gtid_binlog_pos will completely
+# overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
+#
+# 3) Using a single domain id, if neither gtid_slave_pos nor
+# gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
+# gtid_binlog_pos will overwrite gtid_slave_pos when MASTER_DEMOTE_TO_SLAVE=1.
+#
+# 4) If gtid_slave_pos and gtid_binlog_pos are equivalent,
+# MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
+#
+# 5) If multiple new domain ids are added into gtid_binlog_pos while
+# gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will append
+# new GTIDs to gtid_slave_pos with the latest seq_no from each domain.
+#
+# 6) If gtid_slave_pos has multiple GTID positions and gtid_binlog_pos
+# contains updates on existing domain ids, new domains, and differing
+# server_ids, MASTER_DEMOTE_TO_SLAVE=1 will update gtid_slave_pos such that
+# it will have the seq_nos only from the GTIDs last applied by this server.
+# In other words, any GTIDs with server ids that don't match that of the
+# demoting server will be ignored in the update.
+#
+# 7) If MASTER_DEMOTE_TO_SLAVE=1 is combined with IGNORE_DOMAIN_IDS such
+# that gtid_binlog_pos has more recent GTIDs than gtid_slave_pos in ignored
+# domains, the CHANGE MASTER TO command will still update gtid_slave_pos with
+# the most recent transactions from gtid_binlog_pos, despite being ignored by
+# CHANGE MASTER TO because they were already applied on the server.
+#
+# 8) If gtid_binlog_pos is more recent than gtid_slave_pos, and
+# MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
+# START SLAVE UNTIL master_gtid_pos=<G> such that
+# gtid_slave_pos < G < gtid_binlog_pos, then the slave should stop
+# immediately after SSU because gtid_slave_pos should already be after the
+# UNTIL GTID.
+#
+# 9) If gtid_slave_pos is more recent than gtid_binlog_pos when demoting
+# the master to become a slave, the replication state should be preserved.
+#
+# 10) MASTER_DEMOTE_TO_SLAVE=0 should not change replication state,
+# regardless of gtid_slave_pos in comparison to gtid_binlog_pos.
+#
+#
+# Error cases:
+# Error Case 1) MASTER_DEMOTE_TO_SLAVE=1 combined with
+# MASTER_USE_GTID=NO should result in an error.
+#
+# Error Case 2) Error when MASTER_DEMOTE_TO_SLAVE=1 is used without
+# binary logging enabled.
+#
+# Error Case 3) Error when MASTER_DEMOTE_TO_SLAVE is provided a
+# non-boolean value.
+#
+#
+# References:
+# MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based
+# replication is used by default if master supports it
+#
+--source include/master-slave.inc
+--source include/have_log_bin.inc
+--source include/have_binlog_format_mixed.inc
+
+--connection slave
+--source include/stop_slave.inc
+change master to master_use_gtid=slave_pos;
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+--echo #
+--echo # Test Case 1: When both gtid_binlog_pos and gtid_slave_pos are
+--echo # empty, MASTER_DEMOTE_TO_SLAVE=1 results in no change to replication
+--echo # state.
+--echo #
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 2: If gtid_slave_pos is empty, gtid_binlog_pos will
+--echo # completely overwrite it with MASTER_DEMOTE_TO_SLAVE=1.
+--echo #
+--connection slave
+--source include/stop_slave.inc
+RESET MASTER;
+set @@global.gtid_slave_pos="";
+--source include/start_slave.inc
+--connection master
+RESET MASTER;
+set @@global.gtid_slave_pos="";
+set session gtid_domain_id= 0;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1);
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 3: Using a single domain id, if neither gtid_slave_pos nor
+--echo # gtid_binlog_pos are empty, and gtid_binlog_pos is more recent, then
+--echo # gtid_binlog_pos will overwrite gtid_slave_pos when
+--echo # MASTER_DEMOTE_TO_SLAVE=1.
+--echo #
+--connection master
+INSERT INTO t1 VALUES (2);
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 4: If gtid_slave_pos and gtid_binlog_pos are equivalent,
+--echo # MASTER_DEMOTE_TO_SLAVE=1 will not change gtid_slave_pos.
+--echo #
+--connection master
+
+--echo # update gtid_binlog_pos and demote it (we have proven this works)
+INSERT INTO t1 VALUES (3);
+--echo # Update to account for statements to verify replication in include file
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1
+RESET SLAVE ALL;
+
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 5: If a new domain id is added into gtid_binlog_pos while
+--echo # gtid_slave_pos already has a state, MASTER_DEMOTE_TO_SLAVE=1 will
+--echo # append a new GTID to gtid_slave_pos with the latest seq_no from that
+--echo # domain.
+--echo #
+--connection master
+
+--echo # Domain_id
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (4);
+
+set session gtid_domain_id= 1;
+CREATE TABLE t2 (a int);
+INSERT INTO t2 VALUES (1);
+
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 6: If gtid_slave_pos has multiple GTID positions and
+--echo # gtid_binlog_pos contains updates on existing domain ids, new
+--echo # domains, and differing server_ids, MASTER_DEMOTE_TO_SLAVE=1 will
+--echo # update gtid_slave_pos such that it will have the seq_nos only from
+--echo # the GTIDs last applied by this server. In other words, any GTIDs
+--echo # with server ids that don't match that of the demoting server will be
+--echo # ignored in the update.
+--echo #
+
+--connection master
+--echo # Update to account for statements to verify replication in include file
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (5);
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1
+RESET SLAVE ALL;
+
+set session gtid_domain_id= 1;
+INSERT INTO t2 VALUES (2);
+
+set session gtid_domain_id= 2;
+CREATE TABLE t3 (a int);
+INSERT INTO t3 VALUES (1);
+
+--echo # The following events have a different server_id and should not go into
+--echo # gtid_slave_pos
+set @old_server_id = @@server_id;
+set session gtid_domain_id= 1;
+set session server_id= 3;
+INSERT INTO t2 VALUES (3);
+
+set session gtid_domain_id= 4;
+set session server_id= 3;
+CREATE TABLE t5 (a int);
+INSERT INTO t5 VALUES (1);
+set session server_id= @old_server_id;
+
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 7: If MASTER_DEMOTE_TO_SLAVE=1 is combined with
+--echo # IGNORE_DOMAIN_IDS such that gtid_binlog_pos has more recent GTIDs
+--echo # than gtid_slave_pos in ignored domains, the CHANGE MASTER TO command
+--echo # will still update gtid_slave_pos with the most recent transactions
+--echo # from gtid_binlog_pos, despite being ignored by CHANGE MASTER TO
+--echo # because they were already applied on the server.
+--echo #
+--connection master
+
+set session gtid_domain_id= 2;
+INSERT INTO t3 VALUES (2);
+
+set session gtid_domain_id= 3;
+CREATE TABLE t4 (a int);
+INSERT INTO t4 VALUES (1);
+
+--source include/save_master_gtid.inc
+--connection slave
+--source include/sync_with_master_gtid.inc
+--let $ignore_domain_ids=2,3
+--source include/rpl_change_master_demote.inc
+
+
+--echo #
+--echo # Test Case 8: If gtid_binlog_pos is more recent than gtid_slave_pos,
+--echo # and MASTER_DEMOTE_TO_SLAVE=1 is combined with a later call to
+--echo # START SLAVE UNTIL master_gtid_pos=<G> such that
+--echo # gtid_slave_pos < G < gtid_binlog_pos, then the slave should stop
+--echo # immediately after SSU because gtid_slave_pos should be updated to be
+--echo # after G.
+--echo #
+
+--connection master
+set session gtid_domain_id= 0;
+INSERT INTO t1 VALUES (6);
+--let $ssu_middle_binlog_pos= `SELECT @@GLOBAL.gtid_binlog_pos`
+--echo # Tagging ssu_middle_binlog_pos here to be used for START SLAVE UNTIL
+INSERT INTO t1 VALUES (7);
+--source include/save_master_gtid.inc
+
+--echo # Ensure slave is up-to-date with master and then disable slave status
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+
+--connection master
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+
+--echo # GTID ssu_middle_binlog_pos should be considered in the past because
+--echo # gtid_slave_pos should be updated using the latest binlog gtids.
+--echo # The following call to sync_with_master_gtid.inc uses the latest
+--echo # binlog position and should still succeed despite the SSU stop
+--echo # position pointing to a previous event (because
+--echo # master_demote_to_slave=1 merges gtid_binlog_pos into gtid_slave_pos).
+--replace_result $ssu_middle_binlog_pos ssu_middle_binlog_pos
+eval START SLAVE UNTIL master_gtid_pos="$ssu_middle_binlog_pos";
+
+--echo # Slave needs time to start and stop automatically
+# Note sync_with_master_gtid.inc, wait_for_slave_to_start.inc, and
+# wait_for_slave_to_stop.inc won't work due to replication state and race
+# conditions
+--sleep 1
+
+--echo # Validating neither SQL nor IO threads are running..
+--let $io_state= query_get_value("SHOW SLAVE STATUS", Slave_IO_State, 1)
+if (`SELECT strcmp("$io_state","") != 0`)
+{
+ die "IO thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID";
+}
+--let $sql_state= query_get_value("SHOW SLAVE STATUS", Slave_SQL_Running_State, 1)
+if (`SELECT strcmp("$sql_state","") != 0`)
+{
+ die "SQL thread should not be running after START SLAVE UNTIL master_gtid_pos using a pre-existing GTID";
+}
+--echo # ..success
+
+--echo # Clean slave state of master
+RESET SLAVE ALL;
+
+
+--echo #
+--echo # Test Case 9: If gtid_slave_pos is more recent than gtid_binlog_pos
+--echo # when demoting the master to become a slave, the replication state
+--echo # should be preserved.
+--echo #
+
+--echo # rpl_change_master_demote.inc should force
+--echo # gtid_slave_pos > gtid_binlog_pos in domain 0 (due to the step which
+--echo # validates replication works)
+--connection master
+--source include/rpl_change_master_demote.inc
+
+--let $current_pos= `SELECT @@gtid_current_pos`
+
+--echo # Demote master to slave with the more recent gtid_slave_pos
+--connection master
+--let $old_slave_pos= `SELECT @@gtid_slave_pos`
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1
+--let $new_slave_pos= `SELECT @@gtid_slave_pos`
+
+--echo # Validating gtid_slave_pos is unchanged..
+if ($old_slave_pos != $new_slave_pos)
+{
+ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+ die "gtid_slave_pos should not change when MASTER_DEMOTE_TO_SLAVE=0";
+}
+--echo # ..success
+
+--echo # Validating gtid_slave_pos == gtid_binlog_pos..
+if ($new_slave_pos != $current_pos)
+{
+ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' OR VARIABLE_NAME LIKE 'gtid_current_pos' ORDER BY VARIABLE_NAME ASC;
+ die gtid_slave_pos calculation after master_demote_to_slave=1 differs from gtid_current_pos;
+}
+--echo # ..success
+
+--echo # Clean slave state of master
+RESET SLAVE ALL;
+
+
+--echo #
+--echo # Test Case 10: MASTER_DEMOTE_TO_SLAVE=0 should not change replication
+--echo # state, regardless of gtid_slave_pos in comparison to gtid_binlog_pos.
+--echo #
+
+--echo # In domain 0, make gtid_slave_pos > gtid_binlog_pos
+--connection master
+--source include/rpl_change_master_demote.inc
+
+--echo # Tag gtid_slave_pos now (before binlog updates) for later comparison
+--let $old_slave_pos= `SELECT @@gtid_slave_pos`
+
+--connection master
+--echo # In domain 1, make gtid_slave_pos < gtid_binlog_pos
+set session gtid_domain_id= 1;
+INSERT INTO t2 VALUES (4);
+
+--echo # In domains 2, 3 and 4, gtid_slave_pos == gtid_binlog_pos
+
+--echo # Include a new domain id (5)
+set session gtid_domain_id= 5;
+CREATE TABLE t6 (a int);
+INSERT INTO t6 VALUES (1);
+
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=0
+
+--echo # Validating gtid_slave_pos is unchanged..
+--let $new_slave_pos= `SELECT @@gtid_slave_pos`
+if ($old_slave_pos != $new_slave_pos)
+{
+ SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+ die gtid_slave_pos should not change when MASTER_DEMOTE_TO_SLAVE=0;
+}
+--echo # ..success
+
+--echo # Clean slave state of master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--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=1
+RESET SLAVE ALL;
+SELECT VARIABLE_NAME, GLOBAL_VALUE FROM INFORMATION_SCHEMA.SYSTEM_VARIABLES WHERE VARIABLE_NAME LIKE 'gtid_binlog_pos' OR VARIABLE_NAME LIKE 'gtid_slave_pos' ORDER BY VARIABLE_NAME ASC;
+
+
+--echo #
+--echo #
+--echo # Stop slave for error test cases
+--connection slave
+--source include/stop_slave.inc
+
+--echo #
+--echo # Error Case 1: MASTER_DEMOTE_TO_SLAVE=1 combined with
+--echo # MASTER_USE_GTID=NO should result in an error.
+--echo #
+--connection master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error 4191
+--eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SLAVE_MYPORT, master_user='root', master_use_gtid=no, master_demote_to_slave=1
+
+
+--echo #
+--echo # Error Case 2: Error when MASTER_DEMOTE_TO_SLAVE=1 is used without
+--echo # binary logging enabled.
+--echo #
+--connection master
+
+--echo # Restarting master without binary log
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--shutdown_server
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart: --skip-slave-start=1 --skip-log-bin
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error 1381
+--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=1
+
+--echo # Restarting master to re-enable binary log
+--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+wait
+EOF
+--shutdown_server
+--source include/wait_until_disconnected.inc
+--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
+restart: --skip-slave-start=1
+EOF
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--connection server_1
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+--connection default
+--enable_reconnect
+--source include/wait_until_connected_again.inc
+
+
+--echo #
+--echo # Error Case 3: Error when MASTER_DEMOTE_TO_SLAVE is provided a
+--echo # non-boolean value.
+--echo #
+
+--connection master
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--error 1064
+--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 # Cleanup
+--echo #
+--connection master
+DROP TABLE t1, t2, t3, t4, t5, t6;
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/start_slave.inc
+--source include/sync_with_master_gtid.inc
+
+--source include/rpl_end.inc
+--echo #
+--echo ### End rpl_change_master_demote.test
diff --git a/mysql-test/suite/rpl/t/rpl_colSize.test b/mysql-test/suite/rpl/t/rpl_colSize.test
index d6f817af189..23c8bdc3e2d 100644
--- a/mysql-test/suite/rpl/t/rpl_colSize.test
+++ b/mysql-test/suite/rpl/t/rpl_colSize.test
@@ -17,7 +17,7 @@ DROP TABLE IF EXISTS t1;
sync_slave_with_master;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
-RESET SLAVE;
+--source include/reset_slave.inc
SET @saved_slave_type_conversions = @@slave_type_conversions;
SET GLOBAL SLAVE_TYPE_CONVERSIONS = 'ALL_NON_LOSSY';
diff --git a/mysql-test/suite/rpl/t/rpl_delayed_slave.test b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
index 7dd7b9cf6d9..d00e796b66f 100644
--- a/mysql-test/suite/rpl/t/rpl_delayed_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_delayed_slave.test
@@ -63,6 +63,9 @@
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
--connection slave
call mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
--connection master
@@ -371,7 +374,8 @@ CHANGE MASTER TO MASTER_DELAY = 71;
--source include/rpl_assert.inc
--source include/stop_slave.inc
-RESET SLAVE;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
--echo [on master]
--connection master
RESET MASTER;
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test
index f8e8642af28..76723e1d265 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev9033.test
@@ -63,10 +63,10 @@ DROP TABLE t2;
--connection server_2
STOP SLAVE;
-CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
+CHANGE MASTER TO IGNORE_DOMAIN_IDS = ();
--connection server_3
STOP SLAVE;
-CHANGE MASTER TO MASTER_USE_GTID = NO, IGNORE_DOMAIN_IDS = ();
+CHANGE MASTER TO IGNORE_DOMAIN_IDS = ();
--echo # End of test.
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
index 100d75a8cdc..a7c93ff7ed5 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_startpos.test
@@ -54,7 +54,7 @@ START SLAVE;
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO master_host = '127.0.0.1', master_port = $MASTER_MYPORT,
- MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4;
+ MASTER_LOG_FILE="master-bin.000003", MASTER_LOG_POS=4, MASTER_USE_GTID=NO;
--source include/start_slave.inc
--sync_with_master
SELECT * FROM t1 ORDER BY a;
@@ -185,7 +185,8 @@ SELECT * FROM t1 ORDER BY a;
--echo *** Test that RESET SLAVE clears the Using_Gtid flag. ***
--source include/stop_slave.inc
-RESET SLAVE;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
--let $status_items= Using_Gtid
--source include/show_slave_status.inc
@@ -286,6 +287,7 @@ eval SELECT '$value' AS Gtid_Slave_Pos;
--source include/stop_slave.inc
DROP TABLE t1;
RESET SLAVE ALL;
+CHANGE MASTER TO MASTER_USE_GTID=NO;
RESET MASTER;
SET GLOBAL gtid_slave_pos= "";
diff --git a/mysql-test/suite/rpl/t/rpl_gtid_until.test b/mysql-test/suite/rpl/t/rpl_gtid_until.test
index aa05ecf79ab..49baf7e68e6 100644
--- a/mysql-test/suite/rpl/t/rpl_gtid_until.test
+++ b/mysql-test/suite/rpl/t/rpl_gtid_until.test
@@ -2,6 +2,11 @@
--let $rpl_topology=1->2
--source include/rpl_init.inc
+--connection server_2
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
--connection server_1
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
# Function to extract one GTID from a list.
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
index 45b5d48c13b..d6d14e0278d 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test
@@ -52,7 +52,7 @@ let $slave_net_timeout= query_get_value(SHOW VARIABLES LIKE 'slave_net_timeout',
let $slave_heartbeat_timeout= query_get_value(SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period', Value, 1);
let $result= query_get_value(SELECT $slave_net_timeout/$slave_heartbeat_timeout AS Result, Result, 1);
--echo slave_net_timeout/slave_heartbeat_timeout=$result
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
# Reset slave set slave_heartbeat_timeout = slave_net_timeout/2
@@ -62,7 +62,7 @@ SET @@global.slave_net_timeout=30;
--enable_warnings
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5;
-RESET SLAVE;
+--source include/reset_slave.inc
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
--echo
@@ -75,7 +75,7 @@ SET @@global.slave_net_timeout=50;
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry;
SHOW GLOBAL STATUS LIKE 'slave_heartbeat_period';
SET @@global.slave_net_timeout=@restore_slave_net_timeout;
-RESET SLAVE;
+--source include/reset_slave.inc
--echo
# Set slave_net_timeout less than current value of slave_heartbeat_period
@@ -320,8 +320,10 @@ INSERT INTO t1 VALUES (1, 'on slave', NULL);
--connection master
INSERT INTO t1 VALUES (1, 'on master', NULL);
--connection slave
+set sql_log_bin= 0;
call mtr.add_suppression("Slave SQL.*Duplicate entry .1. for key .PRIMARY.. on query.* error.* 1062");
call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
+set sql_log_bin= 1;
let $slave_errno= ER_DUP_ENTRY
--source include/wait_for_slave_sql_error.inc
let $rcvd_heartbeats_before= query_get_value(SHOW STATUS LIKE 'slave_received_heartbeats', Value, 1);
@@ -330,7 +332,9 @@ let $rcvd_heartbeats_after= query_get_value(SHOW STATUS LIKE 'slave_received_hea
let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_before) > 0 AS Result, Result, 1);
--echo Heartbeat events are received while sql thread stopped (1 means 'yes'): $result
--source include/stop_slave.inc
+set sql_log_bin= 0;
DROP TABLE t1;
+set sql_log_bin= 1;
--echo
# Check received heartbeat events while master send events to slave
@@ -346,7 +350,7 @@ CREATE EVENT e1
END|
DELIMITER ;|
--connection slave
-RESET SLAVE;
+--source include/reset_slave.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=5;
--source include/start_slave.inc
@@ -404,8 +408,10 @@ DROP EVENT e1;
# Check received heartbeat events while logs flushed on slave
--echo *** Flush logs on slave ***
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
+set sql_log_bin= 0;
DROP TABLE t1;
+set sql_log_bin= 1;
--connection master
DROP TABLE t1;
RESET MASTER;
@@ -435,7 +441,7 @@ let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_b
SET @@global.slave_compressed_protocol=1;
--connection slave
--source include/stop_slave.inc
-RESET SLAVE;
+--source include/reset_slave.inc
SET @@global.slave_compressed_protocol=1;
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
@@ -455,7 +461,7 @@ SET @@global.slave_compressed_protocol=0;
--echo *** Reset master ***
--connection slave
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
--source include/start_slave.inc
@@ -474,7 +480,7 @@ let $result= query_get_value(SELECT ($rcvd_heartbeats_after - $rcvd_heartbeats_b
--echo *** Reload master ***
--connection slave
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=$connect_retry, MASTER_HEARTBEAT_PERIOD=0.1;
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
index 810db4cc6f7..2c41fdeeca8 100644
--- a/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
+++ b/mysql-test/suite/rpl/t/rpl_heartbeat_ssl.test
@@ -29,7 +29,8 @@ eval CHANGE MASTER TO
MASTER_SSL=1,
MASTER_SSL_CA='$MYSQL_TEST_DIR/std_data/cacert.pem',
MASTER_SSL_CERT='$MYSQL_TEST_DIR/std_data/client-cert.pem',
- MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem';
+ MASTER_SSL_KEY='$MYSQL_TEST_DIR/std_data/client-key.pem',
+ MASTER_USE_GTID=NO;
--source include/start_slave.inc
# Check SSL state of slave
let $slave_ssl_status= query_get_value(SHOW SLAVE STATUS, Master_SSL_Allowed, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test b/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test
deleted file mode 100644
index 1e4f40a0019..00000000000
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug68220.test
+++ /dev/null
@@ -1,53 +0,0 @@
---source include/have_innodb.inc
---source include/have_binlog_format_row.inc
---source include/master-slave.inc
-
-#
-# Bug#68220: innodb_rows_updated is misleading on slave when *info_repository=TABLE
-#
-
-# created all the base variables at the beginning at the test
---connection master
-select variable_value into @master_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select variable_value into @master_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select variable_value into @master_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select variable_value into @master_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select variable_value into @master_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select variable_value into @master_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select variable_value into @master_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select variable_value into @master_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-
---connection slave
-select variable_value into @slave_rows_read from information_schema.global_status where variable_name = 'innodb_rows_read';
-select variable_value into @slave_rows_updated from information_schema.global_status where variable_name = 'innodb_rows_updated';
-select variable_value into @slave_rows_deleted from information_schema.global_status where variable_name = 'innodb_rows_deleted';
-select variable_value into @slave_rows_inserted from information_schema.global_status where variable_name = 'innodb_rows_inserted';
-select variable_value into @slave_system_rows_read from information_schema.global_status where variable_name = 'innodb_system_rows_read';
-select variable_value into @slave_system_rows_updated from information_schema.global_status where variable_name = 'innodb_system_rows_updated';
-select variable_value into @slave_system_rows_deleted from information_schema.global_status where variable_name = 'innodb_system_rows_deleted';
-select variable_value into @slave_system_rows_inserted from information_schema.global_status where variable_name = 'innodb_system_rows_inserted';
-
---connection master
-CREATE DATABASE testdb;
-USE testdb;
-CREATE TABLE testdb.t1 (i int NOT NULL PRIMARY KEY) ENGINE=InnoDB;
-
-# insert a row and show counters on master and slave
-INSERT INTO testdb.t1 VALUES (1);
---source suite/rpl/include/rpl_innodb_rows_counters.inc
-
-# update the row and show counters on master and slave
-UPDATE t1 SET i=2 WHERE i=1;
---sync_slave_with_master
---source suite/rpl/include/rpl_innodb_rows_counters.inc
-
-# delete the row and show counters on master and slave
-DELETE FROM t1 WHERE i=2;
---source suite/rpl/include/rpl_innodb_rows_counters.inc
-
-# clean the test
-DROP TABLE t1;
-DROP DATABASE testdb;
---sync_slave_with_master
-
---source include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_log_pos.test b/mysql-test/suite/rpl/t/rpl_log_pos.test
index 4f63cd32916..1504cba0774 100644
--- a/mysql-test/suite/rpl/t/rpl_log_pos.test
+++ b/mysql-test/suite/rpl/t/rpl_log_pos.test
@@ -26,7 +26,7 @@ source include/stop_slave.inc;
let $wrong_log_pos= `SELECT $read_pos+2`;
--replace_result $wrong_log_pos MASTER_LOG_POS
-eval change master to master_log_pos=$wrong_log_pos;
+eval change master to master_log_pos=$wrong_log_pos, master_use_gtid=no;
start slave;
let $slave_io_errno= 1236;
--let $show_slave_io_error= 1
@@ -45,7 +45,7 @@ insert into t1 values (1),(2),(3);
save_master_pos;
connection slave;
--replace_result 4 MASTER_LOG_POS
-change master to master_log_pos=4;
+change master to master_log_pos=4, master_use_gtid=no;
start slave;
sync_with_master;
select * from t1 ORDER BY n;
diff --git a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
index 1c087c550d0..cd472f6eab6 100644
--- a/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
+++ b/mysql-test/suite/rpl/t/rpl_manual_change_index_file.test
@@ -1,5 +1,11 @@
source include/master-slave.inc;
+connection slave;
+source include/stop_slave.inc;
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+source include/start_slave.inc;
+connection master;
+
#
# BUG#28421 Infinite loop on slave relay logs
#
diff --git a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
index 19f2db32cb7..d49851cc8ce 100644
--- a/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
+++ b/mysql-test/suite/rpl/t/rpl_mariadb_slave_capability.test
@@ -12,6 +12,12 @@ set @old_master_binlog_checksum= @@global.binlog_checksum;
#
# Test this by binlog rotation before we log any GTIDs.
connection slave;
+
+# Need to stop/start the master without GTID before setting debug_dbug
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
--source include/stop_slave.inc
--echo # Test slave with no capability gets dummy event, which is ignored.
set @old_dbug= @@global.debug_dbug;
diff --git a/mysql-test/suite/rpl/t/rpl_mdev6020.test b/mysql-test/suite/rpl/t/rpl_mdev6020.test
index ec3fd92f817..06f03be1430 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev6020.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev6020.test
@@ -29,7 +29,7 @@ SET GLOBAL default_storage_engine=InnoDB;
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=12;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
-eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
--source include/start_slave.inc
--connection master
diff --git a/mysql-test/suite/rpl/t/rpl_mdev_17614.test b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
index c11aad3305e..8d91944a8eb 100644
--- a/mysql-test/suite/rpl/t/rpl_mdev_17614.test
+++ b/mysql-test/suite/rpl/t/rpl_mdev_17614.test
@@ -42,7 +42,7 @@ SELECT * FROM t1;
# restart replication for the next testcase
stop slave;
--source include/wait_for_slave_to_stop.inc
-reset slave;
+--source include/reset_slave.inc
connection master;
reset master;
drop table t1;
@@ -161,7 +161,7 @@ SELECT * FROM t1;
# restart replication for the next testcase
stop slave;
--source include/wait_for_slave_to_stop.inc
-reset slave;
+--source include/reset_slave.inc
connection master;
reset master;
drop table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test b/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test
index 675b7db0603..34001382c93 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql57_stm_temporal_round.test
@@ -43,7 +43,7 @@ CREATE TABLE t1 (id SERIAL, a DATETIME(3));
--connection slave
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
-eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test b/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test
index ad6df9d9993..551764ac220 100644
--- a/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test
+++ b/mysql-test/suite/rpl/t/rpl_mysql80_stm_temporal_round.test
@@ -47,7 +47,7 @@ CREATE TABLE t1 (id SERIAL, a DATETIME(3));
--connection slave
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
-eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_old_master.test b/mysql-test/suite/rpl/t/rpl_old_master.test
index 6ddc227fc14..6faa8212d66 100644
--- a/mysql-test/suite/rpl/t/rpl_old_master.test
+++ b/mysql-test/suite/rpl/t/rpl_old_master.test
@@ -26,7 +26,7 @@
SET @old_parallel= @@GLOBAL.slave_parallel_threads;
SET GLOBAL slave_parallel_threads=10;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
-eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
+eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4, master_use_gtid=no;
# Block execution yet when the blocked query timestamp has been already accounted
FLUSH TABLES WITH READ LOCK;
diff --git a/mysql-test/suite/rpl/t/rpl_old_master_29078.test b/mysql-test/suite/rpl/t/rpl_old_master_29078.test
index b19fd6466e5..98db6188e96 100644
--- a/mysql-test/suite/rpl/t/rpl_old_master_29078.test
+++ b/mysql-test/suite/rpl/t/rpl_old_master_29078.test
@@ -23,8 +23,10 @@ create table t2 (a timestamp);
--connection slave
-set global explicit_defaults_for_timestamp=1;
-reset slave;
+set global explicit_defaults_for_timestamp=0;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
+
--source include/start_slave.inc
--sync_with_master
show create table t1;
@@ -34,8 +36,10 @@ select * from t1;
drop table t1;
--source include/stop_slave.inc
-set global explicit_defaults_for_timestamp=0;
-reset slave;
+set global explicit_defaults_for_timestamp=1;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
+
--source include/start_slave.inc
--sync_with_master
show create table t1;
diff --git a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
index d4f185812e0..44df3ca4ea7 100644
--- a/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
+++ b/mysql-test/suite/rpl/t/rpl_perfschema_applier_status_by_coordinator.test
@@ -212,6 +212,7 @@ reset master;
--source include/stop_slave.inc
reset slave;
reset master;
+set @@global.gtid_slave_pos= "";
set @saved_slave_trans_retry_interval= @@GLOBAL.slave_transaction_retry_interval;
set global slave_transaction_retry_interval=1;
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/rpl_read_new_relay_log_info.test b/mysql-test/suite/rpl/t/rpl_read_new_relay_log_info.test
index 1e2c8ce2d9f..350071bf3dc 100644
--- a/mysql-test/suite/rpl/t/rpl_read_new_relay_log_info.test
+++ b/mysql-test/suite/rpl/t/rpl_read_new_relay_log_info.test
@@ -12,7 +12,8 @@ DROP TABLE t1;
--echo ==== Check that we can understand the new format of relay-log.info ====
--source include/stop_slave.inc
-RESET SLAVE;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
--let $MYSQLD_DATADIR= `select @@datadir`
# the new version of relay_log.info comes in two versions: with path
@@ -20,6 +21,10 @@ RESET SLAVE;
if ($SYSTEM_PATH_SEPARATOR != /) {
--let $file_suffix= -win
}
+
+# MDEV-19801 changed the default Using_Gtid to Slave_Pos which doesn't
+# automatically purge relay-log.info
+--remove_file $MYSQLD_DATADIR/relay-log.info
--copy_file $MYSQL_TEST_DIR/std_data/new-format-relay-log$file_suffix.info $MYSQLD_DATADIR/relay-log.info
--echo # Read relay-log.info
diff --git a/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test b/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
index ce345445c08..d2206b5bef7 100644
--- a/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
+++ b/mysql-test/suite/rpl/t/rpl_read_old_relay_log_info.test
@@ -13,7 +13,8 @@ DROP TABLE t1;
--echo ==== Check that we still understand the old format of relay-log.info ====
--source include/stop_slave.inc
-RESET SLAVE;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
--let $MYSQLD_DATADIR= `select @@datadir`
# the old version of relay_log.info comes in two versions: with path
@@ -21,6 +22,9 @@ RESET SLAVE;
if ($SYSTEM_PATH_SEPARATOR != /) {
--let $file_suffix= -win
}
+# MDEV-19801 changed the default Using_Gtid to Slave_Pos which doesn't
+# automatically purge relay-log.info
+--remove_file $MYSQLD_DATADIR/relay-log.info
--copy_file $MYSQL_TEST_DIR/std_data/old-format-relay-log$file_suffix.info $MYSQLD_DATADIR/relay-log.info
--echo # Read relay-log.info
diff --git a/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test b/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
index 021dc76d50c..5c7e667695c 100644
--- a/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
+++ b/mysql-test/suite/rpl/t/rpl_reset_slave_fail.test
@@ -67,7 +67,7 @@ START SLAVE;
# Disable "Warning 1612 Being purged log ./slave-relay-bin.0* was not found"
# because it is different on Unix and Windows systems.
--disable_warnings
-RESET SLAVE;
+--source include/reset_slave.inc
--enable_warnings
DROP TABLE t1;
--replace_result $master_exec_file MASTER_LOG_FILE $master_exec_pos MASTER_LOG_POS
diff --git a/mysql-test/suite/rpl/t/rpl_row_001.test b/mysql-test/suite/rpl/t/rpl_row_001.test
index f66c61ffb6e..887c0961a63 100644
--- a/mysql-test/suite/rpl/t/rpl_row_001.test
+++ b/mysql-test/suite/rpl/t/rpl_row_001.test
@@ -14,7 +14,7 @@ connection master;
RESET MASTER;
connection slave;
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
connection master;
let $1=5000;
diff --git a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
index a249043fa19..9e10aaa6216 100644
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
@@ -100,7 +100,7 @@ stop slave;
connection master;
reset master;
connection slave;
-reset slave;
+--source include/reset_slave.inc
start slave;
--source include/wait_for_slave_to_start.inc
connection master;
@@ -167,7 +167,7 @@ stop slave;
connection master;
reset master;
connection slave;
-reset slave;
+--source include/reset_slave.inc
start slave;
--source include/wait_for_slave_to_start.inc
connection master;
@@ -230,7 +230,7 @@ stop slave;
connection master;
reset master;
connection slave;
-reset slave;
+--source include/reset_slave.inc
start slave;
--source include/wait_for_slave_to_start.inc
connection master;
diff --git a/mysql-test/suite/rpl/t/rpl_row_until.test b/mysql-test/suite/rpl/t/rpl_row_until.test
index 478c2206a5a..d318e0d7d26 100644
--- a/mysql-test/suite/rpl/t/rpl_row_until.test
+++ b/mysql-test/suite/rpl/t/rpl_row_until.test
@@ -38,7 +38,7 @@ sync_slave_with_master;
--source include/stop_slave.inc
# Reset slave.
-RESET SLAVE;
+--source include/reset_slave.inc
--replace_result $MASTER_MYPORT MASTER_MYPORT
eval CHANGE MASTER TO MASTER_USER='root', MASTER_CONNECT_RETRY=1, MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT;
@@ -102,7 +102,7 @@ START SLAVE UNTIL RELAY_LOG_FILE='slave-relay-bin.000002', MASTER_LOG_POS=561;
START SLAVE UNTIL MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=740;
--source include/stop_slave.inc
-RESET SLAVE;
+--source include/reset_slave.inc
--source include/start_slave.inc
##############################################################################
diff --git a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
index d1bfbf25bae..600ba9b18d7 100644
--- a/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
+++ b/mysql-test/suite/rpl/t/rpl_seconds_behind_master_spike.test
@@ -25,6 +25,12 @@
--source include/master-slave.inc
--connection slave
+
+# Using_Gtid needs to start as NO before updating debug_dbug
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
--source include/stop_slave.inc
SET @save_dbug= @@GLOBAL.debug_dbug;
SET @@global.debug_dbug="+d,pause_sql_thread_on_fde";
diff --git a/mysql-test/suite/rpl/t/rpl_server_id2.test b/mysql-test/suite/rpl/t/rpl_server_id2.test
index 6a8493ca278..6dc2f791954 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id2.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id2.test
@@ -2,7 +2,12 @@
# from itself, if running with --replicate-same-server-id.
source include/master-slave.inc;
+
connection slave;
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
create table t1 (n int);
reset master;
# replicate ourselves
diff --git a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
index 537978f1701..dbe7544bbb1 100644
--- a/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
+++ b/mysql-test/suite/rpl/t/rpl_server_id_ignore.test
@@ -38,7 +38,7 @@ change master to IGNORE_SERVER_IDS= (10, 100);
--echo *** must be 10, 100 ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;
-reset slave;
+--source include/reset_slave.inc
--echo *** must be empty due to reset slave ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
echo ignore server id list: $ignore_list;
@@ -80,7 +80,7 @@ if (`select $slave_relay_pos1 - $slave_relay_pos0`)
stop slave;
source include/wait_for_slave_to_stop.inc;
-reset slave;
+--source include/reset_slave.inc
change master to IGNORE_SERVER_IDS= (10, 100);
--echo *** the list must remain (10, 100) after reset slave ***
let $ignore_list= query_get_value(SHOW SLAVE STATUS, Replicate_Ignore_Server_Ids, 1);
diff --git a/mysql-test/suite/rpl/t/rpl_slave_alias_replica.test b/mysql-test/suite/rpl/t/rpl_slave_alias_replica.test
index 324821a325f..06cf12ab7a9 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_alias_replica.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_alias_replica.test
@@ -65,6 +65,7 @@ STOP REPLICA SQL_THREAD;
--source include/wait_for_slave_sql_to_stop.inc
--echo "Command: RESET SLAVE ALL --> RESET REPLICA ALL"
RESET REPLICA ALL;
+set @@global.gtid_slave_pos= "";
--connection master
RESET MASTER;
diff --git a/mysql-test/suite/rpl/t/rpl_slave_max_statement_time.test b/mysql-test/suite/rpl/t/rpl_slave_max_statement_time.test
new file mode 100644
index 00000000000..b600c8434d5
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_slave_max_statement_time.test
@@ -0,0 +1,110 @@
+#
+# Purpose:
+# This test ensures that the slave can limit the execution time of its
+# events via the global system variable @@slave_max_statement_time.
+#
+# Methodology:
+# This test uses the following test cases to ensure that a slave will
+# correctly limit the execution time of its events:
+# 1) Using a serial slave, the SQL thread should time out when its underlying
+# event executes for longer than @@slave_max_statement_time.
+# 2) Using a parallel slave, a worker thread should time out when its
+# underlying event executes for longer than @@slave_max_statement_time.
+# 3) Load-based log events (from LOAD DATA INFILE) should time out if their
+# execution time exceeds @@slave_max_statement_time
+# 4) Locally executed long running statements should not time out due to
+# @@slave_max_statement_time.
+#
+# References:
+# MDEV-27161: Add option for SQL thread to limit maximum execution time per
+# query replicated
+#
+--source include/have_innodb.inc
+--source include/master-slave.inc
+
+--echo #
+--echo # Set up
+--echo #
+--connection master
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+--connection slave
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Slave log event execution was interrupted");
+SET STATEMENT sql_log_bin=0 FOR CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format");
+SET @save_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+
+--let $with_lock= 1
+
+--echo #
+--echo # Test Case 1) Using a serial slave, the SQL thread should time out when
+--echo # its underlying event executes for longer than @@slave_max_statement_time.
+--echo #
+--source include/rpl_slave_max_statement_time.inc
+
+
+--echo #
+--echo # Test Case 2) Using a parallel slave, a worker thread should time out
+--echo # when its underlying event executes for longer than
+--echo # @@slave_max_statement_time
+--echo #
+
+--source include/stop_slave.inc
+SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads;
+SET @old_parallel_mode=@@GLOBAL.slave_parallel_mode;
+SET GLOBAL slave_parallel_threads=2;
+SET GLOBAL slave_parallel_mode='optimistic';
+--source include/start_slave.inc
+
+--source include/rpl_slave_max_statement_time.inc
+
+--source include/stop_slave.inc
+SET GLOBAL slave_parallel_mode=@old_parallel_mode;
+SET GLOBAL slave_parallel_threads=@old_parallel_threads;
+--source include/start_slave.inc
+
+
+--echo #
+--echo # Test Case 3) Load-based log events (from LOAD DATA INFILE) should time
+--echo # out if their execution time exceeds @@slave_max_statement_time
+--echo #
+--let $use_load_data= 1
+--source include/rpl_slave_max_statement_time.inc
+--let $use_load_data=
+
+
+--echo #
+--echo # Test Case 4) Locally executed long running statements should not time
+--echo # out due to @@slave_max_statement_time
+--echo #
+
+--connection slave
+--source include/stop_slave.inc
+SET @old_slave_max_statement_time=@@GLOBAL.slave_max_statement_time;
+SET @old_gtid_domain_id=@@GLOBAL.gtid_domain_id;
+SET @@GLOBAL.slave_max_statement_time=0.75;
+SET @@GLOBAL.gtid_domain_id=1;
+--source include/start_slave.inc
+
+CREATE TABLE t2 (a int);
+SET STATEMENT sql_log_bin=0 FOR INSERT INTO t2 SELECT SLEEP(1);
+--let $t2_count= `SELECT COUNT(*) FROM t2`
+if ($t2_count != 1)
+{
+ --die Local long running insert statement should have completed
+}
+DROP TABLE t2;
+
+--source include/stop_slave.inc
+SET GLOBAL gtid_domain_id=@old_gtid_domain_id;
+SET GLOBAL slave_max_statement_time=@old_slave_max_statement_time;
+--source include/start_slave.inc
+
+
+--echo # Cleanup
+--source include/stop_slave.inc
+SET GLOBAL slave_max_statement_time=@save_slave_max_statement_time;
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
+
+--echo # End of rpl_slave_max_statement_time.test
diff --git a/mysql-test/suite/rpl/t/rpl_slave_skip.test b/mysql-test/suite/rpl/t/rpl_slave_skip.test
index 2ec80758486..933e7d14f9b 100644
--- a/mysql-test/suite/rpl/t/rpl_slave_skip.test
+++ b/mysql-test/suite/rpl/t/rpl_slave_skip.test
@@ -55,7 +55,7 @@ SELECT * FROM t2;
STOP SLAVE;
--source include/wait_for_slave_to_stop.inc
-RESET SLAVE;
+--source include/reset_slave.inc
connection master;
RESET MASTER;
diff --git a/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test b/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test
index eaddaa4db67..aac3af6fc14 100644
--- a/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test
+++ b/mysql-test/suite/rpl/t/rpl_start_alter_restart_master.test
@@ -10,6 +10,11 @@
--source include/no_valgrind_without_big.inc
--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
+--connection slave
SET @old_debug_slave= @@global.debug;
stop slave;
--let $gtid_strict_mode= `select @@gtid_strict_mode`
diff --git a/mysql-test/suite/rpl/t/rpl_stm_000001.test b/mysql-test/suite/rpl/t/rpl_stm_000001.test
index 62b5c5b1cd0..3851e61868b 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_000001.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_000001.test
@@ -53,7 +53,7 @@ connection master;
reset master;
connection slave;
stop slave;
-reset slave;
+--source include/reset_slave.inc
connection master;
let $1=5000;
diff --git a/mysql-test/suite/rpl/t/rpl_stm_until.test b/mysql-test/suite/rpl/t/rpl_stm_until.test
index c9a922e44fa..ebfd355b299 100644
--- a/mysql-test/suite/rpl/t/rpl_stm_until.test
+++ b/mysql-test/suite/rpl/t/rpl_stm_until.test
@@ -19,6 +19,7 @@
-- source include/have_binlog_format_mixed_or_statement.inc
-- source include/master-slave.inc
+--let $master_use_gtid_option= No
-- source include/rpl_reset.inc
# Test is dependent on binlog positions
@@ -127,7 +128,7 @@ source include/stop_slave.inc;
--disable_warnings
drop table if exists t1;
--enable_warnings
-reset slave;
+--source include/reset_slave.inc
--replace_result $MASTER_MYPORT MASTER_PORT
eval change master to master_host='127.0.0.1',master_port=$MASTER_MYPORT, master_user='root';
diff --git a/mysql-test/suite/rpl/t/rpl_stop_slave.test b/mysql-test/suite/rpl/t/rpl_stop_slave.test
index 17efa7ade3b..14c6641f120 100644
--- a/mysql-test/suite/rpl/t/rpl_stop_slave.test
+++ b/mysql-test/suite/rpl/t/rpl_stop_slave.test
@@ -4,6 +4,12 @@ source include/have_debug_sync.inc;
source include/have_binlog_format_mixed_or_statement.inc;
source include/master-slave.inc;
+--connection slave
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--connection master
+
--echo
--echo # BUG#56118 STOP SLAVE does not wait till trx with CREATE TMP TABLE ends
--echo #
diff --git a/mysql-test/suite/rpl/t/rpl_trigger.test b/mysql-test/suite/rpl/t/rpl_trigger.test
index f692816bf82..e442ed94d5a 100644
--- a/mysql-test/suite/rpl/t/rpl_trigger.test
+++ b/mysql-test/suite/rpl/t/rpl_trigger.test
@@ -5,6 +5,12 @@
--source include/have_binlog_format_mixed_or_statement.inc
--source include/have_innodb.inc
--source include/master-slave.inc
+
+connection slave;
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
connection master;
disable_query_log;
@@ -329,7 +335,8 @@ let $binlog_version= query_get_value(SHOW BINLOG EVENTS, Info, 1);
# Make the slave to replay the new binlog.
connection slave;
-RESET SLAVE;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
START SLAVE;
SELECT MASTER_POS_WAIT('master-bin.000001', 513) >= 0;
@@ -362,7 +369,7 @@ DROP TABLE t1;
DROP TABLE t2;
STOP SLAVE;
-RESET SLAVE;
+--source include/reset_slave.inc
# The master should be clean.
@@ -498,6 +505,10 @@ connection master;
--source include/rpl_reset.inc
connection slave;
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+
connection master;
create table t1 ( f int ) engine = innodb;
diff --git a/mysql-test/suite/rpl/t/rpl_using_gtid_default.test b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
new file mode 100644
index 00000000000..eab5b4dd504
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_using_gtid_default.test
@@ -0,0 +1,303 @@
+#
+# Purpose:
+# This test ensures that a replica's default value for Using_Gtid is set
+# correctly. Specifically, it should default to 'Slave_Pos' unless the primary
+# server does not support GTIDs (if its version is less than 10), in which case
+# the replica should fall back to 'No'.
+#
+# Methodology:
+# Validate the value of Using_Gtid on replica initialization and after
+# RESET SLAVE commands. Specifically, we validate the following use cases:
+#
+# Case 1) A replica will initialize with Slave_Pos if the primary supports
+# GTIDs
+# Case 2) A replica configured with the Using_Gtid=Slave_Pos issued
+# RESET SLAVE will preserve Using_Gtid without any informational
+# messages.
+# Case 3) A replica configured with Using_Gtid=No against a master which
+# supports GTIDs will revert to Using_Gtid=Slave_Pos after issued
+# RESET SLAVE and provide an informational note
+# Case 4) A fresh replica targeting a primary which does not support GTIDs
+# will fall back to Using_Gtid=No when starting. An informational
+# message should be logged.
+# Case 5) A replica connected to a primary which does not support GTIDs
+# should preserve Using_Gtid=No when issued RESET SLAVE. No message
+# should be provided to the user.
+# Case 6) A replica configured with Using_Gtid=Current_Pos should revert
+# to Slave_Pos when issued RESET SLAVE. An informational message
+# should be provided to the user.
+# Case 7) The MTR include file rpl_change_topology.inc should implicitly
+# set MASTER_USE_GTID=NO when provided with $rpl_master_log_file
+# Case 8) The MTR include file reset_slave.inc should keep/delete GTID state
+# when reset_slave_keep_gtid_state is set, respectively.
+# Case 9) A replica issued CHANGE MASTER TO specified with log coordinates
+# but not master_use_gtid=No should warn the user that Using_Gtid is
+# being changed to No.
+# Case 10) A replica issued CHANGE MASTER TO specified with log coordinates
+# and master_use_gtid=Slave_Pos should warn the user that the log
+# coordinates will be ignored.
+#
+# References:
+# MDEV-19801: Change defaults for CHANGE MASTER TO so that GTID-based
+# replication is used by default if master supports it
+#
+--source include/have_debug.inc
+--source include/master-slave.inc
+
+# Format independent test so just use one
+--source include/have_binlog_format_mixed.inc
+
+--echo #
+--echo # Slave default configuration should be Slave_Pos
+--let $expected_default_using_gtid= Slave_Pos
+--connection slave
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != $expected_default_using_gtid)
+{
+ --die Using_Gtid had wrong default value of '$using_gtid' when it should have been '$expected_default_using_gtid'
+}
+
+--echo #
+--echo # Ensure that a slave configured with Using_Gtid=Slave_Pos will remain
+--echo # as Slave_Pos after RESET SLAVE
+--source include/stop_slave.inc
+RESET SLAVE;
+--echo # No warning should be given because Slave_Pos never changed
+SHOW WARNINGS;
+--source include/start_slave.inc
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != $expected_default_using_gtid)
+{
+ --die Using_Gtid has wrong value of '$using_gtid' when it should be '$expected_default_using_gtid'
+}
+
+
+--echo #
+--echo # Ensure that a slave configured with Using_Gtid=No will revert to its
+--echo # default of Slave_Pos after RESET SLAVE for a master which supports
+--echo # GTIDs
+
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=NO;
+--source include/start_slave.inc
+--source include/stop_slave.inc
+RESET SLAVE;
+--echo # A notification that Using_Gtid was reverted should exist
+SHOW WARNINGS;
+--source include/start_slave.inc
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != $expected_default_using_gtid)
+{
+ --die Using_Gtid has wrong value of '$using_gtid' when it should be '$expected_default_using_gtid'
+}
+
+--echo # Clear SHOW WARNINGS
+--disable_query_log
+set SQL_LOG_BIN=0;
+CREATE TABLE t1 (a int);
+DROP TABLE t1;
+set SQL_LOG_BIN=1;
+--enable_query_log
+
+
+--echo #
+--echo # If the primary does not support GTIDs (version < 10), the replica
+--echo # should fall back to Using_Gtid=No on slave start, and should not
+--echo # revert Using_Gtid to Slave_Pos after RESET SLAVE
+
+--source include/stop_slave.inc
+RESET SLAVE ALL;
+
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$MASTER_MYPORT, MASTER_USER='root', MASTER_CONNECT_RETRY=1
+SET @saved_dbug= @@GLOBAL.debug_dbug;
+set @@global.debug_dbug= "d,mock_mariadb_primary_v5_in_get_master_version";
+--source include/start_slave.inc
+
+--echo # Replica should detect at start that the primary does not support GTIDs
+--echo # and fall-back to Using_Gtid=No
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != 'No')
+{
+ --die Using_Gtid has wrong value of '$using_gtid' when it should be 'No'
+}
+
+--echo # Replica should have an informational message stating it is falling
+--echo # back to Using_Gtid=No
+let $log_error_= `SELECT @@GLOBAL.log_error`;
+if(!$log_error_)
+{
+ # MySQL Server on windows is started with --console and thus
+ # does not know the location of its .err log, use default location
+ let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.2.err;
+}
+--let SEARCH_FILE=$log_error_
+--let SEARCH_PATTERN=Falling back to Using_Gtid=No because master does not support GTIDs
+--source include/search_pattern_in_file.inc
+
+--source include/stop_slave.inc
+RESET SLAVE;
+
+--echo # Replica should know that the primary does not support GTIDs and
+--echo # preserve Using_Gtid=No
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != 'No')
+{
+ --die Using_Gtid has wrong value of '$using_gtid' when it should be 'No'
+}
+--echo # 'No' was not reverted and therefore no note should be added
+SHOW WARNINGS;
+set @@global.debug_dbug= @saved_dbug;
+--source include/start_slave.inc
+
+
+--echo #
+--echo # Ensure that a slave configured with Using_Gtid=Current_Pos will revert
+--echo # to its default of Slave_Pos after RESET SLAVE.
+
+--source include/stop_slave.inc
+CHANGE MASTER TO MASTER_USE_GTID=Current_Pos;
+--source include/start_slave.inc
+--source include/stop_slave.inc
+RESET SLAVE;
+--echo # A notification that Using_Gtid was reverted should exist
+SHOW WARNINGS;
+--source include/start_slave.inc
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+if ($using_gtid != $expected_default_using_gtid)
+{
+ --die Using_Gtid has wrong value of '$using_gtid' when it should be '$expected_default_using_gtid'
+}
+
+--echo # Clear SHOW WARNINGS
+--disable_query_log
+set SQL_LOG_BIN=0;
+CREATE TABLE t1 (a int);
+DROP TABLE t1;
+set SQL_LOG_BIN=1;
+--enable_query_log
+
+--echo # The MTR include file rpl_change_topology.inc should implicitly set
+--echo # MASTER_USE_GTID=NO when provided with \$rpl_master_log_file. Note that
+--echo # this will switch master and slave roles.
+--connection slave
+--source include/stop_slave.inc
+--let $pos_c= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
+--let $file_c= query_get_value(SHOW SLAVE STATUS, Master_Log_File, 1)
+--let $rpl_master_log_file= 2:$file_c
+--let $rpl_master_log_pos= 2:$pos_c
+--let $rpl_topology= 2->1
+--source include/rpl_change_topology.inc
+
+--echo # connection 'master' is the slave in this comparison
+--connection master
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+--echo # Validating Using_Gtid=No..
+if (`SELECT strcmp("$using_gtid","No") != 0`)
+{
+ --die Using_Gtid should be No when calling rpl_change_topology with \$rpl_master_log_file set
+}
+--echo # ..success
+
+--let $rpl_master_log_file=
+--let $rpl_topology= 1->2
+--source include/rpl_change_topology.inc
+
+--echo # connection 'slave' is back to slave role
+--connection slave
+--let $using_gtid= query_get_value(SHOW SLAVE STATUS, Using_Gtid, 1)
+--echo # Validating Using_Gtid=$expected_default_using_gtid..
+if (`SELECT strcmp("$using_gtid","$expected_default_using_gtid")!= 0`)
+{
+ --die Using_Gtid should be back to $expected_default_using_gtid with empty \$rpl_master_log_file
+}
+--echo # ..success
+--source include/start_slave.inc
+
+--echo #
+--echo # The MTR include file reset_slave.inc should keep/delete GTID state
+--echo # when reset_slave_keep_gtid_state is set, respectively.
+--echo #
+--connection master
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1);
+DROP TABLE t1;
+--source include/save_master_gtid.inc
+
+--connection slave
+--source include/sync_with_master_gtid.inc
+--source include/stop_slave.inc
+
+--echo # Tagging gtid_slave_pos before reset_slave.inc as old_slave_pos
+--let $old_slave_pos= `SELECT @@gtid_slave_pos`
+if (`SELECT strcmp("$old_slave_pos","") = 0`)
+{
+ die gtid_slave_pos is empty but should not be;
+}
+
+--echo # Using reset_slave_keep_gtid_state=1 should preserve GTID state
+--let $master_use_gtid_option=Slave_Pos
+--let $reset_slave_keep_gtid_state=1
+--source include/reset_slave.inc
+
+--echo # Tagging gtid_slave_pos after reset_slave.inc as new_slave_pos
+--let $new_slave_pos= `SELECT @@gtid_slave_pos`
+--echo # Validating old_slave_pos == new_slave_pos..
+if ($old_slave_pos != $new_slave_pos)
+{
+ die gtid_slave_pos unexpectedly changed after running reset_slave.inc;
+}
+--echo # ..success
+
+--echo # Using reset_slave_keep_gtid_state=0 should empty GTID state
+--let $master_use_gtid_option=Slave_Pos
+--let $reset_slave_keep_gtid_state=0
+--source include/reset_slave.inc
+
+--echo # Tagging gtid_slave_pos as new_slave_pos
+--let $new_slave_pos= `SELECT @@gtid_slave_pos`
+--echo # Validating new_slave_pos is empty..
+if (`SELECT strcmp("$new_slave_pos","") != 0`)
+{
+ die gtid_slave_pos should be empty after reset_slave.inc without keeping gtid state;
+}
+--echo # ..success
+--replace_result $old_slave_pos old_slave_pos
+eval set global gtid_slave_pos="$old_slave_pos";
+--source include/start_slave.inc
+
+--echo #
+--echo # A replica issued CHANGE MASTER TO specified with log coordinates but
+--echo # not master_use_gtid=no should warn the user that Using_Gtid is being
+--echo # changed to No.
+--echo #
+--connection slave
+--let $io_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
+--let $io_log_file= query_get_value('SHOW SLAVE STATUS', Master_Log_File, 1)
+--source include/stop_slave.inc
+--replace_result $io_log_file io_log_file $io_log_pos io_log_pos
+--eval CHANGE MASTER TO master_log_pos=$io_log_pos, master_log_file='$io_log_file'
+--source include/start_slave.inc
+
+
+--echo #
+--echo # A replica issued CHANGE MASTER TO specified with log coordinates and
+--echo # master_use_gtid=Slave_Pos should warn the user that the log
+--echo # coordinates will be ignored.
+--echo #
+--connection slave
+--let $io_log_pos= query_get_value('SHOW SLAVE STATUS', Read_Master_Log_Pos, 1)
+--let $io_log_file= query_get_value('SHOW SLAVE STATUS', Master_Log_File, 1)
+--let $relay_log_pos= 4
+--let $relay_log_file= slave-relay-bin.000001
+--source include/stop_slave.inc
+--replace_result $io_log_file io_log_file $io_log_pos io_log_pos
+--eval CHANGE MASTER TO master_log_pos=$io_log_pos, master_log_file='$io_log_file', master_use_gtid=Slave_Pos
+--replace_result $relay_log_file relay_log_file $relay_log_pos relay_log_pos
+--eval CHANGE MASTER TO relay_log_pos=$relay_log_pos, relay_log_file='$relay_log_file', master_use_gtid=Slave_Pos
+--source include/start_slave.inc
+
+--source include/rpl_end.inc
+
+--echo #
+--echo # End of rpl_using_gtid_default.test
diff --git a/mysql-test/suite/rpl/t/rpl_xa_gap_lock.test b/mysql-test/suite/rpl/t/rpl_xa_gap_lock.test
index 9c48891b889..29e883a19d6 100644
--- a/mysql-test/suite/rpl/t/rpl_xa_gap_lock.test
+++ b/mysql-test/suite/rpl/t/rpl_xa_gap_lock.test
@@ -129,7 +129,7 @@ DROP TABLE t2, t1;
# --enable_query_log
#}
--replace_result $master_file LOG_FILE $master_pos LOG_POS
---eval CHANGE MASTER TO MASTER_LOG_FILE='$master_file', MASTER_LOG_POS=$master_pos
+--eval CHANGE MASTER TO MASTER_LOG_FILE='$master_file', MASTER_LOG_POS=$master_pos, MASTER_USE_GTID=NO
SET @@GLOBAL.innodb_limit_optimistic_insert_debug = @saved_innodb_limit_optimistic_insert_debug;
--source include/start_slave.inc
diff --git a/mysql-test/suite/rpl/t/semisync_future-7591.test b/mysql-test/suite/rpl/t/semisync_future-7591.test
index 866041d2579..793d8bccc18 100644
--- a/mysql-test/suite/rpl/t/semisync_future-7591.test
+++ b/mysql-test/suite/rpl/t/semisync_future-7591.test
@@ -8,7 +8,7 @@ set global rpl_semi_sync_master_enabled = ON;
--connection slave
--source include/stop_slave.inc
set global rpl_semi_sync_slave_enabled = ON;
-change master to master_log_file='master-bin.000002', master_log_pos = 320;
+change master to master_log_file='master-bin.000002', master_log_pos = 320, master_use_gtid=no;
start slave;
--let $slave_io_errno=1236
@@ -20,7 +20,8 @@ reset master;
--connection slave
--source include/stop_slave.inc
-reset slave;
+--let $master_use_gtid_option= No
+--source include/reset_slave.inc
--source include/start_slave.inc
set global rpl_semi_sync_slave_enabled = OFF;