1# Partitioning test that require debug features and InnoDB
2# including crashing tests.
3
4# This test takes long time, so only run it with the --big-test mtr-flag.
5--source include/big_test.inc
6--source include/have_debug.inc
7--source include/have_innodb.inc
8--source include/have_partition.inc
9# Don't test this under valgrind, memory leaks will occur
10--source include/not_valgrind.inc
11# Crash tests don't work with embedded
12--source include/not_embedded.inc
13
14--disable_warnings
15DROP TABLE IF EXISTS t1;
16--enable_warnings
17
18--let $DATADIR= `SELECT @@datadir;`
19
20# Waiting for wl#6723
21if (0)
22{
23--echo #
24--echo # Bug#12696518/Bug#11766879/60106:DIFF BETWEEN # OF INDEXES IN MYSQL
25--echo # VS INNODB, PARTITONING, ON INDEX CREATE
26--echo #
27CREATE TABLE t1
28(a INT PRIMARY KEY,
29 b VARCHAR(64))
30ENGINE = InnoDB
31PARTITION BY HASH (a) PARTITIONS 3;
32INSERT INTO t1 VALUES (0, 'first row'), (1, 'second row'), (2, 'Third row');
33INSERT INTO t1 VALUES (3, 'row id 3'), (4, '4 row'), (5, 'row5');
34INSERT INTO t1 VALUES (6, 'X 6 row'), (7, 'Seventh row'), (8, 'Last row');
35
36ALTER TABLE t1 ADD INDEX new_b_index (b);
37ALTER TABLE t1 DROP INDEX new_b_index;
38
39SET SESSION debug= "+d,ha_partition_fail_final_add_index";
40
41--error ER_NO_PARTITION_FOR_GIVEN_VALUE
42ALTER TABLE t1 ADD INDEX (b);
43SHOW CREATE TABLE t1;
44--sorted_result
45SELECT * FROM t1;
46
47FLUSH TABLES;
48--error ER_NO_PARTITION_FOR_GIVEN_VALUE
49CREATE INDEX new_index ON t1 (b);
50SHOW CREATE TABLE t1;
51--sorted_result
52SELECT * FROM t1;
53
54SET SESSION debug= "-d,ha_partition_fail_final_add_index";
55SHOW CREATE TABLE t1;
56DROP TABLE t1;
57}
58
59# Checking with #innodb what this is...
60call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was");
61# If there is a crash or failure between the ddl_log is written and the
62# operation is completed, mysql will try to drop a not yet created partition
63call mtr.add_suppression("InnoDB: Error: table .* does not exist in the InnoDB internal");
64call mtr.add_suppression("InnoDB: Warning: MySQL is trying to drop table ");
65
66
67let $engine= 'InnoDB';
68
69--echo # Test crash and failure recovery in fast_alter_partition_table.
70--source suite/parts/inc/partition_mgm_crash.inc
71
72--echo #
73--echo # WL#4445: EXCHANGE PARTITION WITH TABLE
74--echo # Verify ddl_log and InnoDB in case of crashing.
75# Investigating if this warning is OK when crash testing.
76call mtr.add_suppression("InnoDB: Warning: allocated tablespace .*, old maximum was ");
77#
78call mtr.add_suppression("Attempting backtrace. You can use the following information to find out");
79call mtr.add_suppression("table .* does not exist in the InnoDB internal");
80
81let $create_statement= CREATE TABLE t1 (a INT, b VARCHAR(64))
82ENGINE = InnoDB
83PARTITION BY RANGE (a)
84(PARTITION p0 VALUES LESS THAN (10),
85 PARTITION p1 VALUES LESS THAN MAXVALUE);
86let $insert_statement= INSERT INTO t1 VALUES (1, "Original from partition p0"), (2, "Original from partition p0"), (3, "Original from partition p0"), (4, "Original from partition p0"), (11, "Original from partition p1"), (12, "Original from partition p1"), (13, "Original from partition p1"), (14, "Original from partition p1"), (21, "Original from partition p1"), (22, "Original from partition p1"), (23, "Original from partition p1"), (24, "Original from partition p1");
87
88let $create_statement2= CREATE TABLE t2 (a INT, b VARCHAR(64)) ENGINE = InnoDB;
89let $insert_statement2= INSERT INTO t2 VALUES (5, "Original from table t2"), (6, "Original from table t2"), (7, "Original from table t2"), (8, "Original from table t2");
90let $crash_statement= ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2;
91--source suite/parts/inc/partition_crash_exchange.inc
92let $fail_statement= $crash_statement;
93--source suite/parts/inc/partition_fail_exchange.inc
94
95--source suite/parts/inc/partition_crash_upgrade.inc
96--source suite/parts/inc/partition_fail_upgrade.inc
97