summaryrefslogtreecommitdiff
path: root/mysql-test/include/show_events.inc
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/include/show_events.inc')
-rw-r--r--mysql-test/include/show_events.inc93
1 files changed, 78 insertions, 15 deletions
diff --git a/mysql-test/include/show_events.inc b/mysql-test/include/show_events.inc
index ff5a7105c24..ae2f08f65a6 100644
--- a/mysql-test/include/show_events.inc
+++ b/mysql-test/include/show_events.inc
@@ -1,7 +1,14 @@
-##############################################################################
-# It's an auxiliary file used to show binary log events or relay log events.
-# It is only called by show_binlog_events.inc and show_relaylog_events.inc.
-##############################################################################
+# ==== Purpose ====
+#
+# Auxiliary file used in include/show_binlog_events.inc and
+# include/show_relaylog_events.inc.
+#
+# ==== Usage ====
+#
+# See include/show_binlog_events.inc
+
+--let $include_filename= show_events.inc
+--source include/begin_include_file.inc
if (!$binlog_start)
{
@@ -12,27 +19,83 @@ if (!$binlog_start)
--let $binlog_start= query_get_value(SHOW BINLOG EVENTS LIMIT 1, End_log_pos, 1)
}
---let $_statement=show binlog events
+--let $_se_old_statement= $statement
+
+--let $statement=show BINLOG events
if ($is_relay_log)
{
- --let $_statement=show relaylog events
+ --let $statement=show relaylog events
}
if ($binlog_file)
{
- --let $_statement= $_statement in '$binlog_file'
+ --let $_binlog_file= $binlog_file
+ if ($binlog_file == 'LAST')
+ {
+ if ($is_relay_log)
+ {
+ --let $_binlog_file= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1)
+ }
+ if (!$is_relay_log)
+ {
+ --let $_binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
+ }
+ }
+ --let $statement= $statement in '$_binlog_file'
}
---let $_statement= $_statement from $binlog_start
+--let $statement= $statement from $binlog_start
+
+if ($binlog_limit != '')
+{
+ --let $statement= $statement limit $binlog_limit
+}
-# Cannot use if($binlog_limit) since the variable may begin with a 0
+# Execute the statement and write to $output_file
+--let $output_file= GENERATE
+--source include/write_result_to_file.inc
-if (`SELECT '$binlog_limit' <> ''`)
+# Filter the file through the following script.
+--delimiter ||
+let $script=
+ # todo: use select_columns instead (requires updating all result files)
+ s{([^\t]*\t)[^\t]*(\t[^\t]*\t)[^\t]*\t[^\t]*(\t[^\t]*)}{DOLLAR1#DOLLAR2#\t#DOLLAR3};
+ s{/\* xid=.* \*/}{/\* XID \*/};
+ s{table_id: [0-9]+}{table_id: #};
+ s{file_id=[0-9]+}{file_id=#};
+ s{block_len=[0-9]+}{block_len=#};
+ s{Server ver:.*DOLLAR}{SERVER_VERSION, BINLOG_VERSION};
+ s{SQL_LOAD-[a-z,0-9,-]*.[a-z]*}{SQL_LOAD-<SERVER UUID>-<MASTER server-id>-<file-id>.<extension>};
+ s{rand_seed1=[0-9]*,rand_seed2=[0-9]*}{rand_seed1=<seed 1>,rand_seed2=<seed 2>};
+ s{((?:master|slave|slave-relay)-bin\.[0-9]{6};pos=)[0-9]+DOLLAR}{DOLLAR1POS};
+ s{DOLLARmysqltest_vardir}{MYSQLTEST_VARDIR}g;
+||
+--let $pre_script= my DOLLARmysqltest_vardir = DOLLARENV{'MYSQLTEST_VARDIR'};
+if (!$keep_gtid_events)
{
- --let $_statement= $_statement limit $binlog_limit
+ --let $script= $script DOLLAR_ = '' if (m{\t(?:Gtid|Previous_gtids)\t});
}
+if ($keep_gtid_events)
+{
+ let $pre_script= $pre_script
+ my DOLLARuuid_regex = '[0-9A-F]{8}-(?:[0-9A-F]{4}-){3}[0-9A-F]{12}';
+ my DOLLARuuid_sidno_regex = DOLLARuuid_regex.'(?::[0-9]+(?:-[0-9]+)?)+';
+ ||
+ --let $script= $script s{DOLLARuuid_sidno_regex(?:,DOLLARuuid_sidno_regex)*}{Gtid_set};
+}
+--delimiter ;
+
+#--let $select_columns= 1 3 6
+--let $input_file= $output_file
+--source include/filter_file.inc
+
+# Write to result file
+--cat_file $output_file
+
+# Remove the file
+--remove_file $output_file
+
+--let $statement= $_se_old_statement
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR $binlog_start <binlog_start>
---replace_column 2 # 4 # 5 #
---replace_regex /\/\* xid=.* \*\//\/* XID *\// /table_id: [0-9]+/table_id: #/ /file_id=[0-9]+/file_id=#/ /block_len=[0-9]+/block_len=#/ /Server ver:.*$/SERVER_VERSION, BINLOG_VERSION/
---eval $_statement
+--let $include_filename= show_events.inc
+--source include/end_include_file.inc