From 7a8aadd8915bfa5f10e460fa1eb7041c7f03844e Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Thu, 23 Feb 2017 15:10:58 -0300 Subject: [PATCH 1/6] PT-80 Added support for slave status in pt-stalk --- bin/pt-stalk | 34 ++++++++++++++++++++++++++++++ sandbox/servers/5.7/my.sandbox.cnf | 2 ++ 2 files changed, 36 insertions(+) diff --git a/bin/pt-stalk b/bin/pt-stalk index c0b07dc8..a04ff926 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -832,6 +832,8 @@ collect() { log "Could not find the MySQL error log" fi + slave_status "$d/$p-slave-status" $mysql_version + if [ "${mysql_version}" '>' "5.1" ]; then local mutex="SHOW ENGINE INNODB MUTEX" else @@ -1062,6 +1064,38 @@ tokudb_status() { >> "$d/$p-tokudbstatus$n" || rm -f "$d/$p-tokudbstatus$n" } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + innodb_status() { local n=$1 diff --git a/sandbox/servers/5.7/my.sandbox.cnf b/sandbox/servers/5.7/my.sandbox.cnf index 44796ef2..6e19be1b 100644 --- a/sandbox/servers/5.7/my.sandbox.cnf +++ b/sandbox/servers/5.7/my.sandbox.cnf @@ -30,3 +30,5 @@ lower_case_table_names = 0 # fkc test binlog_format = STATEMENT + +performance_schema=ON From 573ee2c63e34d371b254763cb39f4a896929a8a8 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 25 Feb 2017 10:52:42 -0300 Subject: [PATCH 2/6] PT-80 Moved function to the collect module --- bin/pt-stalk | 42 +++++++++++++++++++++--------------------- lib/bash/collect.sh | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 21 deletions(-) diff --git a/bin/pt-stalk b/bin/pt-stalk index a04ff926..9ae96bf3 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -1064,6 +1064,27 @@ tokudb_status() { >> "$d/$p-tokudbstatus$n" || rm -f "$d/$p-tokudbstatus$n" } +innodb_status() { + local n=$1 + + local innostat="" + + $CMD_MYSQL $EXT_ARGV -e "SHOW /*!40100 ENGINE*/ INNODB STATUS\G" \ + >> "$d/$p-innodbstatus$n" + grep "END OF INNODB" "$d/$p-innodbstatus$n" >/dev/null || { + if [ -d /proc -a -d /proc/$mysqld_pid ]; then + for fd in /proc/$mysqld_pid/fd/*; do + file $fd | grep deleted >/dev/null && { + grep 'INNODB' $fd >/dev/null && { + cat $fd > "$d/$p-innodbstatus$n" + break + } + } + done + fi + } +} + slave_status() { local outfile=$1 local mysql_version=$2 @@ -1096,27 +1117,6 @@ slave_status() { } -innodb_status() { - local n=$1 - - local innostat="" - - $CMD_MYSQL $EXT_ARGV -e "SHOW /*!40100 ENGINE*/ INNODB STATUS\G" \ - >> "$d/$p-innodbstatus$n" - grep "END OF INNODB" "$d/$p-innodbstatus$n" >/dev/null || { - if [ -d /proc -a -d /proc/$mysqld_pid ]; then - for fd in /proc/$mysqld_pid/fd/*; do - file $fd | grep deleted >/dev/null && { - grep 'INNODB' $fd >/dev/null && { - cat $fd > "$d/$p-innodbstatus$n" - break - } - } - done - fi - } -} - # ########################################################################### # End collect package # ########################################################################### diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index 85b9c141..c17c9ad3 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -102,6 +102,8 @@ collect() { log "Could not find the MySQL error log" fi + slave_status "$d/$p-slave-status" $mysql_version + # Get a sample of these right away, so we can get these without interaction # with the other commands we're about to run. if [ "${mysql_version}" '>' "5.1" ]; then @@ -389,6 +391,38 @@ innodb_status() { } } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + # ########################################################################### # End collect package # ########################################################################### From 6874bd8459930514e18470adbc0d164f1cecaef0 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Mon, 27 Feb 2017 15:11:22 -0300 Subject: [PATCH 3/6] PT-81 Small cosmetic change in 2 queries --- lib/bash/collect.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index c17c9ad3..8747ce8b 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -408,12 +408,14 @@ slave_status() { echo -e "\n$status\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile - local status="SELECT * + local status=" + SELECT * FROM replication_connection_status\G" echo -e "\n$status\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile - local status="SELECT * + local status=" + SELECT * FROM replication_applier_status JOIN replication_applier_status_by_coordinator USING (channel_name)\G" From 4cb9627de82cc9cf0b9031e74514be7cc5ef1f8e Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Mon, 27 Feb 2017 16:39:46 -0300 Subject: [PATCH 4/6] PT-81 Updated binary to the latest collect.sh --- bin/pt-stalk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/pt-stalk b/bin/pt-stalk index 9ae96bf3..86e0f0e6 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -1102,12 +1102,14 @@ slave_status() { echo -e "\n$status\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile - local status="SELECT * + local status=" + SELECT * FROM replication_connection_status\G" echo -e "\n$status\n" >> $outfile $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile - local status="SELECT * + local status=" + SELECT * FROM replication_applier_status JOIN replication_applier_status_by_coordinator USING (channel_name)\G" From 41775e5f5011144fd8170cd2af32b74646473488 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Wed, 22 Mar 2017 12:05:33 -0300 Subject: [PATCH 5/6] PT-80 WIP --- bin/pt-stalk | 42 +++++++++++++++++++++++++++++++++++++++++- lib/bash/collect.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/bin/pt-stalk b/bin/pt-stalk index 86e0f0e6..e9a4dfd7 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -832,7 +832,6 @@ collect() { log "Could not find the MySQL error log" fi - slave_status "$d/$p-slave-status" $mysql_version if [ "${mysql_version}" '>' "5.1" ]; then local mutex="SHOW ENGINE INNODB MUTEX" @@ -948,6 +947,15 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi +<<<<<<< Updated upstream +======= + if [ $ps_instrumentation_enabled == "yes" ]; then + ps_locks_transactions "$d/$p-ps-locks-transactions" + fi + + slave_status "$d/$p-slave-status" $mysql_version + +>>>>>>> Stashed changes curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -1119,6 +1127,38 @@ slave_status() { } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status="SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + # ########################################################################### # End collect package # ########################################################################### diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index 8747ce8b..8f4acb17 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -242,6 +242,12 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi + if [ $ps_instrumentation_enabled == "yes" ]; then + ps_locks_transactions "$d/$p-ps-locks-transactions" + fi + + slave_status "$d/$p-slave-status" $mysql_version + curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -425,6 +431,40 @@ slave_status() { } +slave_status() { + local outfile=$1 + local mysql_version=$2 + + if [ "${mysql_version}" '<' "5.7" ]; then + echo "MySQL < 5.7 detected" + local status="SHOW SLAVE STATUS\G" + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + else + local status=" + SELECT * + FROM performance_schema.replication_connection_configuration + JOIN performance_schema.replication_applier_configuration + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status=" + SELECT * + FROM replication_connection_status\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + + local status=" + SELECT * + FROM replication_applier_status + JOIN replication_applier_status_by_coordinator + USING (channel_name)\G" + echo -e "\n$status\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$status" >> $outfile + fi + +} + # ########################################################################### # End collect package # ########################################################################### From be971eeee55566ef9c9103cadeb1e2fb2fc8339f Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Mon, 27 Mar 2017 17:30:06 -0300 Subject: [PATCH 6/6] PT-80 Collect replication slave information --- bin/pt-stalk | 33 +++++++++++++++++++++++++--- lib/Sandbox.pm | 11 ++++++---- lib/bash/collect.sh | 27 ++++++++++++++++++++++- sandbox/gtid_on.sql | 7 ++++++ sandbox/slave_channels.sql | 15 +++++++++++++ sandbox/start-sandbox | 2 +- sandbox/test-env | 21 ++++++++++++++---- t/pt-stalk/pt-stalk.t | 45 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 148 insertions(+), 13 deletions(-) create mode 100644 sandbox/gtid_on.sql create mode 100644 sandbox/slave_channels.sql diff --git a/bin/pt-stalk b/bin/pt-stalk index d5ecd3cf..1281e8d2 100755 --- a/bin/pt-stalk +++ b/bin/pt-stalk @@ -907,9 +907,10 @@ collect() { log "Loop start: $(date +'TS %s.%N %F %T')" local start_time=$(date +'%s') local curr_time=$start_time - local ps_instrumentation_enabled=$($CMD_MYSQL $EXT_ARGV -e "SELECT ENABLED FROM performance_schema.setup_instruments WHERE NAME = 'transaction';" | sed '2q;d' | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') + local ps_instrumentation_enabled=$($CMD_MYSQL $EXT_ARGV -e 'SELECT ENABLED FROM performance_schema.setup_instruments WHERE NAME = "transaction";' \ + | sed "2q;d" | sed 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/') - if [ $ps_instrumentation_enabled != "yes" ]; then + if [ $ps_instrumentation_enabled != "yes"]; then log "Performance Schema instrumentation is disabled" fi @@ -955,10 +956,13 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi + echo "$ps_instrumentation_enabled" > /tmp/k1 if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes" ]; then ps_locks_transactions "$d/$p-ps-locks-transactions" fi + slave_status "$d/$p-slave-status" "${mysql_version}" + curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -1099,7 +1103,7 @@ innodb_status() { ps_locks_transactions() { local outfile=$1 - mysql -e 'select @@performance_schema' | grep "1" &>/dev/null + $CMD_MYSQL $EXT_ARGV -e 'select @@performance_schema' | grep "1" &>/dev/null if [ $? -eq 0 ]; then local status="select t.processlist_id, ml.* from performance_schema.metadata_locks ml join performance_schema.threads t on (ml.owner_thread_id=t.thread_id)\G" @@ -1123,6 +1127,29 @@ ps_locks_transactions() { } +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 + else + local sql="SELECT * FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING(channel_name)\G" + echo -e "\n$sql\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile + + sql="SELECT * FROM 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" + echo -e "\n$sql\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile + fi +} + # ########################################################################### # End collect package # ########################################################################### diff --git a/lib/Sandbox.pm b/lib/Sandbox.pm index 8178a585..10beafc0 100644 --- a/lib/Sandbox.pm +++ b/lib/Sandbox.pm @@ -64,12 +64,15 @@ my %port_for = ( cslave1 => 12348, # cluster -> slave host1 => 12345, # pt-upgrade host2 => 12348, # pt-upgrade + chan_master1 => 2900, + chan_master2 => 2901, + chan_slave1 => 2902, ); my %server_type = ( - master => 1, - slave => 1, - node => 1, + master => 1, + slave => 1, + node => 1, ); my $test_dbs = qr/^(?:mysql|information_schema|sakila|performance_schema|percona_test|sys)$/; @@ -494,7 +497,7 @@ sub start_sandbox { my $first_node = $args{first_node} ? $port_for{$args{first_node}} : ''; my $out = `$env $trunk/sandbox/start-sandbox cluster $port $first_node`; die $out if $CHILD_ERROR; - } + } my $dbh = $self->get_dbh_for($server, $args{cxn_opts}); my $dsn = $self->dsn_for($server); diff --git a/lib/bash/collect.sh b/lib/bash/collect.sh index a21e6a62..d037c888 100644 --- a/lib/bash/collect.sh +++ b/lib/bash/collect.sh @@ -248,10 +248,12 @@ collect() { (echo $ts; transactions) >>"$d/$p-transactions" & fi - if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes"]; then + if [ "${mysql_version}" '>' "5.6" ] && [ $ps_instrumentation_enabled == "yes" ]; then ps_locks_transactions "$d/$p-ps-locks-transactions" fi + slave_status "$d/$p-slave-status" "${mysql_version}" + curr_time=$(date +'%s') done log "Loop end: $(date +'TS %s.%N %F %T')" @@ -428,6 +430,29 @@ ps_locks_transactions() { } +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 + else + local sql="SELECT * FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING(channel_name)\G" + echo -e "\n$sql\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile + + sql="SELECT * FROM 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" + echo -e "\n$sql\n" >> $outfile + $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile + fi +} + # ########################################################################### # End collect package # ########################################################################### diff --git a/sandbox/gtid_on.sql b/sandbox/gtid_on.sql new file mode 100644 index 00000000..1de63bc2 --- /dev/null +++ b/sandbox/gtid_on.sql @@ -0,0 +1,7 @@ +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; + diff --git a/sandbox/slave_channels.sql b/sandbox/slave_channels.sql new file mode 100644 index 00000000..e65494a9 --- /dev/null +++ b/sandbox/slave_channels.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=12345, master_user='msandbox', master_password='msandbox', master_auto_position=1 FOR CHANNEL 'masterchan1'; + +CHANGE MASTER TO master_host='127.0.0.1', master_port=12346, 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/sandbox/start-sandbox b/sandbox/start-sandbox index 0a69b00c..393c4cc0 100755 --- a/sandbox/start-sandbox +++ b/sandbox/start-sandbox @@ -186,7 +186,7 @@ type=$1 # master, slave or master-master port=$2 # sandbox port number, e.g. 12345 master_port=$3 # master port if slave or master-master -if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ] && [ "$type" != "cluster" ]; then +if [ "$type" != "master" ] && [ "$type" != "slave" ] && [ "$type" != "master-master" ] && [ "$type" != "cluster" ] && [ "$type" != "channels" ]; then die "Invalid sandbox type: $type. Valid types are master, slave, and master-master." fi diff --git a/sandbox/test-env b/sandbox/test-env index 22e6f119..1ee1efff 100755 --- a/sandbox/test-env +++ b/sandbox/test-env @@ -293,10 +293,23 @@ case $opt in exit_status=$((exit_status | $?)) set_mysql_version if [ $exit_status -eq 0 ]; then - ./start-sandbox "${2:-"slave"}" 12346 12345 - exit_status=$((exit_status | $?)) - ./start-sandbox "${2:-"slave"}" 12347 12346 - exit_status=$((exit_status | $?)) + if [ "${2:-""}" = "channels" ] && [ "$MYSQL_VERSION" '>' "5.6" ]; then + ./start-sandbox master 12346 + exit_status=$((exit_status | $?)) + ./start-sandbox master 12347 + exit_status=$((exit_status | $?)) + /tmp/12345/use < $PERCONA_TOOLKIT_BRANCH/sandbox/gtid_on.sql + exit_status=$? + /tmp/12346/use < $PERCONA_TOOLKIT_BRANCH/sandbox/gtid_on.sql + exit_status=$? + /tmp/12347/use < $PERCONA_TOOLKIT_BRANCH/sandbox/slave_channels.sql + exit_status=$? + else + ./start-sandbox "${2:-"slave"}" 12346 12345 + exit_status=$((exit_status | $?)) + ./start-sandbox "${2:-"slave"}" 12347 12346 + exit_status=$((exit_status | $?)) + fi if [ "${2:-""}" = "cluster" ]; then # Bit of magic here. 'start-sandbox cluster new_node old_node' diff --git a/t/pt-stalk/pt-stalk.t b/t/pt-stalk/pt-stalk.t index 32d6c203..846f5385 100644 --- a/t/pt-stalk/pt-stalk.t +++ b/t/pt-stalk/pt-stalk.t @@ -453,6 +453,7 @@ SKIP: { PerconaTest::kill_program(pid_file => $pid_file); $output = `cat $dest/*-ps-locks-transactions 2>/dev/null`; + like( $output, qr/ STATE: ACTIVE/, @@ -466,6 +467,50 @@ SKIP: { ); } +cleanup(); + +my ($master1_dbh, $master1_dsn) = $sb->start_sandbox( + server => 'chan_master1', + type => 'master', +); +my ($master2_dbh, $master2_dsn) = $sb->start_sandbox( + server => 'chan_master2', + type => 'master', +); +my ($slave1_dbh, $slave1_dsn) = $sb->start_sandbox( + server => 'chan_slave1', + type => 'master', +); +my $slave1_port = $sb->port_for('chan_slave1'); + +$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); + +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"; +system($cmd); +sleep 5; +PerconaTest::kill_program(pid_file => $pid_file); + +$output = `cat $dest/*-slave-status 2>/dev/null`; + +if ( $sandbox_version lt '5.7' ) { + like( + $output, + qr/SHOW SLAVE STATUS/, + "MySQL 5.6 SLAVE STATUS" + ); +} else { + like( + $output, + qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/, + "MySQL 5.7 SLAVE STATUS" + ); +} + +$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1)); # ############################################################################# # Done. # #############################################################################