mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-28567 Assertion `0' in open_tables upon function-related operation
DBUG_ASSERT(0) was added by MDEV-17554 (auto-create history partitions) as an experimental measure. Testing has shown this conditional branch of can_recover_from_failed_open() can be possible due to MDL deadlock. The fix replaces DBUG_ASSERT with more specific one for !OT_ADD_HISTORY_PARTITION. Test case was synchronized to reproduce deadlock always and commented with execution path of MDL locking for Good (no deadlock) and Bad (deadlock). The logging was done with the help of preceding patch for debug MDL tracing.
This commit is contained in:
@ -21,5 +21,43 @@ connection con1;
|
||||
3
|
||||
3
|
||||
SET DEBUG_SYNC= 'RESET';
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
drop procedure proc;
|
||||
drop view v1,v2;
|
||||
#
|
||||
# MDEV-28567 Assertion `0' in open_tables upon function-related operation
|
||||
#
|
||||
CREATE TABLE t1 (a INT);
|
||||
CREATE TABLE t2 (b INT);
|
||||
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW UPDATE t2 SET b = 0;
|
||||
CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW UPDATE t1 SET a = 6;
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
SET AUTOCOMMIT=OFF;
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
connect con1,localhost,root,,test;
|
||||
DROP TRIGGER tr1;
|
||||
connection default;
|
||||
INSERT INTO t2 SELECT * FROM t2;
|
||||
SELECT f() FROM t2;
|
||||
ERROR 42000: FUNCTION test.f does not exist
|
||||
connect con2,localhost,root,,test;
|
||||
set debug_sync= 'after_open_table_mdl_shared signal s1';
|
||||
ALTER VIEW v1 AS SELECT f() FROM t1;
|
||||
connection con1;
|
||||
CREATE FUNCTION f() RETURNS INT RETURN 1;
|
||||
connection default;
|
||||
set debug_sync= 'now wait_for s1';
|
||||
SELECT * FROM ( SELECT * FROM v1 ) sq;
|
||||
a
|
||||
COMMIT;
|
||||
connection con2;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
connection default;
|
||||
DROP VIEW v1;
|
||||
DROP FUNCTION f;
|
||||
DROP TABLE t1, t2;
|
||||
set debug_sync= 'reset';
|
||||
|
Reference in New Issue
Block a user