mirror of
https://github.com/MariaDB/server.git
synced 2025-01-20 22:12:30 +01:00
78c8bfdddf
Problem 1: tests often fail in pushbuild with a timeout when waiting for the slave to start/stop/receive error. Fix 1: Updated the wait_for_slave_* macros in the following way: - The timeout is increased by a factor ten - Refactored the macros so that wait_for_slave_param does the work for the other macros. Problem 2: Tests are often incorrectly written, lacking a source include/wait_for_slave_to_[start|stop].inc. Fix 2: Improved the chance to get it right by adding include/start_slave.inc and include/stop_slave.inc, and updated tests to use these. Problem 3: The the built-in test language command wait_for_slave_to_stop is a misnomer (does not wait for the slave io thread) and does not give as much debug info in case of failure as the otherwise equivalent macro source include/wait_for_slave_sql_to_stop.inc Fix 3: Replaced all calls to the built-in command by a call to the macro. Problem 4: Some, but not all, of the wait_for_slave_* macros had an implicit connection slave. This made some tests confusing to read, and made it more difficult to use the macro in circular replication scenarios, where the connection named master needs to wait. Fix 4: Removed the implicit connection slave from all wait_for_slave_* macros, and updated tests to use an explicit connection slave where necessary. Problem 5: The macros wait_slave_status.inc and wait_show_pattern.inc were unused. Moreover, using them is difficult and error-prone. Fix 5: remove these macros. Problem 6: log_bin_trust_function_creators_basic failed when running tests because it assumed @@global.log_bin_trust_function_creators=1, and some tests modified this variable without resetting it to its original value. Fix 6: All tests that use this variable have been updated so that they reset the value at end of test.
123 lines
2.4 KiB
Text
123 lines
2.4 KiB
Text
stop slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
reset master;
|
|
reset slave;
|
|
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
|
start slave;
|
|
|
|
*** Preparing data ***
|
|
CREATE TABLE t1 (a INT NOT NULL, b VARCHAR(10)) ENGINE=MyISAM;
|
|
CREATE TABLE t2 LIKE t1;
|
|
CREATE TABLE t3 LIKE t1;
|
|
CREATE TRIGGER tr1 BEFORE UPDATE ON t1
|
|
FOR EACH ROW BEGIN
|
|
UPDATE t2 SET b='YY' WHERE a=NEW.a;
|
|
END|
|
|
CREATE TRIGGER tr2 AFTER UPDATE ON t1
|
|
FOR EACH ROW BEGIN
|
|
UPDATE t3 SET b='ZZ' WHERE a=NEW.a;
|
|
END|
|
|
|
|
*** Test non-transactional group w/o PK ***
|
|
INSERT INTO t3 VALUES(1, 'AA');
|
|
INSERT INTO t2 VALUES(1, 'AA');
|
|
INSERT INTO t1 VALUES(1, 'AA');
|
|
RENAME TABLE t3 TO t3_bak;
|
|
UPDATE t1 SET b = 'XX' WHERE a = 1;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 XX
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
1 YY
|
|
SELECT * FROM t3 ORDER BY a;
|
|
a b
|
|
1 ZZ
|
|
SHOW TABLES LIKE 't%';
|
|
Tables_in_test (t%)
|
|
t1
|
|
t2
|
|
t3_bak
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 AA_for_row_or_XX_for_stmt_mixed
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
1 AA_for_row_or_YY_for_stmt_mixed
|
|
include/stop_slave.inc
|
|
RENAME TABLE t3_bak TO t3;
|
|
include/start_slave.inc
|
|
TRUNCATE t1;
|
|
TRUNCATE t2;
|
|
TRUNCATE t3;
|
|
|
|
*** Test non-transactional group w/ PK ***
|
|
ALTER TABLE t1 ADD PRIMARY KEY (a);
|
|
ALTER TABLE t2 ADD PRIMARY KEY (a);
|
|
ALTER TABLE t3 ADD PRIMARY KEY (a);
|
|
RENAME TABLE t3 TO t3_bak;
|
|
INSERT INTO t3 VALUES(2, 'B');
|
|
INSERT INTO t2 VALUES(2, 'B');
|
|
INSERT INTO t1 VALUES(2, 'B');
|
|
UPDATE t1 SET b = 'X' WHERE a = 2;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
2 X
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
2 YY
|
|
SELECT * FROM t3 ORDER BY a;
|
|
a b
|
|
2 ZZ
|
|
SHOW TABLES LIKE 't%';
|
|
Tables_in_test (t%)
|
|
t1
|
|
t2
|
|
t3_bak
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
include/stop_slave.inc
|
|
RENAME TABLE t3_bak TO t3;
|
|
include/start_slave.inc
|
|
TRUNCATE t1;
|
|
TRUNCATE t2;
|
|
TRUNCATE t3;
|
|
|
|
*** Test transactional group w/ PK ***
|
|
ALTER TABLE t1 ENGINE=InnoDB;
|
|
ALTER TABLE t2 ENGINE=InnoDB;
|
|
ALTER TABLE t3 ENGINE=InnoDB;
|
|
RENAME TABLE t3 TO t3_bak;
|
|
BEGIN;
|
|
INSERT INTO t1 VALUES (3, 'C'), (4, 'D');
|
|
INSERT INTO t2 VALUES (3, 'C'), (4, 'D');
|
|
INSERT INTO t3 VALUES (3, 'C'), (4, 'D');
|
|
COMMIT;
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
3 C
|
|
4 D
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
3 C
|
|
4 D
|
|
SELECT * FROM t3 ORDER BY a;
|
|
a b
|
|
3 C
|
|
4 D
|
|
SHOW TABLES LIKE 't%';
|
|
Tables_in_test (t%)
|
|
t1
|
|
t2
|
|
t3_bak
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a b
|
|
include/stop_slave.inc
|
|
RENAME TABLE t3_bak TO t3;
|
|
include/start_slave.inc
|
|
*** Clean up ***
|
|
DROP TABLE t1,t2,t3;
|