mariadb/mysql-test/suite/parts/t/partition_debug_sync_innodb.test
Marko Mäkelä 9608773f75 MDEV-4750 follow-up: Reduce disabling innodb_stats_persistent
This essentially reverts commit 4e89ec6692
and only disables InnoDB persistent statistics for tests where it is
desirable. By design, InnoDB persistent statistics will not be updated
except by ANALYZE TABLE or by STATS_AUTO_RECALC.

The internal transactions that update persistent InnoDB statistics
in background tasks (with innodb_stats_auto_recalc=ON) may cause
nondeterministic query plans or interfere with some tests that deal
with other InnoDB internals, such as the purge of transaction history.
2021-08-31 13:55:02 +03:00

86 lines
2.6 KiB
Text

--source include/have_innodb.inc
--source include/have_partition.inc
--source include/have_debug_sync.inc
let $MYSQLD_DATADIR=`SELECT @@datadir`;
--echo #
--echo # Bug#49907: ALTER TABLE ... TRUNCATE PARTITION
--echo # does not wait for locks on the table
--echo #
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;
--sorted_result
SELECT * FROM t1;
--connect (con1, localhost, root,,)
--send
ALTER TABLE t1 TRUNCATE PARTITION pMax;
--connection default
let $wait_condition=
SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE STATE = "Waiting for table metadata lock" AND
INFO = "ALTER TABLE t1 TRUNCATE PARTITION pMax";
--source include/wait_condition.inc
--sorted_result
SELECT * FROM t1;
--echo # Commit will allow the TRUNCATE to finish
COMMIT;
--connection con1
--reap
--disconnect con1
--connection default
SELECT * FROM t1;
DROP TABLE t1;
--echo #
--echo # Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with
--echo # concurrent I_S query
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;
SHOW CREATE TABLE t1;
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test
SET DEBUG_SYNC='before_open_in_get_all_tables SIGNAL parked WAIT_FOR open';
SET DEBUG_SYNC='partition_open_error SIGNAL alter WAIT_FOR finish';
send
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';
connect (con1, localhost, root,,);
SET DEBUG_SYNC = 'now WAIT_FOR parked';
--echo # When waiting for the name lock in get_all_tables in sql_show.cc
--echo # this will not be concurrent any more, thus the TIMEOUT
SET DEBUG_SYNC = 'before_rename_partitions SIGNAL open WAIT_FOR alter TIMEOUT 1';
--echo # Needs to be executed twice, since first is this 'SET DEBUG_SYNC ...'
SET DEBUG_SYNC = 'before_close_thread_tables SIGNAL finish EXECUTE 2';
--error 0,ER_TABLE_EXISTS_ERROR
ALTER TABLE t1 REORGANIZE PARTITION p0 INTO
(PARTITION p0 VALUES LESS THAN (10),
PARTITION p10 VALUES LESS THAN MAXVALUE);
disconnect con1;
connection default;
--reap
--replace_result #p# #P# #sp# #SP#
--list_files $MYSQLD_DATADIR/test
SHOW CREATE TABLE t1;
SELECT * FROM t1;
drop table t1;
--list_files $MYSQLD_DATADIR/test
SET DEBUG_SYNC = 'RESET';