mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 05:22:25 +01:00
9cba6c5aa3
This allows one to run the test suite even if any of the following options are changed: - character-set-server - collation-server - join-cache-level - log-basename - max-allowed-packet - optimizer-switch - query-cache-size and query-cache-type - skip-name-resolve - table-definition-cache - table-open-cache - Some innodb options etc Changes: - Don't print out the value of system variables as one can't depend on them to being constants. - Don't set global variables to 'default' as the default may not be the same as the test was started with if there was an additional option file. Instead save original value and reset it at end of test. - Test that depends on the latin1 character set should include default_charset.inc or set the character set to latin1 - Test that depends on the original optimizer switch, should include default_optimizer_switch.inc - Test that depends on the value of a specific system variable should set it in the test (like optimizer_use_condition_selectivity) - Split subselect3.test into subselect3.test and subselect3.inc to make it easier to set and reset system variables. - Added .opt files for test that required specfic options that could be changed by external configuration files. - Fixed result files in rockdsb & tokudb that had not been updated for a while.
161 lines
3.9 KiB
Text
161 lines
3.9 KiB
Text
# mysqlbinlog_trans.test
|
|
#
|
|
# Show that mysqlbinlog work correctly with transactions.
|
|
#
|
|
|
|
#--source include/have_myisam.inc
|
|
--let $engine_type_nontrans= MyISAM
|
|
--source include/have_innodb.inc
|
|
--let $engine_type= InnoDB
|
|
|
|
#
|
|
# The test case would also work with statement based or mixed mode logging.
|
|
# But this would require different result files. To handle this with the
|
|
# current test suite, new main test cases are required.
|
|
#
|
|
--source include/have_binlog_format_row.inc
|
|
|
|
--source include/have_log_bin.inc
|
|
|
|
--echo #
|
|
--echo # Preparatory cleanup.
|
|
--echo #
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1, t2;
|
|
--enable_warnings
|
|
|
|
--echo #
|
|
--echo # We need a fixed timestamp to avoid varying results.
|
|
--echo #
|
|
SET timestamp=1000000000;
|
|
|
|
--echo #
|
|
--echo # Delete all existing binary logs.
|
|
--echo #
|
|
RESET MASTER;
|
|
|
|
--echo #
|
|
--echo # Create test tables.
|
|
--echo #
|
|
eval CREATE TABLE t1 (
|
|
c1 INT,
|
|
c2 VARCHAR(20)
|
|
) ENGINE=$engine_type DEFAULT CHARSET latin1;
|
|
eval CREATE TABLE t2 (
|
|
c1 INT,
|
|
c2 VARCHAR(20)
|
|
) ENGINE=$engine_type_nontrans DEFAULT CHARSET latin1;
|
|
|
|
--echo #
|
|
--echo # Start transaction #1, transactional table only, commit.
|
|
--echo #
|
|
START TRANSACTION;
|
|
|
|
--echo #
|
|
--echo # Do some statements.
|
|
--echo #
|
|
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t1 SET c1 = c1 + 10;
|
|
DELETE FROM t1 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Commit transaction.
|
|
--echo #
|
|
COMMIT;
|
|
SELECT * FROM t1;
|
|
TRUNCATE TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Start transaction #2, transactional table only, rollback.
|
|
--echo #
|
|
START TRANSACTION;
|
|
|
|
--echo #
|
|
--echo # Do some statements.
|
|
--echo #
|
|
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t1 SET c1 = c1 + 10;
|
|
DELETE FROM t1 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Rollback transaction.
|
|
--echo #
|
|
ROLLBACK;
|
|
SELECT * FROM t1;
|
|
TRUNCATE TABLE t1;
|
|
|
|
--echo #
|
|
--echo # Start transaction #3, both tables, commit.
|
|
--echo #
|
|
START TRANSACTION;
|
|
|
|
--echo #
|
|
--echo # Do some statements on the transactional table.
|
|
--echo #
|
|
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t1 SET c1 = c1 + 10;
|
|
DELETE FROM t1 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Do some statements on the non-transactional table.
|
|
--echo #
|
|
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t2 SET c1 = c1 + 10;
|
|
DELETE FROM t2 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Commit transaction.
|
|
--echo #
|
|
COMMIT;
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
TRUNCATE TABLE t1;
|
|
TRUNCATE TABLE t2;
|
|
|
|
--echo #
|
|
--echo # Start transaction #4, both tables, rollback.
|
|
--echo #
|
|
START TRANSACTION;
|
|
|
|
--echo #
|
|
--echo # Do some statements on the transactional table.
|
|
--echo #
|
|
INSERT INTO t1 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t1 SET c1 = c1 + 10;
|
|
DELETE FROM t1 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Do some statements on the non-transactional table.
|
|
--echo #
|
|
INSERT INTO t2 VALUES (1,'varchar-1'), (2,'varchar-2'), (3,'varchar-3');
|
|
UPDATE t2 SET c1 = c1 + 10;
|
|
DELETE FROM t2 WHERE c1 = 12;
|
|
|
|
--echo #
|
|
--echo # Rollback transaction.
|
|
--echo #
|
|
ROLLBACK;
|
|
SELECT * FROM t1;
|
|
SELECT * FROM t2;
|
|
TRUNCATE TABLE t1;
|
|
TRUNCATE TABLE t2;
|
|
|
|
--echo #
|
|
--echo # Flush all log buffers to the log file.
|
|
--echo #
|
|
FLUSH LOGS;
|
|
|
|
--echo #
|
|
--echo # Call mysqlbinlog to display the log file contents.
|
|
--echo #
|
|
let $MYSQLD_DATADIR= `select @@datadir`;
|
|
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
--replace_regex /SQL_LOAD_MB-[0-9]-[0-9]/SQL_LOAD_MB-#-#/ /exec_time=[0-9]*/exec_time=#/ /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 #.##.##/ /CRC32 0x[0-9a-f]*/CRC32 XXX/ /collation_server=[0-9]+/collation_server=X/ /character_set_client=[0-9]+/character_set_client=X/ /collation_connection=[0-9]+/collation_connection=X/
|
|
--exec $MYSQL_BINLOG --base64-output=decode-rows -v -v $MYSQLD_DATADIR/master-bin.000001
|
|
|
|
--echo #
|
|
--echo # Cleanup.
|
|
--echo #
|
|
DROP TABLE t1, t2;
|
|
|
|
|