MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ndb_rpl_get_binlog_events.inc
1 #
2 # Munch the mysqlbinlog tool output into deterministic form to look at server ids
3 #
4 
5 --disable_query_log
6 let $MYSQLD_DATADIR= `select @@datadir;`;
7 --exec $MYSQL_BINLOG --verbose $MYSQLD_DATADIR/$BINLOG_FILENAME.000001 > $MYSQLTEST_VARDIR/tmp/rpl_ndb_mysqlbinlog.sql
8 set sql_log_bin=0;
9 create table raw_binlog_rows (txt varchar(1000));
10 
11 --eval load data local infile '$MYSQLTEST_VARDIR/tmp/rpl_ndb_mysqlbinlog.sql' into table raw_binlog_rows columns terminated by '\n';
12 
13 --enable_query_log
14 # Remove non-deterministic and uninteresting elements from the mysqlbinlog output
15 # Right trim of length-17 takes out the initial timestamp
16 # We are primarily interested in server id and event type
17 --replace_regex /thread_id=[0-9]*/ / /exec_time=[0-9]*/ / /end_log_pos [0-9]*/ / /table id [0-9]*/ / /error_code=[0-9]*/ / /mapped to number [0-9]*/ /
18 select replace(right(txt, length(txt)-17), '\r', '') as binlog_entries from raw_binlog_rows where txt like '%server id%' and not (txt like '%Start%' or txt like '%Rotate%');
19 
20 --disable_query_log
21 drop table raw_binlog_rows;
22 set sql_log_bin=1;
23 --enable_query_log