# # Bug#49907: ALTER TABLE ... TRUNCATE PARTITION # does not wait for locks on the table # CREATE TABLE t1 (a INT) ENGINE = InnoDB PARTITION BY RANGE (a) (PARTITION p0 VALUES LESS THAN (15), PARTITION pMax VALUES LESS THAN MAXVALUE); INSERT INTO t1 VALUES (1), (11), (21), (33); BEGIN; DELETE FROM t1 WHERE a = 11; SELECT * FROM t1; a 1 21 33 # con1 (send) ALTER TABLE t1 TRUNCATE PARTITION pMax; # con default SELECT * FROM t1; a 1 21 33 # Commit will allow the TRUNCATE to finish COMMIT; # con1 (reap) # con1 (disconnect) # default connection SELECT * FROM t1; a 1 DROP TABLE t1; # # Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with # concurrent I_S query # # This test is modified after WL#9814. The test case now cannot show # the partitions that are altered after I_S query execution is started. # That is because, the I_S system view execution sees snapshot (MVCC) of # DD metadata at the time the I_S system view select started processing. # # The test is updated to verify a case when a partition is removed after # I_S query starts executing. It is expected that I_S query report a # error and continue processing more rows. # create table t1 (a int) engine = innodb stats_persistent=0 partition by range (a) (partition p0 values less than MAXVALUE); insert into t1 values (1), (11), (21), (33); SELECT * FROM t1; a 1 11 21 33 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0 /*!50100 PARTITION BY RANGE (`a`) (PARTITION p0 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ t1#P#p0.ibd SET DEBUG_SYNC='before_open_in_IS_query SIGNAL parked WAIT_FOR open'; SELECT TABLE_SCHEMA, TABLE_NAME, PARTITION_NAME, PARTITION_ORDINAL_POSITION, PARTITION_DESCRIPTION, TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; SET DEBUG_SYNC = 'now WAIT_FOR parked'; SET DEBUG_SYNC = 'alter_table_inplace_before_commit SIGNAL open WAIT_FOR alter'; ALTER TABLE t1 REORGANIZE PARTITION p0 INTO (PARTITION p1 VALUES LESS THAN (10), PARTITION p10 VALUES LESS THAN MAXVALUE); SET DEBUG_SYNC = 'now SIGNAL alter'; TABLE_SCHEMA TABLE_NAME PARTITION_NAME PARTITION_ORDINAL_POSITION PARTITION_DESCRIPTION TABLE_ROWS test t1 p0 1 MAXVALUE NULL Warnings: Warning 1735 Unknown partition 'p0' in table 't1' t1#P#p1.ibd t1#P#p10.ibd SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci STATS_PERSISTENT=0 /*!50100 PARTITION BY RANGE (`a`) (PARTITION p1 VALUES LESS THAN (10) ENGINE = InnoDB, PARTITION p10 VALUES LESS THAN MAXVALUE ENGINE = InnoDB) */ SELECT * FROM t1; a 1 11 21 33 drop table t1; SET DEBUG_SYNC = 'RESET';