Skip to content

Commit 355b74d

Browse files
author
Dmitry Lenev
committed
Fix for merge.test failures in mysql-5.5-runtime
tree for embedded server Test case for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables" can't be run against embedded server. Embedded server converts all DELAYED INSERTs into ordinary INSERTs and this test can't work properly if such conversion happens. Moved this test from merge.test to delayed.test which is skipped if test suite is run with --embedded-server option.
1 parent f14d947 commit 355b74d

File tree

4 files changed

+77
-76
lines changed

4 files changed

+77
-76
lines changed

mysql-test/r/delayed.result

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,3 +422,31 @@ UNLOCK TABLES;
422422
# Connection con1
423423
# Connection default
424424
DROP TABLE t1, t2, t3;
425+
#
426+
# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
427+
#
428+
drop table if exists t1, t2, tm;
429+
create table t1(a int);
430+
create table t2(a int);
431+
create table tm(a int) engine=merge union=(t1, t2);
432+
begin;
433+
select * from t1;
434+
a
435+
# Connection 'con1'.
436+
# Sending:
437+
alter table t1 comment 'test';
438+
# Connection 'default'.
439+
# Wait until ALTER TABLE blocks and starts waiting
440+
# for connection 'default'. It should wait with a
441+
# pending SNW lock on 't1'.
442+
# Attempt to perform delayed insert into 'tm' should not lead
443+
# to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
444+
# be emitted.
445+
insert delayed into tm values (1);
446+
ERROR HY000: DELAYED option not supported for table 'tm'
447+
# Unblock ALTER TABLE.
448+
commit;
449+
# Connection 'con1'.
450+
# Reaping ALTER TABLE:
451+
# Connection 'default'.
452+
drop tables tm, t1, t2;

mysql-test/r/merge.result

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3575,32 +3575,4 @@ ERROR HY000: The definition of table 'v1' prevents operation DELETE on table 'm1
35753575
drop view v1;
35763576
drop temporary table tmp;
35773577
drop table t1, t2, t3, m1, m2;
3578-
#
3579-
# Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
3580-
#
3581-
drop table if exists t1, t2, tm;
3582-
create table t1(a int);
3583-
create table t2(a int);
3584-
create table tm(a int) engine=merge union=(t1, t2);
3585-
begin;
3586-
select * from t1;
3587-
a
3588-
# Connection 'con1'.
3589-
# Sending:
3590-
alter table t1 comment 'test';
3591-
# Connection 'default'.
3592-
# Wait until ALTER TABLE blocks and starts waiting
3593-
# for connection 'default'. It should wait with a
3594-
# pending SNW lock on 't1'.
3595-
# Attempt to perform delayed insert into 'tm' should not lead
3596-
# to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
3597-
# be emitted.
3598-
insert delayed into tm values (1);
3599-
ERROR HY000: DELAYED option not supported for table 'tm'
3600-
# Unblock ALTER TABLE.
3601-
commit;
3602-
# Connection 'con1'.
3603-
# Reaping ALTER TABLE:
3604-
# Connection 'default'.
3605-
drop tables tm, t1, t2;
36063578
End of 6.0 tests

mysql-test/t/delayed.test

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,3 +552,52 @@ disconnect con1;
552552
connection default;
553553
DROP TABLE t1, t2, t3;
554554
--enable_ps_protocol
555+
556+
557+
--echo #
558+
--echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
559+
--echo #
560+
connect (con1,localhost,root,,);
561+
connection default;
562+
--disable_warnings
563+
drop table if exists t1, t2, tm;
564+
--enable_warnings
565+
create table t1(a int);
566+
create table t2(a int);
567+
create table tm(a int) engine=merge union=(t1, t2);
568+
begin;
569+
select * from t1;
570+
571+
--echo # Connection 'con1'.
572+
connection con1;
573+
--echo # Sending:
574+
--send alter table t1 comment 'test'
575+
576+
--echo # Connection 'default'.
577+
connection default;
578+
--echo # Wait until ALTER TABLE blocks and starts waiting
579+
--echo # for connection 'default'. It should wait with a
580+
--echo # pending SNW lock on 't1'.
581+
let $wait_condition=
582+
select count(*) = 1 from information_schema.processlist
583+
where state = "Waiting for table metadata lock" and
584+
info = "alter table t1 comment 'test'";
585+
--source include/wait_condition.inc
586+
--echo # Attempt to perform delayed insert into 'tm' should not lead
587+
--echo # to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
588+
--echo # be emitted.
589+
--error ER_DELAYED_NOT_SUPPORTED
590+
insert delayed into tm values (1);
591+
--echo # Unblock ALTER TABLE.
592+
commit;
593+
594+
--echo # Connection 'con1'.
595+
connection con1;
596+
--echo # Reaping ALTER TABLE:
597+
--reap
598+
599+
disconnect con1;
600+
--source include/wait_until_disconnected.inc
601+
--echo # Connection 'default'.
602+
connection default;
603+
drop tables tm, t1, t2;

mysql-test/t/merge.test

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,54 +2668,6 @@ drop temporary table tmp;
26682668
drop table t1, t2, t3, m1, m2;
26692669

26702670

2671-
--echo #
2672-
--echo # Test for bug #56251 "Deadlock with INSERT DELAYED and MERGE tables".
2673-
--echo #
2674-
connect (con1,localhost,root,,);
2675-
connection default;
2676-
--disable_warnings
2677-
drop table if exists t1, t2, tm;
2678-
--enable_warnings
2679-
create table t1(a int);
2680-
create table t2(a int);
2681-
create table tm(a int) engine=merge union=(t1, t2);
2682-
begin;
2683-
select * from t1;
2684-
2685-
--echo # Connection 'con1'.
2686-
connection con1;
2687-
--echo # Sending:
2688-
--send alter table t1 comment 'test'
2689-
2690-
--echo # Connection 'default'.
2691-
connection default;
2692-
--echo # Wait until ALTER TABLE blocks and starts waiting
2693-
--echo # for connection 'default'. It should wait with a
2694-
--echo # pending SNW lock on 't1'.
2695-
let $wait_condition=
2696-
select count(*) = 1 from information_schema.processlist
2697-
where state = "Waiting for table metadata lock" and
2698-
info = "alter table t1 comment 'test'";
2699-
--source include/wait_condition.inc
2700-
--echo # Attempt to perform delayed insert into 'tm' should not lead
2701-
--echo # to a deadlock. Instead error ER_DELAYED_NOT_SUPPORTED should
2702-
--echo # be emitted.
2703-
--error ER_DELAYED_NOT_SUPPORTED
2704-
insert delayed into tm values (1);
2705-
--echo # Unblock ALTER TABLE.
2706-
commit;
2707-
2708-
--echo # Connection 'con1'.
2709-
connection con1;
2710-
--echo # Reaping ALTER TABLE:
2711-
--reap
2712-
2713-
--echo # Connection 'default'.
2714-
connection default;
2715-
disconnect con1;
2716-
drop tables tm, t1, t2;
2717-
2718-
27192671
--echo End of 6.0 tests
27202672

27212673
--disable_result_log

0 commit comments

Comments
 (0)