3 # Diff the output of a statement on all configured servers (usually
9 # --let $rpl_diff_statement= SELECT * FROM t1 WHERE a < 100
10 # [--let $rpl_diff_servers= <server1>,<server2>,...<serverN>]
11 # --source include/rpl_diff.inc
15 # Statement to check. For each compared server, this script will
16 # start a new client and pass this statement to the client.
17 # Note: This string will be evaluated as a single-quote-escaped
18 # SQL string and hence must be quoted as such. In particular, any
19 # single quotes in this string must be escaped.
22 # By default, this file compares all servers configured by
23 # rpl_init.inc. You can set $diff_servers to a comma-separated
24 # list of numbers: only the servers identified by these numbers
28 # By default, the statement will be executed on the database
29 # 'test'. If $rpl_diff_database is set, the statement will be
30 # executed on the database named $rpl_diff_database instead.
33 --let $include_filename= rpl_diff.inc
34 --source include/begin_include_file.inc
37 if (!$rpl_diff_statement)
39 --die ERROR IN TEST: you must
set $rpl_diff_statement before you source include/rpl_diff.inc
44 --source include/rpl_sync.inc
48 --let $_rpl_diff_database= $rpl_diff_database
49 if (!$_rpl_diff_database)
51 --let $_rpl_diff_database=
test
55 # Generate list of servers.
56 --let $_rpl_diff_servers= $rpl_diff_servers
57 if (!$_rpl_diff_servers)
59 --let $_rpl_server_i= $rpl_server_count
60 --let $_rpl_diff_servers=
61 while ($_rpl_server_i)
63 --let $_rpl_diff_servers= $_rpl_server_i,$_rpl_diff_servers
69 --echo \$rpl_diff_servers=
'$_rpl_diff_servers'
79 # Generate file containing $rpl_diff_statement. We don't pass the
80 # statement on the command line, because it would be subject to shell
82 --let $write_to_file= GENERATE
83 --let $write_var= $rpl_diff_statement
84 --source include/write_var_to_file.inc
85 --let $_rpl_diff_statement_file= $write_to_file
88 # Compare all servers.
89 --let $_rpl_diff_first= 1
90 while ($_rpl_diff_servers)
92 # Set $_rpl_diff_server_i to the first number in the list
93 --let $_rpl_diff_server_i= `SELECT SUBSTRING_INDEX(
'$_rpl_diff_servers',
',', 1)`
94 # Remove $_rpl_diff_server_i from the list
95 --let $_rpl_diff_servers= `SELECT SUBSTRING(
'$_rpl_diff_servers', LENGTH(
'$_rpl_diff_server_i') + 2)`
98 --let $_rpl_diff_file= $MYSQLTEST_VARDIR/tmp/_rpl_diff_server-$_rpl_diff_server_i.tmp
99 --exec $MYSQL --defaults-
group-suffix=.$_rpl_diff_server_i $_rpl_diff_database < $_rpl_diff_statement_file > $_rpl_diff_file
102 if (!$_rpl_diff_first)
106 --echo diffing $_rpl_diff_file and $_rpl_diff_prev_file
108 --diff_files $_rpl_diff_file $_rpl_diff_prev_file
109 --remove_file $_rpl_diff_prev_file
111 --let $_rpl_diff_prev_file= $_rpl_diff_file
112 --let $_rpl_diff_first= 0
114 --remove_file $_rpl_diff_prev_file
117 --let $include_filename= rpl_diff.inc
118 --source include/end_include_file.inc