3 # Auxiliary file used by suite/rpl/t/rpl_test_framework.test
5 # The purpose is to check that the sync chain generated in
6 # rpl_change_topology.inc (invoked from rpl_init.inc) is correct. This
8 # (1) Print the sync chain.
9 # (2) Execute a statement and verify that it replicates to all slaves.
12 # ==== Implementation ====
15 # (1) Set up a given replication topology (rpl_init.inc)
16 # (2) Print $rpl_sync_chain
17 # (3) Execute "DELETE FROM t1" and then "INSERT INTO t1" on the master
18 # (4) Sync and compare all servers.
19 # (5) Clean up the replication topology (rpl_end.inc)
21 # (Technical detail: Since DELETE FROM t1 is not executed at the end,
22 # some servers may have rows left in t1 from a previous invocation of
23 # rpl_test_framework.inc. Therefore, this file will only work in
24 # statement mode where "DELETE FROM t1" removes rows that exist on
25 # slave but not on master.)
30 # --let $rpl_server_count= <number>
31 # --let $rpl_topology= <topology specification>
32 # --let $masters= <list of masters>
33 # [--let $rpl_diff_servers= <list of servers>]
34 # --source extra/rpl_tests/rpl_test_framework.inc
38 # The INSERT statement will insert $next_number into t1, and
39 # $next_number will increase by 1.
41 # $rpl_server_count, $rpl_topology:
42 # See include/rpl_init.inc
45 # This should be a list of numbers, each identifying a server.
46 # The DELETE and INSERT statements will be executed on all servers
50 # See include/rpl_diff.inc
52 --source include/rpl_init.inc
53 --source include/rpl_generate_sync_chain.inc
54 --echo rpl_sync_chain=
'$rpl_sync_chain'
58 # Iterate over masters
61 --let $master_i= `SELECT SUBSTRING_INDEX(
'$masters',
',', 1)`
62 --let $masters= `SELECT SUBSTRING(
'$masters', LENGTH(
'$master_i') + 2)`
64 # Connect to master and execute statement
65 --let $rpl_connection_name= server_$master_i
66 --source include/rpl_connection.inc
68 --eval INSERT INTO t1 VALUES ($next_number)
71 --source include/rpl_sync.inc
73 # Compare all servers.
74 --let $diff_tables= server_$rpl_server_count:t1
75 --let $server_i= $rpl_server_count
79 --let $diff_tables= server_$server_i:t1,$diff_tables
82 --source include/diff_tables.inc
86 --source include/rpl_end.inc