mirror of
https://github.com/MariaDB/server.git
synced 2025-08-27 13:04:36 +03:00
Major replication test framework cleanup. This does the following: - Ensure that all tests clean up the replication state when they finish, by making check-testcase check the output of SHOW SLAVE STATUS. This implies: - Slave must not be running after test finished. This is good because it removes the risk for sporadic errors in subsequent tests when a test forgets to sync correctly. - Slave SQL and IO errors must be cleared when test ends. This is good because we will notice if a test gets an unexpected error in the slave threads near the end. - We no longer have to clean up before a test starts. - Ensure that all tests that wait for an error in one of the slave threads waits for a specific error. It is no longer possible to source wait_for_slave_[sql|io]_to_stop.inc when there is an error in one of the slave threads. This is good because: - If a test expects an error but there is a bug that causes another error to happen, or if it stops the slave thread without an error, then we will notice. - When developing tests, wait_for_*_to_[start|stop].inc will fail immediately if there is an error in the relevant slave thread. Before this patch, we had to wait for the timeout. - Remove duplicated and repeated code for setting up unusual replication topologies. Now, there is a single file that is capable of setting up arbitrary topologies (include/rpl_init.inc, but include/master-slave.inc is still available for the most common topology). Tests can now end with include/rpl_end.inc, which will clean up correctly no matter what topology is used. The topology can be changed with include/rpl_change_topology.inc. - Improved debug information when tests fail. This includes: - debug info is printed on all servers configured by include/rpl_init.inc - User can set $rpl_debug=1, which makes auxiliary replication files print relevant debug info. - Improved documentation for all auxiliary replication files. Now they describe purpose, usage, parameters, and side effects. - Many small code cleanups: - Made have_innodb.inc output a sensible error message. - Moved contents of rpl000017-slave.sh into rpl000017.test - Added mysqltest variables that expose the current state of disable_warnings/enable_warnings and friends. - Too many to list here: see per-file comments for details.
232 lines
7.3 KiB
Plaintext
232 lines
7.3 KiB
Plaintext
################################################################################
|
|
# This test case checks if the option "binlog-direct-non-transactional-updates"
|
|
# makes non-transactional changes in the statement format to be written to the
|
|
# binary log as soon as the statement commits.
|
|
#
|
|
# In what follows, we use the include file rpl_mixing_engines.inc to generate
|
|
# sql commands from a format string. The format string consists of a sequence of
|
|
# 'codes' separated by spaces. Before it set of commands, we paste the expected
|
|
# sequence in the binary log. The following codes exist:
|
|
#
|
|
# - Define the scope of a transaction:
|
|
# B - Begin.
|
|
# C - Commit.
|
|
# R - Rollback.
|
|
#
|
|
# - Change only T-Tables:
|
|
# T - Updates a T-Table.
|
|
# T-trig - Updates T-Tables through a trigger.
|
|
# T-func - Updates T-Tables through a function.
|
|
# T-proc - Updates T-Tables through a procedure.
|
|
# eT - Fails while updating the first tuple in a T-Table.
|
|
# Te - Fails while updating an n-tuple (n > 1) in a T-Table.
|
|
# Te-trig - Fails while updating an n-tuple (n > 1) in a T-Table.
|
|
# Te-func - Fails while updating an n-tuple (n > 1) in a T-Table.
|
|
#
|
|
# - Change only N-Tables
|
|
# N - Updates a N-Table.
|
|
# N-trig - Updates N-Tables through a trigger.
|
|
# N-func - Updates N-Tables through a function.
|
|
# N-proc - Updates N-Tables through a procedure.
|
|
# eN - Fails while updating the first tuple in a N-Table.
|
|
# Ne - Fails while updating an n-tuple (n > 1) in a N-Table.
|
|
# Ne-trig - Fails while updating an n-tuple (n > 1) in a N-Table.
|
|
# Ne-func - Fails while updating an n-tuple (n > 1) in a N-Table.
|
|
################################################################################
|
|
|
|
--source include/have_binlog_format_statement.inc
|
|
--source include/master-slave.inc
|
|
--source include/have_innodb.inc
|
|
|
|
set @@session.binlog_direct_non_transactional_updates= TRUE;
|
|
|
|
--echo #########################################################################
|
|
--echo # CONFIGURATION
|
|
--echo #########################################################################
|
|
|
|
--let $engine_type= Innodb
|
|
SET @commands= 'configure';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
--echo #########################################################################
|
|
--echo # 1 - BINLOG ORDER
|
|
--echo #########################################################################
|
|
connection master;
|
|
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo #
|
|
--echo #3) Generates in the binlog what follows:
|
|
--echo # --> STMT "N B T C" entries, format S.
|
|
--echo #
|
|
SET @commands= 'B T N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-trig C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-func C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-proc C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-trig C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-func C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-proc C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-trig C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-func C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-proc C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-trig C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-func C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-proc C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo #
|
|
--echo #3.e) Generates in the binlog what follows if T-* fails:
|
|
--echo # --> STMT "N" entry, format S.
|
|
--echo # Otherwise, what follows if N-* fails and a N-Table is changed:
|
|
--echo # --> STMT "N B T C" entries, format S.
|
|
--echo #
|
|
SET @commands= 'B eT N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B Te N C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T eN C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T Ne C';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo #
|
|
--echo #4) Generates in the binlog what follows:
|
|
--echo # --> STMT "N B T R" entries, format S.
|
|
--echo #
|
|
SET @commands= 'B T N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-trig R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-func R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T N-proc R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-trig R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-func R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-trig N-proc R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-trig R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-func R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-func N-proc R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-trig R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-func R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T-proc N-proc R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo
|
|
--echo #
|
|
--echo #4.e) Generates in the binlog what follows if T* fails:
|
|
--echo # --> STMT "B N C" entry, format S.
|
|
--echo # Otherwise, what follows if N* fails and a N-Table is changed:
|
|
--echo # --> STMT "N" entries, format S.
|
|
--echo #
|
|
SET @commands= 'B eT N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B Te N R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T eN R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
SET @commands= 'B T Ne R';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
|
|
|
|
--echo ###################################################################################
|
|
--echo # CHECK CONSISTENCY
|
|
--echo ###################################################################################
|
|
connection master;
|
|
sync_slave_with_master;
|
|
|
|
--exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql
|
|
--exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
|
--diff_files $MYSQLTEST_VARDIR/tmp/test-nmt-master.sql $MYSQLTEST_VARDIR/tmp/test-nmt-slave.sql
|
|
|
|
--echo ###################################################################################
|
|
--echo # CLEAN
|
|
--echo ###################################################################################
|
|
SET @commands= 'clean';
|
|
--source extra/rpl_tests/rpl_mixing_engines.inc
|
|
--source include/rpl_end.inc
|