1# ==== Purpose ==== 2# 3# Auxiliary file used in include/show_binlog_events.inc and 4# include/show_relaylog_events.inc. 5# 6# ==== Usage ==== 7# 8# See include/show_binlog_events.inc 9 10--let $include_filename= show_events.inc 11--source include/begin_include_file.inc 12 13if (!$binlog_start) 14{ 15 # If $binlog_start is not set, we will set it as the second event's 16 # position. The first event(Description Event) is always ignored. For 17 # description event's length might be changed because of adding new events, 18 # 'SHOW BINLOG EVENTS LIMIT 1' is used to get the right value. 19 --let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1) 20} 21 22--let $_se_old_statement= $statement 23 24--let $statement=show BINLOG events 25if ($is_relay_log) 26{ 27 --let $statement=show relaylog events 28} 29 30if ($binlog_file) 31{ 32 --let $_binlog_file= $binlog_file 33 if ($binlog_file == 'LAST') 34 { 35 if ($is_relay_log) 36 { 37 --let $_binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1) 38 } 39 if (!$is_relay_log) 40 { 41 --let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) 42 } 43 } 44 --let $statement= $statement in '$_binlog_file' 45} 46 47--let $statement= $statement from $binlog_start 48 49if ($binlog_limit != '') 50{ 51 --let $statement= $statement limit $binlog_limit 52} 53 54# Execute the statement and write to $output_file 55--let $output_file= GENERATE 56--source include/write_result_to_file.inc 57 58# Filter the file through the following script. 59--delimiter || 60let $script= 61 # todo: use select_columns instead (requires updating all result files) 62 s{([^\t]*\t)[^\t]*(\t[^\t]*\t)[^\t]*\t[^\t]*(\t[^\t]*)}{DOLLAR1#DOLLAR2#\t#DOLLAR3}; 63 s{/\* xid=.* \*/}{/\* XID \*/}; 64 s{table_id: [0-9]+}{table_id: #}; 65 s{file_id=[0-9]+}{file_id=#}; 66 s{block_len=[0-9]+}{block_len=#}; 67 s{Server ver:.*DOLLAR}{SERVER_VERSION, BINLOG_VERSION}; 68 s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>}; 69 s{rand_seed1=[0-9]*,rand_seed2=[0-9]*}{rand_seed1=<seed 1>,rand_seed2=<seed 2>}; 70 s{((?:master|slave|slave-relay)-bin\.[0-9]{6};pos=)[0-9]+DOLLAR}{DOLLAR1POS}; 71 s{SONAME ".*"}{SONAME "LIB"}; 72 s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g; 73|| 74--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'}; 75if (!$keep_gtid_events) 76{ 77 --let $script= $script DOLLAR_ = '' if (m{\t(?:Gtid|Previous_gtids)\t}); 78} 79if ($keep_gtid_events) 80{ 81 let $pre_script= $pre_script 82 my DOLLARuuid_regex = '[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}'; 83 my DOLLARuuid_sidno_regex = DOLLARuuid_regex.'(?::[0-9]+(?:-[0-9]+)?)+'; 84 || 85 --let $script= $script s{DOLLARuuid_sidno_regex(?:,DOLLARuuid_sidno_regex)*}{Gtid_set}; 86} 87--delimiter ; 88 89#--let $select_columns= 1 3 6 90--let $input_file= $output_file 91--source include/filter_file.inc 92 93# Write to result file 94--cat_file $output_file 95 96# Remove the file 97--remove_file $output_file 98 99--let $statement= $_se_old_statement 100 101--let $include_filename= show_events.inc 102--source include/end_include_file.inc 103