Debian Codegraph @

mysql-test/suite/parts/r/partition_debug_sync_innodb.result

raw
1 #
2 # Bug#49907: ALTER TABLE ... TRUNCATE PARTITION
3 # does not wait for locks on the table
4 #
5 CREATE TABLE t1 (a INT)
6 ENGINE = InnoDB
7 PARTITION BY RANGE (a)
8 (PARTITION p0 VALUES LESS THAN (15),
9 PARTITION pMax VALUES LESS THAN MAXVALUE);
10 INSERT INTO t1 VALUES (1), (11), (21), (33);
11 BEGIN;
12 DELETE FROM t1 WHERE a = 11;
13 SELECT * FROM t1;
14 a
15 1
16 21
17 33
18 # con1 (send)
19 ALTER TABLE t1 TRUNCATE PARTITION pMax;
20 # con default
21 SELECT * FROM t1;
22 a
23 1
24 21
25 33
26 # Commit will allow the TRUNCATE to finish
27 COMMIT;
28 # con1 (reap)
29 # con1 (disconnect)
30 # default connection
31 SELECT * FROM t1;
32 a
33 1
34 DROP TABLE t1;
35 #
36 # Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
37 # concurrent I_S query
38 #
39 # This test is modified after WL#9814. The test case now cannot show
40 # the partitions that are altered after I_S query execution is started.
41 # That is because, the I_S system view execution sees snapshot (MVCC) of
42 # DD metadata at the time the I_S system view select started processing.
43 #
44 # The test is updated to verify a case when a partition is removed after
45 # I_S query starts executing. It is expected that I_S query report a
46 # error and continue processing more rows.
47 #
48 create table t1 (a int)
49 engine = innodb stats_persistent=0
50 partition by range (a)
51 (partition p0 values less than MAXVALUE);
52 insert into t1 values (1), (11), (21), (33);
53 SELECT * FROM t1;
54 a
55 1
56 11
57 21
58 33
59 SHOW CREATE TABLE t1;
60 Table Create Table
61 t1 CREATE TABLE `t1` (
62 `a` int DEFAULT NULL
63 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0
64 /*!50100 PARTITION BY RANGE (`a`)
65 (PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
66 t1#P#p0.ibd
67 SET DEBUG_SYNC='before_open_in_IS_query SIGNAL parked WAIT_FOR open';
68 SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION,
69 PARTITION_DESCRIPTION, TABLE_ROWS
70 FROM INFORMATION_SCHEMA.PARTITIONS
71 WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test';
72 SET DEBUG_SYNC = 'now WAIT_FOR parked';
73 SET DEBUG_SYNC = 'alter_table_inplace_before_commit SIGNAL open WAIT_FOR alter';
74 ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
75 (PARTITION p1 VALUES LESS THAN (10),
76 PARTITION p10 VALUES LESS THAN MAXVALUE);
77 SET DEBUG_SYNC = 'now SIGNAL alter';
78 TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS
79 test t1 p0 1 MAXVALUE NULL
80 Warnings:
81 Warning 1735 Unknown partition 'p0' in table 't1'
82 t1#P#p1.ibd
83 t1#P#p10.ibd
84 SHOW CREATE TABLE t1;
85 Table Create Table
86 t1 CREATE TABLE `t1` (
87 `a` int DEFAULT NULL
88 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0
89 /*!50100 PARTITION BY RANGE (`a`)
90 (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB,
91 PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */
92 SELECT * FROM t1;
93 a
94 1
95 11
96 21
97 33
98 drop table t1;
99 SET DEBUG_SYNC = 'RESET';