mariadb/mysql-test/suite/binlog/r
Brandon Nesterenko 79e3ee00fa MDEV-4989: Support for GTID in mysqlbinlog
New Feature:
===========
This commit extends the mariadb-binlog capabilities to allow events
to be filtered by GTID ranges. More specifically, the
--start-position and --stop-position arguments have been extended to
accept values formatted as a list of GTID positions, e.g.
--start-position=0-1-0,1-2-55. The following specific capabilities
are addressed:
   1) GTIDs can be used to filter results on local binlog files
   2) GTIDs can be used to filter results from remote servers
   3) Implemented --gtid-strict-mode that ensures the GTID event
      stream in each domain is monotonically increasing
   4) Added new level of verbosity in mysqlbinlog -vvv to print
      additional diagnostic information/warnings about invalid GTID
      states
   5) For a given GTID range, its start and stop position parameters
      aim to mimic the behaviors of
      CHANGE MASTER TO MASTER_USE_GTID=slave_pos and
      START SLAVE UNTIL master_gtid_pos=<GTID>, respectively. In
      particular, the start-position list expresses a gtid state of
      the server, similarly to how @@global.gtid_slave_pos expresses
      the gtid state of a slave server when connecting to a master
      with MASTER_USE_GTID=slave_pos.
      The GTID start-position list is exclusive and the
      stop-position list is inclusive. This allows users to receive
      events strictly after those that they already have, and is
      useful in  cases of point in (logical) time recovery including
      1) events were received out of order and should be re-sent, or
      2) specifying the gtid state of a slave to get events newer
      than their current state. If a seq_no is 0 for start-position,
      it means to include the entirety of the domain. If a seq_no is
      0 for stop-position, it means to exclude all events from that
      domain. The GTIDs provided in a start position argument must
      match with the GTID state of the first processed log (i.e.
      those listed in the Gtid_list event). If a stop position is
      provided, the events that are output are limited to only those
      with domain ids listed in the argument. When specifying
      combinations of start and stop positions, the following
      behaviors are expected:

[--start-position without --stop-position]: Events that have domain
ids in the start position are output if their seq_no occurs after
the respective start position. Events with domain ids that are
unspecified in the start position list are also output. Note that if
the Gtid_list event of the first binary log is populated (i.e.
non-empty), each domain in the Gtid_list must be present in the
start-position list with a seq_no at or after the listed value.
This behavior mimics how a slave only processes events after the
state provided by @@global.gtid_slave_pos when connecting to a
master with CHANGE MASTER TO MASTER_USE_GTID=slave_pos.

[--stop-position without --start-position]: Output is limited to
only events with both 1) domain ids that are present in the given
stop position list and 2) seq_nos that are less than or equal to
their respective stop GTID. Once all GTIDs in the stop position
list have been processed, the program will stop processing log
files. This behavior mimics how
START SLAVE UNTIL master_gtid_pos=<G>
has a slave only process events with domain ids present in G with
their seq_nos at or before the respective gtid.

[--start-position and --stop-position]: Output consists of the
intersection between the events permitted by both the start and stop
position rules. More concretely, the output can be defined by a
union of the following rules:

  1. For domains which exist in both the start and stop position
     lists, the events which exist in-between these positions
     (exclusive start, inclusive stop) are output
  2. For all other events, the rules of
     [--stop-position without --start-position] are followed

This is due to the implicit filtering within each individual rule.
Even though the start position rule always includes events from
unspecified domains, the stop position rule takes precedence because
it always excludes events from unspecified domains. In other words,
events which the start position rule would have included would then
always be excluded by the stop position rule.

[neither --start-position nor --stop-position]: Events are not
omitted based on GTID positioning; however, --gtid-strict-mode and
-vvv can still analyze gtid correctness for warning and error
reporting.

[repeated specification of --start-position or --stop-position]:
Subsequent specifications of start and stop positions completely
override previous ones. E.g., if invoked as
mysqlbinlog --start-position=<G1> --start-position=<G2> ...
All GTIDs specified in G1 are ignored and only those specified in G2
are used for the start position.

A few additional notes:
 1) this commit squashes together the commits:
f4319661120e-78a9d49907ba

 2) Changed rpl.rpl_blackhole_row_annotate test because it has
out of order GTIDs in its binlog, so I added
--skip-gtid-strict-mode

 3) After all binlog events have been written, the session server
    id and domain id are reset to their values in the global state

Reviewed By:
===========
Andrei Elkin: <andrei.elkin@mariadb.com>
2022-01-26 14:17:21 -07:00
..
backup.result Fix that BACKUP STAGE BLOCK_COMMIT flushes binary log 2019-11-01 10:22:30 +02:00
binlog_1pc.result MDEV-26031 unnessary xid logging in one phase commit case 2021-06-29 14:13:37 +03:00
binlog_admin_cmd_kill.result MDEV-22530: Aborting OPTIMIZE TABLE still logs in binary log and replicates to the Slave server. 2021-05-19 14:21:49 +05:30
binlog_base64_flag.result MDEV-21851: Error in BINLOG_BASE64_EVENT i s always error-logged as if it is done by Slave 2020-06-12 11:25:27 +03:00
binlog_bug23533.result MDEV-17812 Use MariaDB in error messages instead of MySQL 2020-04-08 06:09:42 +00:00
binlog_bug36391.result
binlog_checkpoint.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_checkpoint_flush_logs.result Merge 10.3 into 10.4 2021-04-22 07:51:33 +03:00
binlog_checksum.result Merge 10.0-base -> 10.0 (GTID). 2013-04-17 15:17:01 +02:00
binlog_commit_wait.result MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
binlog_database.result MDEV-9077 Use sys schema in bootstrapping, incl. mtr 2021-03-18 08:02:48 +01:00
binlog_delete_and_flush_index.result Merge 10.0-base -> 10.0 (GTID). 2013-04-17 15:17:01 +02:00
binlog_dmls_on_tmp_tables_readonly.result Merge branch '10.0' into 10.1 2016-08-25 12:40:09 +02:00
binlog_drop_if_exists.result Make error messages from DROP TABLE and DROP TABLE IF EXISTS consistent 2020-06-14 19:39:42 +03:00
binlog_empty_xa_prepared.result MDEV-22757 Assertion !binlog || exist_hton_without_prepare' failed in MYSQL_BIN_LOG::unlog_xa_prepare 2021-04-19 20:34:17 +03:00
binlog_expire_logs_seconds.result MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs 2021-05-17 12:48:37 +05:30
binlog_expire_warnings.result MDEV-19371: Implement binlog_expire_logs_seconds for purging of binary logs 2021-05-10 09:36:40 +05:30
binlog_flush_binlogs_delete_domain.result MDEV-14431 binlog.binlog_flush_binlogs_delete_domain failed in buildbot 2018-10-16 12:42:57 +03:00
binlog_format_switch_in_tmp_table.result
binlog_grant.result MDEV-21975: Fix the result 2020-03-19 05:43:57 +02:00
binlog_gtid_delete_domain_debug.result never add new error messages to old GA releases! 2017-11-19 14:43:17 +01:00
binlog_implicit_commit.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_incident.result
binlog_index.result MDEV-22189: Change error messages inside code to have mariadb instead of 2021-05-24 11:38:13 +05:30
binlog_innodb.result MDEV-11937: InnoDB flushes redo log too often 2017-08-07 18:23:55 +02:00
binlog_innodb_row.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_innodb_stm.result MDEV-18466 Unsafe to log updates on tables referenced by foreign keys with triggers in statement format 2019-03-27 22:51:37 +01:00
binlog_invalid_read_in_rotate.result After-merge fix: Actually apply the changes 2020-01-08 17:09:31 +05:30
binlog_ioerr.result MDEV-21360 global debug_dbug pre-test value restoration issues 2020-01-15 18:06:24 +01:00
binlog_killed.result MDEV-14822 binlog.binlog_killed fails with wrong result 2018-01-10 14:41:10 +02:00
binlog_killed_simulate.result cleanup: binlog.binlog_killed_simulate 2016-12-29 13:23:42 +01:00
binlog_max_binlog_stmt_cache_size.result Mdev-4774- Fix tests cases 2017-01-31 10:12:22 +05:30
binlog_max_extension.result
binlog_mdev342.result MDEV-515 Reduce InnoDB undo logging for insert into empty table 2021-01-25 18:41:27 +02:00
binlog_mdev717.result Merge branch '10.1' into 10.2 2019-05-04 17:04:55 +02:00
binlog_mixed.result BINLOG with LOCK TABLES and SAVEPOINT could cause a crash in debug bin 2020-06-14 19:39:43 +03:00
binlog_mixed_cache_stat.result Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
binlog_mixed_load_data.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_mysqlbinlog-cp932.result BUG#14659685 - main.mysqlbinlog_row_myisam and 2012-10-30 10:40:07 +05:30
binlog_mysqlbinlog2.result Merge 10.4 into 10.5 2020-08-01 14:42:51 +03:00
binlog_mysqlbinlog_base64.result BUG#14659685 - main.mysqlbinlog_row_myisam and 2012-10-30 10:40:07 +05:30
binlog_mysqlbinlog_gtid_strict_mode.result MDEV-4989: Support for GTID in mysqlbinlog 2022-01-26 14:17:21 -07:00
binlog_mysqlbinlog_gtid_window.result MDEV-4989: Support for GTID in mysqlbinlog 2022-01-26 14:17:21 -07:00
binlog_mysqlbinlog_row.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_mysqlbinlog_row_frag.result Merge 10.3 into 10.4 2020-05-19 21:18:15 +03:00
binlog_mysqlbinlog_row_innodb.result MDEV-4750 follow-up: Reduce disabling innodb_stats_persistent 2021-08-31 13:55:02 +03:00
binlog_mysqlbinlog_row_myisam.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_mysqlbinlog_row_trans.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_mysqlbinlog_stop_never.result MDEV-11154: Write_on_release_cache(log_event.cc) function will not write "COMMIT", if use "mysqlbinlog ... | mysql ..." 2019-07-15 13:30:10 +05:30
binlog_mysqlbinlog_suppress_O_TMPFILE.result MDEV-23846: O_TMPFILE error in mysqlbinlog stream output breaks restore 2020-11-23 12:16:45 +05:30
binlog_no_uniqfile_crash.result MDEV-22451: SIGSEGV in __memmove_avx_unaligned_erms/memcpy from _my_b_write on CREATE after RESET MASTER 2020-05-20 21:15:43 +05:30
binlog_old_versions.result MDEV-34 delete storage/ndb and sql/*ndb* (and collateral changes) 2014-10-11 18:53:06 +02:00
binlog_parallel_replication_marks_row.result MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE 2020-07-22 11:34:50 +05:30
binlog_parallel_replication_marks_stm_mix.result MDEV-23108: Point in time recovery of binary log fails when sql_mode=ORACLE 2020-07-22 11:34:50 +05:30
binlog_query_filter_rules.result
binlog_recover_checksum_error.result Merge 10.3 into 10.4 2020-10-22 13:27:18 +03:00
binlog_rotate_perf.result MDEV-19117 Don't keep binary log index file locked during show binary logs 2019-04-01 19:47:24 +03:00
binlog_row_annotate.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_row_binlog.result Merge branch '10.5' into 10.6 2021-08-02 10:11:41 +02:00
binlog_row_cache_stat.result Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
binlog_row_ctype_cp932.result MDEV-7635: Update tests to adapt to the new default sql_mode 2017-02-10 06:30:42 -05:00
binlog_row_ctype_ucs.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_row_drop_tbl.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_row_drop_tmp_tbl.result Merge 10.1 into 10.2 2019-08-28 15:23:21 +03:00
binlog_row_insert_select.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_row_mix_innodb_myisam.result Merge 10.1 into 10.2 2019-07-25 12:14:27 +03:00
binlog_row_mysqlbinlog_db_filter.result
binlog_row_mysqlbinlog_options.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_row_mysqlbinlog_verbose.result BUG#14548159: NUMEROUS CASES OF INCORRECT IDENTIFIER 2012-09-22 17:50:51 +05:30
binlog_server_id.result Merge 10.0-base -> 10.0 (GTID). 2013-04-17 15:17:01 +02:00
binlog_sf.result
binlog_show_binlog_event_random_pos.result MDEV-21839: Handle crazy offset to SHOW BINLOG EVENTS 2020-09-16 14:03:32 +05:30
binlog_spurious_ddl_errors.result MDEV-22008 rpl.rpl_semi_sync fails in bb, MDEV-24418 reenable binlog_truncate_innodb and binlog_spurious_ddl_errors, rpl_parallel_retry fails in bb 2020-12-18 19:31:51 +01:00
binlog_sql_mode.result MDEV-19265 Server should throw warning if event is created and event_scheduler = OFF 2019-04-28 12:49:59 +02:00
binlog_start_comment.result
binlog_statement_insert_delayed.result MDEV-25363 binlog_stm_datetime_ranges_mdev15289 failed in bb 2021-04-14 09:15:41 +02:00
binlog_stm_binlog.result Merge branch '10.5' into 10.6 2021-08-02 10:11:41 +02:00
binlog_stm_blackhole.result MDEV-7317: Make an index ignorable to the optimizer 2021-03-04 22:50:00 +05:30
binlog_stm_cache_stat.result Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
binlog_stm_ctype_cp932.result MDEV-7635: Update tests to adapt to the new default sql_mode 2017-02-10 06:30:42 -05:00
binlog_stm_ctype_ucs.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
binlog_stm_datetime_ranges_mdev15289.result MDEV-15289 Binding an out-of-range DATETIME value in binary protocol breaks replication 2018-02-16 13:44:24 +04:00
binlog_stm_do_db.result Merge 10.0-base -> 10.0 (GTID). 2013-04-17 15:17:01 +02:00
binlog_stm_drop_tbl.result MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
binlog_stm_drop_tmp_tbl.result Merge 10.1 into 10.2 2019-08-28 15:23:21 +03:00
binlog_stm_insert_select.result Merge 10.0-base -> 10.0 (GTID). 2013-04-17 15:17:01 +02:00
binlog_stm_mix_innodb_myisam.result Remove end . from error messages to get them consistent 2016-10-05 01:11:08 +03:00
binlog_stm_ps.result MDEV-14467 Item_param: replace {INT|DECIMAL|REAL|STRING|TIME}_VALUE with Type_handler 2017-11-29 10:03:51 +04:00
binlog_stm_row.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_stm_sp.result MDEV-16020 SP variables inside GROUP BY..WITH ROLLUP break replication 2018-04-27 22:11:18 +04:00
binlog_stm_sp_type_row.result MDEV-12291 Allow ROW variables as SELECT INTO targets 2017-04-05 15:03:00 +04:00
binlog_stm_unsafe_warning.result Remove end . from error messages to get them consistent 2016-10-05 01:11:08 +03:00
binlog_stm_user_variables.result MDEV-7635: Update tests to adapt to the new default sql_mode 2017-02-10 06:30:42 -05:00
binlog_switch_inside_trans.result Bug #15868071 USING SET GLOBAL SQL_LOG_BIN SHOULD NOT BE ALLOWED 2014-09-24 09:44:48 +08:00
binlog_table_map_optional_metadata.result MDEV-8334: Rename utf8 to utf8mb3 2021-05-19 06:48:36 +02:00
binlog_table_map_optional_metadata_binary.result MDEV-20477 Merge binlog extended metadata support from the upstream 2019-09-11 15:09:35 +05:30
binlog_table_map_optional_metadata_ucs2.result MDEV-20477 Merge binlog extended metadata support from the upstream 2019-09-11 15:09:35 +05:30
binlog_table_map_optional_metadata_utf32.result MDEV-20477 Merge binlog extended metadata support from the upstream 2019-09-11 15:09:35 +05:30
binlog_tmp_table.result MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
binlog_tmp_table_row.result MDEV-9266 Creating index on temporaray table breaks replication 2018-07-18 17:13:24 +05:30
binlog_trigger.result Ensure that one can drop a trigger with an orphan .TRN file 2021-05-19 22:54:13 +02:00
binlog_truncate_active_log.result MDEV-25962: binlog.binlog_truncate_multi_log_unsafe test fails in buildbot 2021-08-13 14:01:26 +05:30
binlog_truncate_innodb.result MDEV-22008 rpl.rpl_semi_sync fails in bb, MDEV-24418 reenable binlog_truncate_innodb and binlog_spurious_ddl_errors, rpl_parallel_retry fails in bb 2020-12-18 19:31:51 +01:00
binlog_truncate_kill.result MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
binlog_truncate_multi_engine.result MDEV-25962: binlog.binlog_truncate_multi_log_unsafe test fails in buildbot 2021-08-13 14:01:26 +05:30
binlog_truncate_multi_log.result MDEV-25962: binlog.binlog_truncate_multi_log_unsafe test fails in buildbot 2021-08-13 14:01:26 +05:30
binlog_truncate_multi_log_unsafe.result MDEV-25962: binlog.binlog_truncate_multi_log_unsafe test fails in buildbot 2021-08-13 14:01:26 +05:30
binlog_truncate_myisam.result MDEV-7635: Part 1 2017-02-10 06:30:42 -05:00
binlog_unsafe.result Merge 10.2 to 10.3 2019-08-13 19:28:51 +03:00
binlog_variables_log_bin.result test suite for compressed binlog event 2016-10-19 20:20:47 +02:00
binlog_variables_log_bin_index.result test suite for compressed binlog event 2016-10-19 20:20:47 +02:00
binlog_variables_relay_log.result MDEV-7110 : Add missing MySQL variable log_bin_basename and log_bin_index 2015-06-09 13:38:29 -04:00
binlog_variables_relay_log_index.result MDEV-7110 : Add missing MySQL variable log_bin_basename and log_bin_index 2015-06-09 13:38:29 -04:00
binlog_write_error.result MDEV-24668 debug assert on SET PASSWORD when binlog fails 2021-03-08 15:00:45 +01:00
binlog_xa_checkpoint.result MDEV-742 XA PREPAREd transaction survive disconnect/server restart 2020-03-14 22:45:48 +02:00
binlog_xa_prepared.result MDEV-742 XA PREPAREd transaction survive disconnect/server restart 2020-03-14 22:45:48 +02:00
binlog_xa_prepared_disconnect.result MDEV-515 Reduce InnoDB undo logging for insert into empty table 2021-01-25 18:41:27 +02:00
binlog_xa_recover.result fix binlog_xa_recover test 2021-02-22 19:43:08 +01:00
flashback-largebinlog.result Updated mtr files to support different compiled in options 2019-09-01 19:17:35 +03:00
flashback.result MDEV-23842 Atomic RENAME TABLE 2021-05-19 22:54:12 +02:00
foreign_key.result Added support for replication for S3 2020-03-24 21:00:02 +02:00
load_data_stm_view.result Cleanups 2017-12-08 11:38:22 +02:00
mysqladmin.result MDEV-12612 mysqladmin --local flush... to use FLUSH LOCAL 2017-05-24 11:59:04 +02:00
read_only.result Merge 10.3 into 10.4 2019-11-01 15:23:18 +02:00
read_only_statement.result Merge 10.3 into 10.4 2019-11-01 15:23:18 +02:00
show_concurrent_rotate.result MDEV-20215: binlog.show_concurrent_rotate failed in buildbot with wrong result 2021-08-13 10:53:19 -06:00
temptable_uservar_disconnect-7938.result MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00