From 9b20208a780317b1d5986aba0527706d3ceb7871 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Thu, 5 Jul 2018 11:04:44 -0300 Subject: [PATCH] Re-merged PT-242 --- bin/pt-stalk | 9 ++++++--- sandbox/slave_channels_t.sql | 15 +++++++++++++++ t/pt-stalk/pt-stalk.t | 10 ++++++---- 3 files changed, 27 insertions(+), 7 deletions(-) create mode 100644 sandbox/slave_channels_t.sql diff --git a/bin/pt-stalk b/bin/pt-stalk index a16b9a3a..e674d62c 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -1162,7 +1162,10 @@ slave_status() { local outfile=$1 local mysql_version=$2 - if [ "${mysql_version}" '<' "5.7" ]; then + local sql="SHOW SLAVE STATUS\G" + echo -e "\n$sql\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile + if [ "${mysql_version}" '>' "5.6" ]; then local sql="SHOW SLAVE STATUS\G" echo -e "\n$sql\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile @@ -1171,11 +1174,11 @@ slave_status() { echo -e "\n$sql\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile - sql="SELECT * FROM replication_connection_status\G" + sql="SELECT * FROM performance_schema.replication_connection_status\G" echo -e "\n$sql\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile - sql="SELECT * FROM replication_applier_status JOIN replication_applier_status_by_coordinator USING(channel_name)\G" + sql="SELECT * FROM performance_schema.replication_applier_status JOIN performance_schema.replication_applier_status_by_coordinator USING(channel_name)\G" echo -e "\n$sql\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile fi diff --git a/sandbox/slave_channels_t.sql b/sandbox/slave_channels_t.sql new file mode 100644 index 00000000..f0a62a45 --- /dev/null +++ b/sandbox/slave_channels_t.sql @@ -0,0 +1,15 @@ +STOP SLAVE FOR CHANNEL ''; +SET GLOBAL master_info_repository = 'TABLE'; +SET @@GLOBAL.relay_log_info_repository = 'TABLE'; +SET @@GLOBAL.ENFORCE_GTID_CONSISTENCY=ON; +SET @@GLOBAL.GTID_MODE = OFF_PERMISSIVE; +SET @@GLOBAL.GTID_MODE = ON_PERMISSIVE; +SET @@GLOBAL.GTID_MODE = ON; + +CHANGE MASTER TO master_host='127.0.0.1', master_port=2900, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'masterchan1'; + +CHANGE MASTER TO master_host='127.0.0.1', master_port=2901, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'masterchan2'; + +START SLAVE for channel 'masterchan1'; +START SLAVE for channel 'masterchan2'; + diff --git a/t/pt-stalk/pt-stalk.t b/t/pt-stalk/pt-stalk.t index 4f451f40..69fe6021 100644 --- a/t/pt-stalk/pt-stalk.t +++ b/t/pt-stalk/pt-stalk.t @@ -489,11 +489,13 @@ SKIP: { $sb->load_file('chan_master1', "sandbox/gtid_on.sql", undef, no_wait => 1); $sb->load_file('chan_master2', "sandbox/gtid_on.sql", undef, no_wait => 1); - $sb->load_file('chan_slave1', "sandbox/slave_channels.sql", undef, no_wait => 1); + $sb->load_file('chan_slave1', "sandbox/slave_channels_t.sql", undef, no_wait => 1); + my $slave_cnf = "/tmp/$slave1_port/my.sandbox.cnf"; my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox " . "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 " - . "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1"; + . "--run-time=2 --pid $pid_file --defaults-file=$slave_cnf >$log_file 2>&1"; + diag ($cmd); system($cmd); sleep 5; PerconaTest::kill_program(pid_file => $pid_file); @@ -502,9 +504,9 @@ SKIP: { like( $output, - qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/, + qr/Slave has read all relay log; waiting for more updates/, "MySQL 5.7 SLAVE STATUS" - ); + ) or diag ($output); $sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1)); }