[PT-242] Include SHOW SLAVE STATUS on 5.7 Created: 05/Jan/18  Updated: 06/Jul/18  Resolved: 13/Jun/18

Status: Done
Project: Percona Toolkit
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.11

Type: Improvement Priority: Medium
Reporter: Marcelo Altmann Assignee: Carlos Salguero
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 15 minutes
Original Estimate: Not Specified


 Description   

The output of SHOW SLAVE STATUS shouldn't be omitted on 5.7 versions



 Comments   
Comment by Marcelo Altmann [ 05/Jan/18 ]

committed PR https://github.com/percona/percona-toolkit/pull/294

Comment by Tomislav Plavcic [ 05/Jul/18 ]

Carlos Salguero Evgeniy Patlan
The fix is not included in the release build, I think most probably it's merged to "3.0" branch and release is done from "release-3.0.11" branch - just my assumption.

Comment by Tomislav Plavcic [ 05/Jul/18 ]

Seems it will have to wait for Carlos, it was reverted at some point, not sure what happened: https://github.com/percona/percona-toolkit/commit/0758e2c714f39ee1d38a9997a0e3e7253ada0637

Comment by Tomislav Plavcic [ 06/Jul/18 ]

Carlos Salguero
I don't think that the current fix is ok because currently on versions > 5.6 it doesn't execute performance_schema queries while in Marcelo Altmann fix it was doing that.
Also on versions > 5.6 it executes "SHOW SLAVE STATUS" two times in a row without any special reason.
Here's how it looks:
Fix from Marcelo:

slave_status() {
   local outfile=$1
   local mysql_version=$2

   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="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 performance_schema.replication_connection_status\G"
      echo -e "\n$sql\n" >> $outfile
      $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile

      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
}

Current state of release branch:

slave_status() {
   local outfile=$1
   local mysql_version=$2

   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
   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 performance_schema.replication_connection_status\G"
      echo -e "\n$sql\n" >> $outfile
      $CMD_MYSQL $EXT_ARGV -e "$sql" >> $outfile

      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

}
Comment by Carlos Salguero [ 06/Jul/18 ]

Fixed.

mysql -e 'select version()'
+------------+
| version()  |
+------------+
| 5.6.39-log |
+------------+

All tests successful.
Files=3, Tests=43, 58 wallclock secs ( 0.04 usr 0.01 sys + 9.17 cusr 3.70 csys = 12.92 CPU)
Result: PASS

 

mysql -e 'select version()'
+------------+
| version()  |
+------------+
| 5.7.22-log |
+------------+

All tests successful.
Files=3, Tests=45, 149 wallclock secs ( 0.03 usr 0.00 sys + 15.26 cusr 6.17 csys = 21.46 CPU)
Result: PASS

 

mysql -e 'select version()'
+-----------+
| version() |
+-----------+
| 8.0.11    |
+-----------+

All tests successful.
Files=3, Tests=45, 147 wallclock secs ( 0.02 usr 0.01 sys + 15.82 cusr 5.61 csys = 21.46 CPU)
Result: PASS

 

Comment by Tomislav Plavcic [ 06/Jul/18 ]

Looks OK now. Thanks!

Generated at Wed Nov 21 01:36:14 UTC 2018 using Jira 7.12.1#712002-sha1:609a50578ba6bc73dbf8b05dddd7c04a04b6807c.