summaryrefslogtreecommitdiff
path: root/mysql-test/main/merge_debug.test
blob: 4141042c261880a8f6be4644c8a678f1a5896026 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#
# Test failures with MERGE
#

--source include/have_debug.inc

set @default_storage_engine= @@global.default_storage_engine;
set global default_storage_engine=myisam;
set session default_storage_engine=myisam;

call mtr.add_suppression("Index for table .*crashed' is corrupt; try to repair it");

--disable_warnings
drop table if exists crashed,t2,t3,t4;
--enable_warnings

SET @orig_debug=@@global.debug_dbug;

#
# Check that MariaDB handles reopen that fails without crashing
#
CREATE TABLE crashed (c1 INT);
CREATE TABLE t2 (c1 INT);
CREATE TABLE t3 (c1 INT);
CREATE TABLE t4 (c1 INT) ENGINE=MRG_MYISAM UNION=(crashed,t2,t3) INSERT_METHOD=LAST;
INSERT INTO crashed VALUES (10);
INSERT INTO t2 VALUES (20);
INSERT INTO t3 VALUES (30);

LOCK TABLES t3 WRITE, t2 WRITE, t4 WRITE, crashed WRITE;
SET GLOBAL debug_dbug="+d,myisam_pretend_crashed_table_on_open";
--disable_warnings
CREATE TRIGGER t1_ai AFTER INSERT ON crashed FOR EACH ROW INSERT INTO t2 VALUES(29);
--enable_warnings
SET GLOBAL debug_dbug=@orig_debug;
--error ER_TABLE_NOT_LOCKED
INSERT INTO t4 VALUES (39);
--error ER_TABLE_NOT_LOCKED
INSERT INTO crashed VALUES (11);
INSERT INTO t2 VALUES (21);
INSERT INTO t3 VALUES (31);
UNLOCK TABLES;
DROP TRIGGER t1_ai;
DROP TABLE t4,crashed,t2,t3;

set global default_storage_engine=@default_storage_engine;