mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 10:31:54 +01:00
8885225de6
The patch is inspired from MySQL. Instead of using a single String to hold the current active debug_sync signal, use a Hash_set to store LEX_STRINGS. This patch ensures that a signal can not be lost, by being overwritten by another thread via set DEBUG_SYNC = '... SIGNAL ...'; All signals are kepts "alive" until they are consumed by a wait event. This requires updating test cases that assume the GLOBAL signal is never consumed. Follow-up work needed: Port the additional syntax that allows one to set multiple signals and also conditionally deactivate signals when waiting.
53 lines
1.7 KiB
Text
53 lines
1.7 KiB
Text
CREATE TABLE t1 (
|
|
pk INT,
|
|
f1 VARCHAR(10) NOT NULL,
|
|
f2 VARCHAR(10) NULL,
|
|
f3 INT UNSIGNED NULL,
|
|
KEY (f1),
|
|
PRIMARY KEY (pk)
|
|
) ENGINE=InnoDB;
|
|
CREATE OR REPLACE ALGORITHM=MERGE VIEW v4 AS SELECT * FROM t1;
|
|
INSERT INTO t1 VALUES (1,'k','g',6),(2,'y','r',0),(3,'t','q',1),(4,'a','r',NULL),(5,'z','t',NULL);
|
|
CREATE TABLE t2 (f VARCHAR(10) NULL) ENGINE=InnoDB;
|
|
INSERT INTO t2 VALUES (NULL),('g'),('e'),('g');
|
|
CREATE TABLE t3 (
|
|
f1 VARCHAR(10) NOT NULL,
|
|
f2 VARCHAR(10) NULL,
|
|
f3 INT UNSIGNED NULL
|
|
) ENGINE=InnoDB;
|
|
INSERT INTO t3 VALUES ('k','n',9),('y','b',8),('m','w',6);
|
|
CREATE TABLE t4 (f INT NULL) ENGINE=InnoDB;
|
|
INSERT INTO t4 VALUES (8),(9);
|
|
UPDATE t1 SET t1.pk = -109 WHERE t1.f1 IN ( SELECT 'a' FROM t4 WHERE f >= 1 );
|
|
SET DEBUG_SYNC='now SIGNAL con1_dml';
|
|
connect con1,localhost,root,,test;
|
|
SET DEBUG_SYNC='now WAIT_FOR con1_dml';
|
|
begin;
|
|
SELECT * FROM t1 for update;
|
|
pk f1 f2 f3
|
|
-109 a r NULL
|
|
1 k g 6
|
|
2 y r 0
|
|
3 t q 1
|
|
5 z t NULL
|
|
SET DEBUG_SYNC='now SIGNAL default_dml';
|
|
SET DEBUG_SYNC='now SIGNAL con2_dml';
|
|
connection default;
|
|
SET DEBUG_SYNC='now WAIT_FOR default_dml';
|
|
UPDATE t3 AS alias1 LEFT JOIN t3 AS alias2 ON ( alias1.f1 <> alias1.f2 ) SET alias1.f3 = 59 WHERE ( EXISTS ( SELECT t1.f3 FROM t1 WHERE t1.f1 = alias1.f1 ) ) OR alias2.f1 = 'h';
|
|
connect con2,localhost,root,,test;
|
|
set debug_sync='now WAIT_FOR con2_dml';
|
|
SET DEBUG_SYNC='now SIGNAL con1_dml2';
|
|
disconnect con2;
|
|
connection con1;
|
|
SET DEBUG_SYNC='now WAIT_FOR con1_dml2';
|
|
UPDATE v4, t1 SET t1.pk = 76 WHERE t1.f2 IN ( SELECT t2.f FROM t2 INNER JOIN t3 );
|
|
connection default;
|
|
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
|
connection con1;
|
|
COMMIT;
|
|
disconnect con1;
|
|
connection default;
|
|
DROP VIEW v4;
|
|
DROP TABLE t1, t2, t3, t4;
|
|
set debug_sync= reset;
|