rpl_diff.inc in 5.7 does not compare data from different servers

Bug #1680510 reported by Yura Sorokin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Fix Released
Low
Yura Sorokin
5.6
Fix Released
Low
Yura Sorokin
5.7
Fix Released
Low
Yura Sorokin

Bug Description

'include/rpl_diff.inc' in 5.7 is broken.

Instead of retrieving data from different servers specified by $rpl_diff_servers or from all servers configured by 'rpl_init.inc', it always connects to the default server.

Therefore, including this file will always succeed and will never show actual data difference between servers.

Tested on 5.7.17

Tags: ci upstream
Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

Here is an excerpt from rpl_diff.inc:

*********************************************
# Compare all servers.
--let $_rpl_diff_first= 1
while ($_rpl_diff_servers)
{
  # Set $_rpl_diff_server_i to the first number in the list
  --let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX('$_rpl_diff_servers', ',', 1)`
  # Remove $_rpl_diff_server_i from the list
  --let $_rpl_diff_servers= `SELECT SUBSTRING('$_rpl_diff_servers', LENGTH('$_rpl_diff_server_i') + 2)`

  # Execute statement
  --let $_rpl_diff_file= $MYSQLTEST_VARDIR/tmp/_rpl_diff_server-$_rpl_diff_server_i.tmp
  --exec $MYSQL $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file

  # Compare
  if (!$_rpl_diff_first)
  {
    if ($rpl_debug)
    {
      --echo diffing $_rpl_diff_file and $_rpl_diff_prev_file
    }
    --diff_files $_rpl_diff_file $_rpl_diff_prev_file
    --remove_file $_rpl_diff_prev_file
  }
  --let $_rpl_diff_prev_file= $_rpl_diff_file
  --let $_rpl_diff_first= 0
}
--remove_file $_rpl_diff_prev_file
*********************************************

Although the script properly iterates over servers, it always executes $MYSQL with default connection parameters
--exec $MYSQL $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file

Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

This is an upstream bug introduced in commit 61e2172 "BUG#20136704 --SLAVE-PRESERVE-COMMIT-ORDER CAUSES SLAVE TO DEADLOCK AND BREAK FOR SOME QUERIE"

https://github.com/mysql/mysql-server/commit/61e2172a1885172aec9814fa7ece5a3176547634

tags: added: upstream
Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

Suggested fix:

Change
--exec $MYSQL $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file

back to
--exec $MYSQL --defaults-group-suffix=.$_rpl_diff_server_i $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file

in 'include/rpl_diff.inc'

Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

This is a 5.7-only bug. Both 5.5. and 5.6 have proper '--defaults-group-suffix=.$_rpl_diff_server_i' argument.

Revision history for this message
Yura Sorokin (yura-sorokin) wrote :

This include also does not remove generated $_rpl_diff_statement_file file at the end.

tags: added: ci
Revision history for this message
Yura Sorokin (yura-sorokin) wrote :
Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2257

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.