/usr/lib/mysql-testsuite/include/rpl_diff.inc is in percona-server-test-5.6 5.6.22-rel71.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | # ==== Purpose ====
#
# Diff the output of a statement on all configured servers (usually
# master and slave).
#
#
# ==== Usage =====
#
# --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100
# [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>]
# --source include/rpl_diff.inc
#
# Parameters:
# $rpl_diff_statement
# Statement to check. For each compared server, this script will
# start a new client and pass this statement to the client.
# Note: This string will be evaluated as a single-quote-escaped
# SQL string and hence must be quoted as such. In particular, any
# single quotes in this string must be escaped.
#
# $rpl_diff_servers
# By default, this file compares all servers configured by
# rpl_init.inc. You can set $diff_servers to a comma-separated
# list of numbers: only the servers identified by these numbers
# will be compared.
#
# $rpl_diff_database
# By default, the statement will be executed on the database
# 'test'. If $rpl_diff_database is set, the statement will be
# executed on the database named $rpl_diff_database instead.
--let $include_filename= rpl_diff.inc
--source include/begin_include_file.inc
if (!$rpl_diff_statement)
{
--die ERROR IN TEST: you must set $rpl_diff_statement before you source include/rpl_diff.inc
}
# Sync.
--source include/rpl_sync.inc
# Get database name.
--let $_rpl_diff_database= $rpl_diff_database
if (!$_rpl_diff_database)
{
--let $_rpl_diff_database= test
}
# Generate list of servers.
--let $_rpl_diff_servers= $rpl_diff_servers
if (!$_rpl_diff_servers)
{
--let $_rpl_server_i= $rpl_server_count
--let $_rpl_diff_servers=
while ($_rpl_server_i)
{
--let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers
--dec $_rpl_server_i
}
}
if ($rpl_debug)
{
--echo \$rpl_diff_servers= '$_rpl_diff_servers'
}
if (!$rpl_debug)
{
--disable_query_log
}
# Generate file containing $rpl_diff_statement. We don't pass the
# statement on the command line, because it would be subject to shell
# substitutions.
--let $write_to_file= GENERATE
--let $write_var= $rpl_diff_statement
--source include/write_var_to_file.inc
--let $_rpl_diff_statement_file= $write_to_file
# 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 --defaults-group-suffix=.$_rpl_diff_server_i $_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
--let $include_filename= rpl_diff.inc
--source include/end_include_file.inc
|