Skip to content

Commit 9ad6b77

Browse files
author
Sven Sandberg
committed
WL#7592 step 10. GTIDs: Generate Gtid_log_event and Previous_gtids_log_event always. Fix failing tests.
This patch fixes all test cases that fails due to the previous two patches. In addition it fixes two code bugs that were exposed/introduced due to the previous two patches, and which caused some of the test failures. - Fix bug in START SLAVE UNTIL MASTER_LOG_POS logic. The problem was: some Rotate_log_events in the relay log are generated on the slave, not on the master. Thus, their end_log_pos field is relative to the slave relay log. Since MASTER_LOS_POS is relative to the master binary log, we must not evaluate the MASTER_LOS_POS condition for such slave-generated Rotate_log_events. But the logic to skip the until check for slave-generated events was missing, and this caused tests to fail. The fix is to avoid evaluating the until condition for slave-generated events. This is easy because such events are easily distinguishable since their server_id is zero. So we check if the server_id==0, and in that case we don't evaluate the until condition. This did not cause any tests to fail before this worklog, because the events appeared so early in the relay log that their positions would be smaller than the position specified by MASTER_LOG_POS. However, after this patch, the events appear after Previous_gtids_log_event, which moves the position forward so much that it causes the slave thread to stop before the rotate event, which causes the test to fail. This was also not triggered by running the suite with gtid_mode=on, because the test was using include/not_gtid_enabled.inc. - Fix bug in sql_slave_skip_counter with GTIDs. sql_slave_skip_counter did not compute transaction boundaries correctly in the presence of Gtid_log_events. This did not cause any problems before this patch since sql_slave_skip_counter is not allowed when gtid_mode=on. sql_slave_skip_counter is supposed to decrease for every event processed, except it should not decrease down to 0 in the middle of a group. This ensures that the applier thread does not stop in the middle of a transaction. However, the applier thread did not consider Gtid_log_event to be part of a group, and therefore it could stop after the Gtid_log_event. The problem was that Gtid_log_event implemented a specialized do_shall_skip function. This caused it to decrease the counter down to zero. The fix is to implement Gtid_log_event::do_shall_skip and make it call continue_group. - Fix simplified-binlog-recovery. Writing Previous_gtids_log_event always broke the logic for simplified-binlog-recovery. Background: Before this patch, simplified-binlog-recovery would avoid iterating over multiple binary logs only in the case that the binlog lacks a Previous_gtids_log_event. Problem: Since we now generate Previous_gtids_log_event always, recovery would iterate over all binary logs even when simplified-binlog-recovery was enabled. Fix: Make it so that simplified-binlog-recovery skips the rest of the binary logs also in the case that the first binary log contains a Previous_gtids_log_event and no Gtid_log_event. @mysql-test/extra/binlog_tests/binlog.test - Use show_binlog_events.inc instead of SHOW BINLOG EVENTS, so that Gtid/Anonymous events gets masked appropriately. - This particular test requires that columns 1, 2, and 5 are masked out (so that server_id is not masked out). However, show_binlog_events.inc only masks columns 2, 4, 5. Changed show_binlog_events.inc so that it allows user to specify the set of columns to be masked. @mysql-test/extra/binlog_tests/binlog_mysqlbinlog_row.inc - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/extra/binlog_tests/ctype_ucs_binlog.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/extra/binlog_tests/drop_tables_logical_timestamp.inc - Update test because grep_pattern.inc was altered. @mysql-test/extra/binlog_tests/logical_timestamping.inc - Update test because grep_pattern.inc was moved and altered. @mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test - Test was failing because it was expecting an exact number of events in the binlog. Fixed by adding an auxiliary test script include/get_row_count.inc that computes the number of events in the binlog. - While I was here, also changed to use assertion. @mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/extra/rpl_tests/check_type.inc - Provide more debug info if $rpl_debug is set. @mysql-test/extra/rpl_tests/create_recursive_construct.inc - The test expected that an empty binlog would contain 2 events. Changed this to 3. - The test expected that the third event of a binlog containing only one DML transaction in row format would be a Table_map. Changed third to fifth. - Simplify code to use assertions, to make it more readable and produce more debug output on failure. @mysql-test/extra/rpl_tests/rpl_implicit_commit_binlog.test - Fix test failure: This test executed some statements and then asserted that there was a COMMIT after a specific number of events in the binary log. Since we now write more events to the binary log, we have to increase this number in order for the test to succeed. - Use assert.inc instead of manual 'if' statements. - Rename variable $ok to $check_position_of_commit_event, since that explains better what the variable does. - Clarify purpose of the test. @mysql-test/extra/rpl_tests/rpl_insert_ignore.test - Test failure fix: The test asserted that there was a query_log_event after a specific number of events in the binary log. Since the number of events has changed, this number has to be updated. - The test case used to have a special case for gtid_mode=on, handled by extra/rpl_tests/rpl_insert_ignore_gtid_on.inc Since there is now no difference in event count between gtid_mode=on and gtid_mode=off, we can hardcode the number again and do not need the include file. Removed the include file. @mysql-test/extra/rpl_tests/rpl_insert_ignore_gtid_on.inc - Remove this file as it is not needed any more. See changeset comment for mysql-test/extra/rpl_tests/rpl_insert_ignore.test @mysql-test/extra/rpl_tests/rpl_log.test - Update the LIMIT clause for SHOW BINLOG EVENTS because the number of events in the binlog has changed. Now we can unify this instead of having different cases for GTID_MODE=ON and GTID_MODE=OFF. @mysql-test/extra/rpl_tests/rpl_row_show_relaylog_events.inc - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/extra/rpl_tests/rpl_show_binlog_events.inc - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/extra/rpl_tests/rpl_show_log_events_with_varying_options.inc - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/extra/rpl_tests/rpl_sp.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/extra/rpl_tests/rpl_start_stop_slave.test - Disable a part of the test that crashes MTS, which will be fixed in a separate bug. @mysql-test/extra/rpl_tests/rpl_stm_mix_show_relaylog_events.inc - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/extra/rpl_tests/type_conversions.test - Provide more debug info if $rpl_debug is set, but do not output lots of junk to the result file if $rpl_debug is unset. @mysql-test/include/assert_grep.inc - New auxiliary test script to be used instead of include/grep_pattern.inc @mysql-test/include/assert_gtid_mode_on.inc - New auxiliary file that causes the test to fail if gtid_mode is not ON. This was added to avoid similar bugs to the one found in rpl_incompatible_gtids_in_relay_log.test (see commit comments for that file for details). This file is sourced from the auxiliary files include/sync_*.inc @mysql-test/include/filter_file.inc - Add parameter to allow masking a given set of columns. This is needed to implement the new $show_binlog_events_mask_columns parameter of show_binlog_events.inc. @mysql-test/include/get_row_count.inc - New auxiliary file used by mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test. @mysql-test/include/grep_pattern.inc - Add $grep_output parameter, to allow different modes of output. This was needed in order to fix a bug in mysql-test/extra/rpl_test/rpl_large_serverid.inc (see changeset comment for that file for details). - Move the file to mysql-test/include. This is a generic utility, and as such it belongs to mysql-test/include. mysql-test/extra/... is generally used for test-specific includes. - Use mtr variables instead of environment variables for parameters. - Remove extra newline that was printed after each output row. - Improve the output: s/Occurrences of the $pattern/Occurrences of '$pattern'/ - Suggest using include/assert_grep.inc @mysql-test/include/mysqlbinlog.inc - New test framework file to filter out nondeterministic output. (Before, similar filter regexes were repeated in lots of places all over the test suite.) @mysql-test/include/rpl_change_topology_helper.inc - Assert that gtid_mode=on if $use_gtids is set (see motivation in changeset comment for assert_gtid_mode_on.inc). - Provide more debug info. @mysql-test/include/rpl_init.inc - Allow user to override $use_gtids=1 when gtid_mode=on. @mysql-test/include/save_io_thread_pos.inc - Assert that gtid_mode=on if $use_gtids is set (see motivation in changeset comment for assert_gtid_mode_on.inc). @mysql-test/include/save_master_pos.inc - Assert that gtid_mode=on if $use_gtids is set (see motivation in changeset comment for assert_gtid_mode_on.inc). @mysql-test/include/show_binlog_events.inc - Add missing documentation for existing parameter $mask_binlog_commit_events. - Add documentation for new parameters $show_binlog_events_verbose and $show_binlog_events_mask_columns (see show_events.inc for details). @mysql-test/include/show_events.inc - Change SQL commands to UPPERCASE. - Add $show_binlog_events_verbose parameter that will print statement with positions and filenames masked. - Add output of full statement if $rpl_debug is set. - Add parameter to allow masking out a given set of columns. This is needed in order to fix and simplify mysql-test/extra/binlog_tests/binlog.test - Mask out Anonymous_Gtid so that output is the same whether GTID_MODE is ON or OFF. - Correct a variable name, s/sidno/gno/. @mysql-test/include/show_rpl_debug_info.inc - Select from P_S tables. - Add $rpl_topology to output. @mysql-test/include/sync_slave_io.inc - Assert that gtid_mode=on if $use_gtids is set (see motivation in changeset comment for assert_gtid_mode_on.inc). @mysql-test/include/sync_slave_sql.inc - Assert that gtid_mode=on if $use_gtids is set (see motivation in changeset comment for assert_gtid_mode_on.inc). - Fix typo to produce correct output on timeout. @mysql-test/include/wait_for_query_to_succeed.inc - Document the file. - Write debug info when it fails. @mysql-test/include/write_result_to_file.inc - Print perl's error text ($!) on error. - Print $stmt on error. @mysql-test/r/flush_block_commit_notembedded.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/r/mysqlbinlog.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/r/user_var-binlog.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_innodb.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_row_myisam.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_gtid_mysqlbinlog_start_stop.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_gtid_row_ctype_ucs.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_gtid_stm_ctype_ucs.result - Update result file because test now uses include/mysqlbinlog.inc. @mysql-test/suite/binlog/r/binlog_hexdump.result - Update result file because output of mysqlbinlog has changed. @mysql-test/suite/binlog/r/binlog_implicit_commit.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/binlog/r/binlog_innodb.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/binlog/r/binlog_mts_logical_clock.result - Update result because grep_pattern.inc output was changed. @mysql-test/suite/binlog/r/binlog_mts_logical_clock_gtid.result - Update result because grep_pattern.inc output was changed. @mysql-test/suite/binlog/r/binlog_mysqlbinlog_row.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_innodb.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_myisam.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_trans.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_mysqlbinlog_start_stop.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql- test/suite/binlog/r/binlog_mysqlbinlog_start_stop_slave_server_id.result - Update result file since the test uses include/mysqlbinlog.inc instead of $MYSQL_BINLOG. @mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result - Update result because grep_pattern.inc output was changed. @mysql-test/suite/binlog/r/binlog_row_binlog.result - Update result file since we now use show_binlog_events.inc instead of SHOW BINLOG EVENTS. show_binlog_events.inc filters out Format_description_log_events. @mysql-test/suite/binlog/r/binlog_row_ctype_ucs.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_row_insert_select.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/binlog/r/binlog_stm_binlog.result - Update result file because of changes in test. @mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/binlog/r/binlog_stm_insert_select.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. - Also an assert was added. @mysql-test/suite/binlog/r/binlog_unsafe.result - Update result file because assert was added. @mysql-test/suite/binlog/t/binlog_killed.test - The code assumed a specific number of events in the binlog, and had a case distinction between GTID_MODE=ON or OFF. Simplified this since we now expect the same number of events always. - Removed useless replace_result. @mysql-test/suite/binlog/t/binlog_mts_logical_clock.test - Update test since grep_pattern.inc has moved and changed. @mysql-test/suite/binlog/t/binlog_mts_logical_clock_gtid.test - Update test since grep_pattern.inc has moved and changed. @mysql-test/suite/binlog/t/binlog_mysqlbinlog_concat.test - This test started failing because of this worklog. The test generates three binary logs: one with GTID_MODE=ON, one with GTID_MODE=OFF, and one with GTID_MODE=ON. Then it runs mysqlbinlog and executes the output from mysqlbinlog on a server that uses GTID_MODE=ON. Before this worklog, this did not cause any problems, because the binary log generated with GTID_MODE=OFF did not contain any GTIDs. Now, it contains Anonymous_gtid_log_event, which is not allowed when GTID_MODE=ON. To fix this, we use the --skip-gtids with mysqlbinlog when processing the second binary log file. @mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_trans.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test - Update test since grep_pattern.inc has moved and changed. @mysql-test/suite/binlog/t/binlog_row_query_log_events.test - The code assumed a specific number of events in the binlog, and had a case distinction between GTID_MODE=ON or OFF. Simplified this since we now expect the same number of events always. @mysql-test/suite/binlog/t/binlog_server_id.test - The code assumed a specific number of events in the binlog, and had a case distinction between GTID_MODE=ON or OFF. Simplified this since we now expect the same number of events always. @mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result - Updated result file because of changes in test file. @mysql-test/suite/rpl/r/rpl_do_db_filter.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/rpl/r/rpl_filter_warnings.result - Update result because output from grep_pattern.inc has changed. @mysql-test/suite/rpl/r/rpl_gtid_binlog_errors.result.THIS - Now, rpl_binlog_errors.test and rpl_gtid_binlog_errors.test have identical result files. Having different result files was the only reason for separating them into different tests. Thus, reconciled them into one test by removing the .test files (which were just wrappers), replacing them by the .inc file, and removing all the rpl_gtid_binlog_error* files. @mysql-test/suite/rpl/r/rpl_gtid_mode.result - Update result file because of changes in test file and in output from SHOW BINLOG EVENTS. @mysql-test/suite/rpl/r/rpl_gtid_row_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_gtid_stm_mix_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_ignore_db_filter.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/rpl/r/rpl_loaddata_s.result - Update result file because output from SHOW BINLOG EVENTS has changed. Before, the result set was empty. Now, it contains one row with a Previous_gtids_log_event. But the row is filtered out by show_binlog_events.inc. The end result is that the column headers are added. @mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result - Update result file. @mysql-test/suite/rpl/r/rpl_mts_logical_clock_timestamping.result - Update result since output from grep_pattern.inc has changed. @mysql-test/suite/rpl/r/rpl_mts_logical_clock_wrong_start_pos.result - Update result because of change in test. @mysql-test/suite/rpl/r/rpl_mysqlbinlog_gtid_on.result - Update result. @mysql-test/suite/rpl/t/rpl_recovery_replicate_same_server_id.result - Update result file because of clarifications in the main test file. @mysql-test/suite/rpl/r/rpl_replicate_same_server_id.result - Update result file because of clarifications in the main test file. - Rename the file since this really tests replicate-same-server-id. @mysql-test/suite/rpl/r/rpl_replication_observers_example_plugin.result - Update result because grep_pattern.inc output was changed. @mysql- test/suite/rpl/r/rpl_replication_observers_example_plugin_io.result - Update result because grep_pattern.inc output was changed. @mysql-test/suite/rpl/r/rpl_row_event_max_size.result - Update result file because binlog now contains Anonymous_gtids_log_event. @mysql-test/suite/rpl/r/rpl_row_ignorable_event.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result - Update result file because assert was added. @mysql-test/suite/rpl/r/rpl_row_mts_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_row_mysqlbinlog.result - Update result because test uses the new mysqlbinlog.inc file. @mysql-test/suite/rpl/r/rpl_row_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_row_until.result - Update result file because of simplification in main file. @mysql-test/suite/rpl/r/rpl_server_id.result - Renamed this file. No need to have a numeric suffix. @mysql-test/suite/rpl/r/rpl_server_uuid.result - Update result file because test file was changed. @mysql-test/suite/rpl/r/rpl_show_relaylog_events.result - Result file for new test. @mysql-test/suite/rpl/r/rpl_skip_slave_err_warnings.result - Update result since output from grep_pattern.inc has changed. @mysql-test/suite/rpl/r/rpl_sp_innodb.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/rpl/r/rpl_sp_myisam.result - Update result file because output of mysqlbinlog has changed and we now use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG'. @mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result - Update result file because assert was added in the test file. @mysql-test/suite/rpl/r/rpl_stm_mix_mts_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_stm_mix_show_relaylog_events.result - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/r/rpl_typeconv.result - Update result file because the test file was simplified. @mysql-test/suite/rpl/t/rpl_begin_commit_rollback-master.opt - Rename database to make test more readable. @mysql-test/suite/rpl/t/rpl_begin_commit_rollback-slave.opt - Rename database to make test more readable. @mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test - Test failure fix: The test did a START SLAVE UNTIL MASTER_LOG_POS, where MASTER_LOG_POS was one byte into a transaction. With no Gtid_log_event, that will round the position up so that the entire transaction is exeucted on slave. However, if the position is one byte into a Gtid_log_event, it will instead stop before the transaction has been committed. This caused the test to fail. The fix is to set MASTER_LOG_POS to one byte into the BEGIN query_log_event instead. - Cosmetic fix: added comments to explain what the test does - Improve debugging: use assertions instead of 'eval SELECT $result as 'Must be 0' - Cleanup: The test did: echo [on master] SET SESSION AUTOCOMMIT=0; Since there was no semicolon after the echo, the SET statement was never executed, only echoed. This was very confusing, and the test would fail if we actually set autocommit=0 here. So removed this. - Cosmetic fix: removed redundant DROP DATABASE IF EXISTS at the beginning of the test - Cosmetic fix: renamed databases to make test more readable: db1 -> replicate_do_db db2 -> binlog_ignore_db - Cosmetic fix: replaced connection master; echo [on master]; by --source include/rpl_connection_master.inc - Cosmetic fix: use uppercase for SQL in some cases @mysql-test/suite/rpl/t/rpl_binlog_errors.test - Change LIMIT clause of SHOW BINLOG EVENTS to compensate for adding two more events. - Now, rpl_binlog_errors.test and rpl_gtid_binlog_errors.test have identical result files. Having different result files was the only reason for separating them into different tests. Thus, reconciled them into one test by removing the .test files (which were just wrappers), replacing them by the .inc file, and removing all the rpl_gtid_binlog_error* files. @mysql-test/suite/rpl/t/rpl_binlog_errors.test - Now, rpl_binlog_errors.test and rpl_gtid_binlog_errors.test have identical result files. Having different result files was the only reason for separating them into different tests. Thus, reconciled them into one test by removing the .test files (which were just wrappers), replacing them by the .inc file, and removing all the rpl_gtid_binlog_error* files. @mysql-test/suite/rpl/t/rpl_dual_pos_advance.test - Fix failing test: because the number of events has changed, we change the LIMIT options for SHOW BINLOG EVENTS. @mysql-test/suite/rpl/t/rpl_filter_warnings.test - Update test because grep_pattern.inc was moved and altered. @mysql-test/suite/rpl/t/rpl_grant_plugin.test - The code assumed a specific number of events in the binlog, and had a case distinction between GTID_MODE=ON or OFF. Simplified this since we now expect the same number of events always. @mysql-test/suite/rpl/t/rpl_gtid_binlog_errors-master.opt - Now, rpl_binlog_errors.test and rpl_gtid_binlog_errors.test have identical result files. Having different result files was the only reason for separating them into different tests. Thus, reconciled them into one test by removing the .test files (which were just wrappers), replacing them by the .inc file, and removing all the rpl_gtid_binlog_error* files. @mysql-test/suite/rpl/t/rpl_gtid_binlog_errors.test - Now, rpl_binlog_errors.test and rpl_gtid_binlog_errors.test have identical result files. Having different result files was the only reason for separating them into different tests. Thus, reconciled them into one test by removing the .test files (which were just wrappers), replacing them by the .inc file, and removing all the rpl_gtid_binlog_error* files. @mysql-test/suite/rpl/t/rpl_gtid_drop_table.test - Fix typos in comment. - Simplify test assertion. @mysql-test/suite/rpl/t/rpl_gtid_mode.test - Fix failing test: because the number of events has changed, we change the LIMIT options for SHOW BINLOG EVENTS. @mysql-test/suite/rpl/t/rpl_gtid_row_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/t/rpl_gtid_stm_mix_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/t/rpl_mts_logical_clock_timestamping.test - Update test because grep_pattern.inc was moved and altered. @mysql-test/suite/rpl/t/rpl_mts_logical_clock_wrong_start_pos.test - Mask out positions from result file. @mysql-test/suite/rpl/t/rpl_mysqlbinlog_gtid_on.test - Add comments explaining the purpose of the test. - Remove last part of the test. The tested behavior is not intended, and this part of the test failed. @mysql-test/suite/rpl/t/rpl_recovery_replicate_same_server_id.test - Use include/assert_grep.inc instead of grep_pattern.inc since grep_pattern.inc has changed. @mysql-test/suite/rpl/t/rpl_replicate_same_server_id-master.opt - Rename this file to better reflect what is being tested. @mysql-test/suite/rpl/t/rpl_replicate_same_server_id-slave.opt - Rename this file to better reflect what is being tested. @mysql-test/suite/rpl/t/rpl_replicate_same_server_id.test - Rename this file to better reflect what is being tested. - Add comments to explain what is being tested. - Upgrade to our current coding standards. - Remove a possible race. @mysql-test/suite/rpl/t/rpl_replication_observers_example_plugin.test - Update test since grep_pattern.inc has moved and changed. @mysql-test/suite/rpl/t/rpl_replication_observers_example_plugin_io.test - Update test since grep_pattern.inc has moved and changed. @mysql-test/suite/rpl/t/rpl_row_ignorable_event.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/suite/rpl/t/rpl_row_mts_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/suite/rpl/t/rpl_row_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/t/rpl_row_until.test - Read master position using SHOW MASTER STATUS instead of SHOW BINLOG EVENTS, because SHOW BINLOG EVENTS requires that you give the exact number of events. - Use replace_result to filter out exact positions, instead of echoing the filtered statement and disabling the query log while executing the statement. @mysql-test/suite/rpl/t/rpl_server_id.test - Improve and clarify the comment. - Change the name of the test. @mysql-test/suite/rpl/t/rpl_server_uuid.test - Improvements in readability, used when debugging the test. (Eventually the fix was elsewhere but we may as well keep the improvements.) @mysql-test/suite/rpl/t/rpl_show_relaylog_events.test - Simplify the test suite: This family of tests contained a lot of duplications and confusions: - The following tests existed in the suite: rpl.rpl_stm_mix_show_relaylog_events rpl.rpl_stm_mix_gtid_show_relaylog_events rpl.rpl_stm_mix_mts_show_relaylog_events rpl.rpl_row_show_relaylog_events rpl.rpl_row_gtid_show_relaylog_events rpl.rpl_row_mts_show_relaylog_events - The *_mts_* tests were not specific to mts, they were specific to innodb. The only difference was that their result files differed on the commit events, which were Xid_log_events for MTS and query_log_event(COMMIT) events for non-MTS. There is a flag in show_binlog_events.inc to mask Xid events so that they look like query_log_events, so we can merge them to one file. - The *_gtid_* tests were only different because there was a Gtid_log_event when GTID_MODE=ON and no event when GTID_MODE=OFF. Now we always have an event, so we can merge the files together. - The *_stm_mix_* and *_row_* tests were only different because there was DML in the binlogs. There is no need for DML in this test case, it's enough to test with DDL, so we can merge these files together too. - So now that the output has been unified, we only need one test file and one result file. - The test used four levels of include files. This was redundant and made it very difficult to follow the logic. The test now invokes include/show_relaylog_events.inc directly, which makes it easier to understand what is going on. - The test used show_binlog_events.inc. This was unnecesary since the purpose is to test SHOW RELAYLOG EVENTS. Other tests test SHOW BINLOG EVENTS. So I have removed SHOW BINLOG EVENTS. - Fix test failure: The tests were failing because the output of SHOW RELAYLOG EVENTS has changed because Gtid_log_event is now generated. @mysql-test/suite/rpl/t/rpl_skip_slave_err_warnings.test - Update test because grep_pattern.inc was moved and altered. @mysql-test/suite/rpl/t/rpl_stm_mix_mts_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/suite/rpl/t/rpl_stm_mix_show_relaylog_events.test - Delete this file. See changeset comment for the file that is being renamed from mysql-test/extra/rpl_tests/rpl_show_relaylog_events.inc to mysql-test/suite/rpl/t/rpl_show_relaylog_events.test @mysql-test/t/mysqlbinlog.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @mysql-test/t/sp_trans_log.test - Change LIMIT clause of SHOW BINLOG EVENTS since binlog now contains two new events. @mysql-test/t/user_var-binlog.test - Use mysqlbinlog.inc instead of 'exec $MYSQL_BINLOG', to filter out GTIDs and other nondeterministic output. @sql/binlog.cc - Make simplified-gtid-recovery stop iteration over binary logs in the case that the first binary log contains a Previous_gtids_log_event. - Improve English in a comment. @sql/log_event.cc - Document logic for sql_slave_skip_counter. - Remove printing of logical timestamps from Query_log_event. The code for these timestamps will be removed in the next patch, but we remove the output already in this patch so that the necessary upates of tests get included in this patch. - Fix bug in Gtid_log_event for sql_slave_skip_counter, by implementing Gtid_log_event::do_shall_skip and make it call continue_group. @sql/log_event.h - Implement Gtid_log_event::do_shall_skip. @sql/rpl_rli.cc - Fix bug in START SLAVE UNTIL MASTER_LOG_POS. @sql/rpl_rli.h - Document logic and purpose of is_in_group. @mysql-test/suite/engines/funcs/t/disabled.def - Disable rpl_row_until due to BUG#20365935 (which is unrelated to this worklog).
1 parent c8f26fe commit 9ad6b77

File tree

157 files changed

+10132
-8266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+10132
-8266
lines changed

mysql-test/extra/binlog_tests/binlog.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,8 @@ BINLOG '
309309
';
310310

311311
# Show binlog events to check that server ids are correct.
312-
--replace_column 1 # 2 # 5 #
313-
--replace_regex /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/ /SET @@SESSION.GTID_NEXT=.*$/SET @@SESSION.GTID_NEXT= 'GTID';/ /GROUPS: .*:(.*,.*)/GROUPS: GTID:(X,X)/
314-
SHOW BINLOG EVENTS;
312+
--let $show_binlog_events_mask_columns= 1,2,5
313+
--source include/show_binlog_events.inc
315314

316315
DROP TABLE t1;
317316

mysql-test/extra/binlog_tests/binlog_mysqlbinlog_row.inc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,5 @@ DROP TABLE t1,t2;
481481
flush logs;
482482

483483
let $MYSQLD_DATADIR= `select @@datadir`;
484-
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
485-
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9]*[.][0-9]{1,3})[0-9e+-]*[^ ]*(.*(FLOAT|DOUBLE).*[*].)/\1...\2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /CRC32 0x[0-9a-f]{8}/CRC32 #/ /Xid = [0-9]*/XID/
486-
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
484+
--let $mysqlbinlog_parameters= --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
485+
--source include/mysqlbinlog.inc

mysql-test/extra/binlog_tests/ctype_ucs_binlog.test

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ source include/show_binlog_events.inc;
1616
# escaped).
1717
flush logs;
1818
let $MYSQLD_DATADIR= `select @@datadir`;
19-
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
20-
--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/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/
21-
--exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001
19+
--let $mysqlbinlog_parameters= --short-form $MYSQLD_DATADIR/master-bin.000001
20+
--source include/mysqlbinlog.inc
2221
drop table t2;
2322

2423
# End of 4.1 tests

mysql-test/extra/binlog_tests/drop_tables_logical_timestamp.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--let $MYSQLD_DATADIR= `select @@datadir`
22
--let $events_file=$MYSQLTEST_VARDIR/tmp/events.sql
3-
--let GREP_PRINT_NOT_VERBOSE=1
3+
--let $grep_output= print_count
44

55
#
66
# Testing DROP of multiple tables logging when a query produces few groups
@@ -22,7 +22,7 @@ CREATE TEMPORARY TABLE tti1 (a INT) ENGINE=Innodb;
2222
DROP TABLE tm,t1,ttm1,tti1;
2323

2424
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $events_file
25-
--let GREP_FILE=$events_file
25+
--let $grep_file=$events_file
2626

2727
#
2828
# The final grep invocation should be done by the top level part.

mysql-test/extra/binlog_tests/logical_timestamping.inc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
--let $MYSQLD_DATADIR= `select @@datadir`
22
--let $events_file=$MYSQLTEST_VARDIR/tmp/events.sql
3-
--let GREP_PRINT_NOT_VERBOSE=1
3+
--let $grep_output= print_count
44

55
RESET MASTER;
66

@@ -9,20 +9,20 @@ RESET MASTER;
99
CREATE TABLE t1 (a int) ENGINE= innodb;
1010

1111
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $events_file
12-
--let GREP_FILE=$events_file
13-
--let GREP_PATTERN=last_committed=0 sequence_number=1
12+
--let $grep_file=$events_file
13+
--let $grep_pattern=last_committed=0 sequence_number=1
1414
--echo Must be 1 occurence found
15-
--source extra/rpl_tests/grep_pattern.inc
15+
--source include/grep_pattern.inc
1616

1717
# A next transaction increments either counter
1818

1919
--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
2020
INSERT INTO t1 SET a=1;
2121

2222
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 --start-position=$binlog_pos > $events_file
23-
--let GREP_PATTERN=last_committed=1 sequence_number=2
23+
--let $grep_pattern=last_committed=1 sequence_number=2
2424
--echo Must be 1 occurence found
25-
--source extra/rpl_tests/grep_pattern.inc
25+
--source include/grep_pattern.inc
2626

2727
# Transaction's last committed timestamp is computed at its last
2828
# being executed query.
@@ -58,9 +58,9 @@ INSERT INTO t1 SET a=2;
5858
COMMIT;
5959

6060
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 --start-position=$binlog_pos > $events_file
61-
--let GREP_PATTERN=last_committed=3 sequence_number=4
61+
--let $grep_pattern=last_committed=3 sequence_number=4
6262
--echo Must be 1 occurence found
63-
--source extra/rpl_tests/grep_pattern.inc
63+
--source include/grep_pattern.inc
6464

6565

6666
--let $rpl_connection_name=one
@@ -69,9 +69,9 @@ COMMIT;
6969
--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
7070
COMMIT;
7171
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 --start-position=$binlog_pos > $events_file
72-
--let GREP_PATTERN=last_committed=3 sequence_number=5
72+
--let $grep_pattern=last_committed=3 sequence_number=5
7373
--echo Must be 1 occurence found
74-
--source extra/rpl_tests/grep_pattern.inc
74+
--source include/grep_pattern.inc
7575

7676
# Two independent and concurrent (autoincrement) transaction will either
7777
# have the same commit parent as the last committed of so far, or
@@ -95,10 +95,10 @@ COMMIT;
9595
--reap
9696

9797
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 --start-position=$binlog_pos > $events_file
98-
--let GREP_PATTERN=last_committed=[56] sequence_number=[67]
98+
--let $grep_pattern=last_committed=[56] sequence_number=[67]
9999

100100
--echo Must be 2 occurences found
101-
--source extra/rpl_tests/grep_pattern.inc
101+
--source include/grep_pattern.inc
102102

103103

104104
#
@@ -129,9 +129,9 @@ COMMIT;
129129
# Not "rotated" 2nd transaction is logged following the regular rule.
130130
# Its timestamp pair of (1,2) must be found.
131131
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $events_file
132-
--let GREP_PATTERN=last_committed=1 sequence_number=2
132+
--let $grep_pattern=last_committed=1 sequence_number=2
133133
--echo Must be 1 occurence found
134-
--source extra/rpl_tests/grep_pattern.inc
134+
--source include/grep_pattern.inc
135135

136136
FLUSH LOGS;
137137

@@ -143,9 +143,9 @@ COMMIT;
143143
# as expected. Its timestamp pair of (0,1) must be found.
144144

145145
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000002 > $events_file
146-
--let GREP_PATTERN=last_committed=0 sequence_number=1
146+
--let $grep_pattern=last_committed=0 sequence_number=1
147147
--echo Must be 1 occurence found
148-
--source extra/rpl_tests/grep_pattern.inc
148+
--source include/grep_pattern.inc
149149

150150
#
151151
# Testing logging of transaction that commits after RESET MASTER.
@@ -180,9 +180,9 @@ COMMIT;
180180
# Not "rotated" 2nd transaction is logged following the regular rule.
181181
# Its timestamp pair of (1,2) must be found.
182182
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $events_file
183-
--let GREP_PATTERN=last_committed=1 sequence_number=2
183+
--let $grep_pattern=last_committed=1 sequence_number=2
184184
--echo Must be 1 occurence found
185-
--source extra/rpl_tests/grep_pattern.inc
185+
--source include/grep_pattern.inc
186186

187187
RESET MASTER;
188188

@@ -197,9 +197,9 @@ COMMIT;
197197
# as expected. Its timestamp pair of (0,[12]) must be found.
198198

199199
--exec $MYSQL_BINLOG --force-if-open $MYSQLD_DATADIR/master-bin.000001 > $events_file
200-
--let GREP_PATTERN=last_committed=0 sequence_number=[12]
200+
--let $grep_pattern=last_committed=0 sequence_number=[12]
201201
--echo Must be 2 occurences found
202-
--source extra/rpl_tests/grep_pattern.inc
202+
--source include/grep_pattern.inc
203203

204204
#
205205
# Cleanup

mysql-test/extra/binlog_tests/mix_innodb_myisam_binlog.test

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,13 +322,13 @@ connection con4;
322322
select get_lock("a",10); # wait for rollback to finish
323323
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
324324
{
325-
--let $binlog_rollback= query_get_value(SHOW BINLOG EVENTS, Pos, 7)
326-
--let $binlog_query= query_get_value(SHOW BINLOG EVENTS, Info, 7)
327-
if ($binlog_query != ROLLBACK) {
328-
--echo Wrong query from SHOW BINLOG EVENTS. Expected ROLLBACK, got '$binlog_query'
329-
--source include/show_rpl_debug_info.inc
330-
--die Wrong value for slave parameter
331-
}
325+
--let $statement= SHOW BINLOG EVENTS
326+
--let $column= Pos
327+
--source include/get_row_count.inc
328+
--let $binlog_rollback_position= query_get_value(SHOW BINLOG EVENTS, Pos, $row_count)
329+
--let $assert_cond= "[SHOW BINLOG EVENTS, Info, $row_count]" = "ROLLBACK"
330+
--let $assert_text= Last event of binlog should be ROLLBACK.
331+
--source include/assert.inc
332332
}
333333
flush logs;
334334

@@ -343,7 +343,7 @@ if (`select @@binlog_format = 'ROW'`)
343343

344344
if (`select @@binlog_format = 'STATEMENT' || @@binlog_format = 'MIXED'`)
345345
{
346-
--exec $MYSQL_BINLOG --start-position=$binlog_rollback $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
346+
--exec $MYSQL_BINLOG --start-position=$binlog_rollback_position $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mix_innodb_myisam_binlog.output
347347

348348
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
349349
eval select

mysql-test/extra/binlog_tests/mysqlbinlog_row_engine.inc

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,9 +1649,8 @@ FLUSH LOGS;
16491649
--echo # Call mysqlbinlog to display the log file contents.
16501650
--echo #
16511651
let $MYSQLD_DATADIR= `select @@datadir`;
1652-
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1653-
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /([0-9A-F\-]{36})\:[0-9]+\-[0-9]+/GTID:#-#/ /GROUPS: .*:(.*,.*)/GROUPS: GTID:(X,X)/ /CRC32 0x[0-9a-f]{8}/CRC32 #/
1654-
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1652+
--let $mysqlbinlog_parameters= --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1653+
--source include/mysqlbinlog.inc
16551654

16561655
--echo #
16571656
--echo # Cleanup.
@@ -1729,9 +1728,8 @@ FLUSH LOGS;
17291728
--echo # Call mysqlbinlog to display the log file contents.
17301729
--echo #
17311730
let $MYSQLD_DATADIR= `select @@datadir`;
1732-
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1733-
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /([0-9A-F\-]{36})\:[0-9]+\-[0-9]+/GTID:#-#/ /GROUPS: .*:(.*,.*)/GROUPS: GTID:(X,X)/ /CRC32 0x[0-9a-f]{8}/CRC32 #/
1734-
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1731+
--let $mysqlbinlog_parameters= --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1732+
--source include/mysqlbinlog.inc
17351733

17361734
--echo #
17371735
--echo # Cleanup.
@@ -1856,9 +1854,8 @@ FLUSH LOGS;
18561854
--echo # Call mysqlbinlog to display the log file contents.
18571855
--echo #
18581856
let $MYSQLD_DATADIR= `select @@datadir`;
1859-
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1860-
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /([0-9A-F\-]{36})\:[0-9]+\-[0-9]+/GTID:#-#/ /GROUPS: .*:(.*,.*)/GROUPS: GTID:(X,X)/ /CRC32 0x[0-9a-f]{8}/CRC32 #/
1861-
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1857+
--let $mysqlbinlog_parameters= --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1858+
--source include/mysqlbinlog.inc
18621859

18631860
--echo #
18641861
--echo # Cleanup.
@@ -1914,9 +1911,8 @@ FLUSH LOGS;
19141911
--echo # Call mysqlbinlog to display the log file contents.
19151912
--echo #
19161913
let $MYSQLD_DATADIR= `select @@datadir`;
1917-
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
1918-
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /last_committed=[0-9]*/last_committed=#/ /sequence_number=[0-9]*/sequence_number=#/ /end_log_pos [0-9]*/end_log_pos #/ /# at [0-9]*/# at #/ /Xid = [0-9]*/Xid = #/ /thread_id=[0-9]*/thread_id=#/ /table id [0-9]*/table id #/ /mapped to number [0-9]*/mapped to number #/ /server v [^ ]*/server v #.##.##/ /(@[0-9]*=[0-9-]*[.][0-9]{1,3})[0-9e+-]*[^ ]*[ ]*(.*(FLOAT|DOUBLE).*[*].)/\1... \2/ /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /CRC32 0x[0-9a-f]{8}/CRC32 #/
1919-
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1914+
--let $mysqlbinlog_parameters= --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
1915+
--source include/mysqlbinlog.inc
19201916

19211917
--echo #
19221918
--echo # Cleanup.

mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,5 @@ while ($eq_pos != 0)
3939
--echo ---- $option_text ----
4040

4141
# Print output
42-
--replace_regex /SET @@SESSION.GTID_NEXT= '.*'/SET @@SESSION.GTID_NEXT= 'GTID'/ /([0-9A-Fa-f\-]{36})\:[0-9]+\-[0-9]+/UUID:#-#/
43-
--exec $MYSQL_BINLOG --short-form $options $extra_options
42+
--let $mysqlbinlog_parameters= --short-form $options $extra_options
43+
--source include/mysqlbinlog.inc

mysql-test/extra/rpl_tests/check_type.inc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,27 @@ if (!$engine_type)
2020
let $engine_type=`SELECT @@default_storage_engine`;
2121
}
2222

23-
connection master;
23+
if ($rpl_debug)
24+
{
25+
--echo source_type=$source_type target_type=$target_type source_value=$source_value target_value=$target_value can_convert=$can_convert engine_type=$engine_type
26+
SELECT @@GLOBAL.SLAVE_TYPE_CONVERSIONS;
27+
}
28+
29+
--source include/rpl_connection_master.inc
2430
disable_warnings;
2531
DROP TABLE IF EXISTS t1;
2632
enable_warnings;
2733
eval CREATE TABLE t1(
2834
pk INT NOT NULL PRIMARY KEY,
2935
a $source_type
3036
) ENGINE=$engine_type;
31-
sync_slave_with_master;
37+
--source include/sync_slave_sql_with_master.inc
3238
eval ALTER TABLE t1 MODIFY a $target_type;
3339

34-
connection master;
40+
--source include/rpl_connection_master.inc
3541
eval INSERT INTO t1 VALUES(1, $source_value);
3642
if ($can_convert) {
37-
sync_slave_with_master;
43+
--source include/sync_slave_sql_with_master.inc
3844
eval SELECT a = $target_value into @compare FROM t1;
3945
eval INSERT INTO type_conversions SET
4046
Source = "$source_type",
@@ -48,7 +54,7 @@ if ($can_convert) {
4854
WHERE TestNo = LAST_INSERT_ID();
4955
}
5056
if (!$can_convert) {
51-
connection slave;
57+
--source include/rpl_connection_slave.inc
5258
wait_for_slave_to_stop;
5359
let $error = query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
5460
eval INSERT INTO type_conversions SET

mysql-test/extra/rpl_tests/create_recursive_construct.inc

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,9 @@ if ($CRC_RET_stmt_sidef) {
326326
--eval $CRC_RET_stmt_sidef
327327
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
328328

329-
if ($n_warnings != $CRC_expected_number_of_warnings) {
330-
--echo ******** Failure! Expected $CRC_expected_number_of_warnings warnings, got $n_warnings warnings. ********
331-
# SHOW WARNINGS;
332-
# SHOW BINLOG EVENTS;
333-
--die Wrong number of warnings.
334-
}
329+
--let $assert_cond= $n_warnings = $CRC_expected_number_of_warnings
330+
--let $assert_text= There should be $CRC_expected_number_of_warnings warning(s)
331+
--source include/assert.inc
335332

336333
# These queries are run without query log, to make result file more
337334
# readable. Debug info is only printed if something abnormal
@@ -342,20 +339,15 @@ if ($CRC_RET_stmt_sidef) {
342339
SET SQL_LOG_BIN = 0;
343340
RESET MASTER;
344341
--eval $CRC_RET_stmt_sidef
342+
345343
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
346-
if ($n_warnings != $CRC_expected_number_of_warnings_after_reset) {
347-
--echo ******** Failure! Expected $CRC_expected_number_of_warnings_after_reset warnings, got $n_warnings warnings. ********
348-
SHOW WARNINGS;
349-
SHOW BINLOG EVENTS;
350-
--die Wrong number of warnings.
351-
}
352-
--let $binlog_event= query_get_value(SHOW BINLOG EVENTS, Event_type, 2)
353-
if ($binlog_event != No such row) {
354-
--enable_query_log
355-
--echo ******** Failure! Something was written to the binlog despite SQL_LOG_BIN=0 ********
356-
SHOW BINLOG EVENTS;
357-
--die Binlog not empty
358-
}
344+
--let $assert_cond= $n_warnings = $CRC_expected_number_of_warnings_after_reset
345+
--let $assert_text= There should be $CRC_expected_number_of_warnings_after_reset warning(s)
346+
--source include/assert.inc
347+
348+
--let $assert_text= Only two events should exist in the binary log
349+
--let $assert_cond= "[SHOW BINLOG EVENTS, Event_type, 3]" = "No such row"
350+
--source include/assert.inc
359351
SET SQL_LOG_BIN = 1;
360352

361353
--echo * binlog_format = MIXED: expect row events in binlog and no warning.
@@ -365,21 +357,18 @@ if ($CRC_RET_stmt_sidef) {
365357
--let $n_warnings= `SHOW COUNT(*) WARNINGS`
366358
if ($n_warnings != $CRC_expected_number_of_warnings_after_reset) {
367359
--echo ******** Failure! Expected $CRC_expected_number_of_warnings_after_reset warnings, got $n_warnings warnings. ********
368-
SHOW WARNINGS;
369-
SHOW BINLOG EVENTS;
370-
--die Warnings printed
371-
}
372-
--let $event_type= query_get_value(SHOW BINLOG EVENTS, Event_type, 3)
373-
# The first event is format_description, the second is
374-
# Query_event('BEGIN'), and the third should be our Table_map
375-
# for unsafe statement.
376-
if (`SELECT '$event_type' != 'Table_map'`) {
377-
--enable_query_log
378-
--echo ******** Failure! Event number 3 was a '$event_type', not a 'Table_map'. ********
379-
SHOW WARNINGS;
380-
SHOW BINLOG EVENTS;
381-
--die Wrong events in binlog.
360+
--source include/show_rpl_debug_info.inc
361+
--die Wrong number of warnings
382362
}
363+
# We expect the binlog to contain:
364+
# 1. Format_description_log_event
365+
# 2. Previous_gtids_log_event
366+
# 3. Gtid_log_event
367+
# 4. Query_event('BEGIN')
368+
# 5. Table_map_log_event for the unsafe statement.
369+
--let $assert_text= Event number 5 should be a Table_map_log_event
370+
--let $assert_cond= "[SHOW BINLOG EVENTS, Event_type, 5]" = "Table_map"
371+
--source include/assert.inc
383372
SET binlog_format = STATEMENT;
384373

385374
--enable_query_log

0 commit comments

Comments
 (0)