| 1 |
# ==== Purpose ==== |
| 2 |
# |
| 3 |
# Verify if the binlog contents reflect what is expected to be |
| 4 |
# applied on a replica. Exports the sql statements in the binlog, |
| 5 |
# swapping the database from test to verify and import once again, |
| 6 |
# so that $table_name contents are selected. |
| 7 |
# |
| 8 |
# ==== Usage ==== |
| 9 |
# |
| 10 |
# --let $table_name= <name of table> |
| 11 |
# [--let $order_by= pk] |
| 12 |
# |
| 13 |
|
| 14 |
--let $include_filename= ndb_binlog_verify_table.inc |
| 15 |
--source include/begin_include_file.inc |
| 16 |
|
| 17 |
if (!$table_name) |
| 18 |
{ |
| 19 |
die Table name required; |
| 20 |
} |
| 21 |
if (!$order_by) |
| 22 |
{ |
| 23 |
--let $order_by= pk |
| 24 |
} |
| 25 |
|
| 26 |
--let $datadir=`select @@datadir` |
| 27 |
--let $cmd = $MYSQL_BINLOG --disable-log-bin --rewrite-db="test->verify" |
| 28 |
--let $cmd = $cmd --to-last-log --verbose $datadir/binlog.000001 |
| 29 |
#--echo $cmd |
| 30 |
--let $file_name = $MYSQLTEST_VARDIR/tmp/compare_binlog.sql |
| 31 |
--exec $cmd > $file_name |
| 32 |
|
| 33 |
--disable_query_log |
| 34 |
SET sql_log_bin=OFF; |
| 35 |
CREATE DATABASE verify; |
| 36 |
--enable_query_log |
| 37 |
|
| 38 |
--exec $MYSQL < $file_name |
| 39 |
--remove_file $file_name |
| 40 |
eval SELECT * FROM verify.$table_name ORDER BY $order_by; |
| 41 |
|
| 42 |
--disable_query_log |
| 43 |
DROP DATABASE verify; |
| 44 |
SET sql_log_bin=ON; |
| 45 |
--enable_query_log |
| 46 |
|
| 47 |
--let $table_name= |
| 48 |
--let $order_by= |
| 49 |
--source include/end_include_file.inc |