Skip to content

Commit

Permalink
BUG#36181365: Fix terminology in replication test utilities
Browse files Browse the repository at this point in the history
This changes terminology in filenames of replication test utilities:
- Change terminology by applying the following replacements in all
  filenames for test utilities that need it, and in places their
  names occur in test files:
    master->source
    slave->replica
    slave_io->receiver
    slave_sql->applier
    mts->mta
    spco->rpco
- Structure the test directories as follows:
  mysql-test/include
    Generic, reusable test utilities. Like today.
  mysql-test/include/rpl
    Moved all replication-related, reusable test utilities here, and
    removed the rpl_ prefix from the filename, for those that had it.
    Previously these were in mysql-test/include.
  mysql-test/include/rpl/impl
    Helper files used by files in mysql-test/rpl, which are internal
    to them and not usable by test cases.
  mysql-test/include/rpl/debug
    Replication-related, reusable debugging tools. These are only
    for temporary use in debugging sessions, and we should never
    push tests that use them.
  mysql-test/include/rpl/deprecated
    Old tools that have better alternatives nowadays. Don't use them.
    We only don't remove them because they are used by tests (and
    those tests work OK so no need to refactor them either).
  mysql-test/common
    Fragments of test cases that are shared between multiple tests,
    but not generally reusable. Typically, if a .inc file executes
    specific SQL statements, it probably belongs here rather than
    in mysql-test/include. This has two subdirectories:
  mysql-test/common/binlog
    Test fragments that use one server.
    Previously these were in mysql-test/extra/binlog_tests. (And
    some were erroneously in mysql-test/include or
    mysql-test/suite/binlog/include.)
  mysql-test/common/rpl
    Test fragments that use multiple servers.
    Previously these were in mysql-test/extra/rpl_tests. (And
    some were erroneously in mysql-test/include or
    mysql-test/suite/rpl/include.)
- Rename include/only_* to include/have_*
  This makes the files follow existing convention.
- For the files to init/deinit replication:
  include/master-slave.inc->include/rpl/init_source_replica.inc
  include/rpl_end.inc->include/rpl/deinit.inc
- For the files used to sync nodes:
  sync_slave_sql_with_master.inc->sync_to_replica.inc
  sync_slave_io_with_master.inc->sync_to_replica_received.inc
  sync_slave_io.inc->sync_received_with_saved.inc
  sync_slave_sql.inc->sync_with_saved.inc
  sync_slave_sql_with_io.inc->sync_with_recieved.inc
  save_master_pos.inc->save_server_position.inc
  save_io_thread_pos.inc->save_received_position.inc
  rpl_get_end_of_relay_log.inc->save_relay_log_file_position.inc
  save_binlog_position.inc->save_binlog_file_position.inc
- Clarify these names:
  get_relay_log_pos.inc->convert_binlog_position_to_relay_log_position.inc
  purge_first_log.inc->purge_first_binlog.inc
  wait_for_slave_param.inc->wait_for_replica_status.inc
- Rename these assertion utilities:
  include/check_slave_is_running.inc->include/rpl/assert_replica_running.inc
  include/check_slave_no_error.inc->include/rpl/assert_replica_no_error.inc
  include/check_slave_param.inc->include/rpl/assert_replica_status.inc
- Add mysql-test/include/readme.md.
- Other minor changes.

Change-Id: Ice3e43d0673e4654b820165da1f997c9ec78f66e
  • Loading branch information
Sven Sandberg authored and dahlerlend committed Feb 26, 2024
1 parent 1390d74 commit 44a77b5
Show file tree
Hide file tree
Showing 5,073 changed files with 72,388 additions and 71,641 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ begin;
insert t2 values (5);
commit;
# first COMMIT must be Query_log_event, second - Xid_log_event
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
drop table t1,t2;

#
Expand Down Expand Up @@ -46,9 +46,9 @@ while ($1)
--enable_query_log
commit;
drop table t1;
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
--let $binlog_file= query_get_value(SHOW BINARY LOG STATUS, File, 1)
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
--let $binlog_file=

--disable_result_log
Expand Down Expand Up @@ -85,7 +85,7 @@ insert into t1 values (2);
insert into t1 values (3);
commit;
drop table t1;
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc

# now show that nothing breaks if we need to read from the cache more
# than once, resulting in split event-headers
Expand Down Expand Up @@ -121,7 +121,7 @@ commit;
show status like "binlog_cache_use";
enable_query_log;

--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc

drop table t1;

Expand All @@ -147,7 +147,7 @@ set @b= 14632475938453979136;
execute stmt using @a, @b;
deallocate prepare stmt;
drop table t1;
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc


#
Expand Down Expand Up @@ -181,7 +181,7 @@ END//
DELIMITER ;//

CALL p1();
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;

DROP PROCEDURE p1;
DROP TABLE t1;
Expand Down Expand Up @@ -268,7 +268,7 @@ use test;
# subsequent statements in row format.
connect (other,localhost,root,,test);
connection other;
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
connection default;
disconnect other;

Expand Down Expand Up @@ -356,7 +356,7 @@ iOtVZR4UAAAAKAAAAPIEAAAAAG8AAAAAAAEAAgAB/wACAAAAB2NFFg==

# Show binlog events to check that server ids are correct.
--let $show_binlog_events_mask_columns= 1,2,5
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc

DROP TABLE t1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# ==== Usage ====
#
# [--let $engine= MyISAM | --let $engine= InnoDB]
# --source extra/binlog_tests/binlog_row_kill_create_select.test
# --source common/binlog/binlog_row_kill_create_select.test
#
# ==== References ====
#
Expand Down Expand Up @@ -56,6 +56,6 @@ RESET BINARY LOGS AND GTIDS;
--connection default
--echo # Verify that 'CREATE TABLE t2', 'CREATE TABLE t3' and
--echo # 'CREATE TABLE t4' events were not logged.
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc

DROP TABLE t1;
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if ($before_truncate) {
eval $before_truncate;
}
TRUNCATE TABLE t2;
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;

DROP TABLE t1,t2;

Expand Down Expand Up @@ -63,6 +63,6 @@ SELECT COUNT(*) FROM t2;
connection default;
--echo # Connection: default

source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
disconnect truncate;
DROP TABLE t1,t2;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# has completed a necessary part of its cleanup.
# Selecting from P_S.threads provides a method to learn that.
#
--source include/gtid_utils.inc
--source include/rpl/gtid_utils.inc

# Total number of connection each performing one insert into table
--let $conn_number=20
Expand Down Expand Up @@ -68,10 +68,10 @@ CREATE TABLE t (a INT) ENGINE=innodb;
# reflect number of loops done in correctness computation.
--let $restart_number = 0
--let $how_to_restart=restart_mysqld.inc
--source extra/binlog_tests/binlog_xa_prepared_do_and_restart.inc
--source common/binlog/xa_prepared_do_and_restart.inc

--let $how_to_restart=kill_and_restart_mysqld.inc
--source extra/binlog_tests/binlog_xa_prepared_do_and_restart.inc
--source common/binlog/xa_prepared_do_and_restart.inc

--connection default

Expand All @@ -97,7 +97,7 @@ DROP VIEW v_processlist;
if (`SELECT @@global.log_bin`)
{
# Recording proper samples of binlogged prepared XA:s
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
}

# Multiplier 2 captures the XA two phase binlogging property
Expand Down Expand Up @@ -184,4 +184,4 @@ XA COMMIT 'xa1';

DROP TABLE t;

--source include/gtid_utils_end.inc
--source include/rpl/gtid_utils_end.inc
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ select * from t1;
select * from t2;
select * from t3;

--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc

drop table t1,t2,t3;

Expand Down Expand Up @@ -191,7 +191,7 @@ set insert_id= 3;
insert into t1 values (NULL), (33), (NULL);
set insert_id= 5;
insert into t1 values (55), (NULL);
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;

# cleanup
drop table t1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ if ($do_only_regular_logging)
}
}

--source include/gtid_step_reset.inc
--source include/rpl/gtid_step_reset.inc

if ($do_pre_binlog)
{
Expand Down Expand Up @@ -118,14 +118,14 @@ if ($do_pre_binlog)
{
--let $keep_ddl_xid=1
--let $show_binlog_events_mask_columns=1,2,4,5
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
}

# The Gtid check, when its mode ON.
# After rollback-recovery of this branch Gtid executed must
# remain as was before the query execution.
--let $gtid_step_count=0
--source include/gtid_step_assert.inc
--source include/rpl/gtid_step_assert.inc

} # end of $do_pre_binlog

Expand Down Expand Up @@ -171,15 +171,15 @@ if ($do_post_binlog)
{
--let $keep_ddl_xid=1
--let $show_binlog_events_mask_columns=1,2,4,5
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
}

# The Gtid check, when its mode ON.
# After commit-recovery of this branch Gtid executed must
# receive a new gtid item of the current DDL transaction.

--let $gtid_step_count=1
--source include/gtid_step_assert.inc
--source include/rpl/gtid_step_assert.inc

} # end of $do_post_binlog

Expand All @@ -193,15 +193,15 @@ if ($do_only_regular_logging)
{
--let $keep_ddl_xid=1
--let $show_binlog_events_mask_columns=1,2,4,5
--source include/show_binlog_events.inc
--source include/rpl/deprecated/show_binlog_events.inc
}

# The Gtid check, when its mode ON.
# After commit-recovery of this branch Gtid executed must
# receive a new gtid item of the current DDL transaction.

--let $gtid_step_count=1
--source include/gtid_step_assert.inc
--source include/rpl/gtid_step_assert.inc
}

#
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SET @var1= x'8300';
# code (and I have used it to test the fix) until there is some way to
# exercise this code from mysql-test-run.
EXECUTE stmt1 USING @var1;
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
SELECT HEX(f1) FROM t1;
DROP table t1;
# end test for bug#11338
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ create table t2 (c char(30)) charset=ucs2;
set @v=convert('abc' using ucs2);
reset binary logs and gtids;
insert into t2 values (@v);
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
# absolutely need variables names to be quoted and strings to be
# escaped).
flush logs;
let $MYSQLD_DATADIR= `select @@datadir`;
--let $mysqlbinlog_parameters= --short-form $MYSQLD_DATADIR/binlog.000001
--source include/mysqlbinlog.inc
--source include/rpl/mysqlbinlog.inc
drop table t2;

# End of 4.1 tests
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ create trigger tr1 before insert on t1 for each row insert into t2 values (2*new
create procedure sp1 (a int) insert into t1 values(a);
drop database testing_1;
--let $mask_binlog_commit_events= 1
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
--let $mask_binlog_commit_events= 0

# BUG#38773: DROP DATABASE cause switch to stmt-mode when there are
Expand All @@ -30,7 +30,7 @@ enable_warnings;
insert into t1 values (1);
drop table tt1, t1;
--let $mask_binlog_commit_events= 1
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
--let $mask_binlog_commit_events= 0

FLUSH STATUS;
Expand Down Expand Up @@ -58,7 +58,7 @@ SET SESSION DEBUG='-d,rm_table_no_locks_abort_after_atomic_tables';
# Both t1 and t2 remain as the whole statement is rolled back.
SHOW TABLES FROM db1;
--let $mask_binlog_commit_events= 1
--source include/show_binlog_events.inc # Check that the binlog is empty.
--source include/rpl/deprecated/show_binlog_events.inc # Check that the binlog is empty.
--let $mask_binlog_commit_events= 0

# Cleanup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ SET SESSION DEBUG='+d,rm_table_no_locks_abort_after_atomic_tables';
DROP DATABASE testing_1;
SET SESSION DEBUG='-d,rm_table_no_locks_abort_after_atomic_tables';
let $wait_binlog_event= DROP TABLE IF EXIST;
source include/wait_for_binlog_event.inc;
source include/rpl/wait_for_binlog_event.inc;
let $MYSQLD_DATADIR= `SELECT @@datadir`;

--let $mask_binlog_commit_events= 1
source include/show_binlog_events.inc;
source include/rpl/deprecated/show_binlog_events.inc;
--let $mask_binlog_commit_events= 0

--echo # Cleanup.
Expand Down
Loading

0 comments on commit 44a77b5

Please sign in to comment.