rpl_diff_tables.inc 1.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10
# #############################################################################
# Check whether the given table is consistent between different master and
# slaves
#
# Usage: 
# --let $diff_table= test.t1 
# --let $diff_server_list= master, slave, slave2 
# --source include/rpl_diff_tables.inc
# #############################################################################

11
if (!$diff_table)
12 13 14 15 16
{
  --die diff_table is null.
}

--let $_servers= master, slave
17
if ($diff_server_list)
18 19 20 21 22 23 24
{
  --let $_servers= $diff_server_list
}

--let $_master= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
--let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_master') + 2))`
connection $_master;
25
while ($_servers)
26 27 28 29 30 31 32 33 34 35
{
  --let $_slave= `SELECT SUBSTRING_INDEX('$_servers', ',', 1)`
  --let $_servers= `SELECT LTRIM(SUBSTRING('$_servers', LENGTH('$_slave') + 2))`

  --sync_slave_with_master $_slave
  --let $diff_table_1= $_master:$diff_table
  --let $diff_table_2= $_slave:$diff_table
  --source include/diff_tables.inc
  connection $_slave;
}