mirror of
https://github.com/MariaDB/server.git
synced 2025-08-30 11:22:14 +03:00
56 lines
1.0 KiB
Plaintext
56 lines
1.0 KiB
Plaintext
include/master-slave.inc
|
|
[connection master]
|
|
*** Provoke a deadlock on the slave, check that transaction retry succeeds. ***
|
|
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
|
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
|
|
INSERT INTO t1(a) VALUES (1), (2), (3), (4), (5);
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 NULL
|
|
2 NULL
|
|
3 NULL
|
|
4 NULL
|
|
5 NULL
|
|
SET sql_log_bin=0;
|
|
ALTER TABLE t2 ENGINE=MyISAM;
|
|
SET sql_log_bin=1;
|
|
BEGIN;
|
|
UPDATE t1 SET b=2 WHERE a=4;
|
|
INSERT INTO t2 VALUES (2);
|
|
DELETE FROM t2 WHERE a=2;
|
|
BEGIN;
|
|
UPDATE t1 SET b=1 WHERE a=2;
|
|
INSERT INTO t2 VALUES (1);
|
|
UPDATE t1 SET b=1 WHERE a=4;
|
|
COMMIT;
|
|
UPDATE t1 SET b=2 WHERE a=2;
|
|
SELECT * FROM t1 WHERE a<10 ORDER BY a;
|
|
a b
|
|
1 NULL
|
|
2 2
|
|
3 NULL
|
|
4 2
|
|
5 NULL
|
|
ROLLBACK;
|
|
Warnings:
|
|
Warning 1196 Some non-transactional changed tables couldn't be rolled back
|
|
SELECT * FROM t1 ORDER BY a;
|
|
a b
|
|
1 NULL
|
|
2 1
|
|
3 NULL
|
|
4 1
|
|
5 NULL
|
|
* There will be two rows in t2 due to the retry.
|
|
SELECT * FROM t2 ORDER BY a;
|
|
a
|
|
1
|
|
1
|
|
retries
|
|
1
|
|
Last_SQL_Errno = '0'
|
|
Last_SQL_Error = ''
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
include/rpl_end.inc
|