mirror of
https://github.com/MariaDB/server.git
synced 2025-01-24 15:54:37 +01:00
5196beed02
concurrent I_S query There were two problem: 1) MYSQL_LOCK_IGNORE_FLUSH also ignored name locks 2) there was a race between abort_and_upgrade_locks and alter_close_tables (i.e. remove_table_from_cache and close_data_files_and_morph_locks) Which allowed the table to be opened with MYSQL_LOCK_IGNORE_FLUSH flag resulting in renaming a partition that was already in use, which could cause the table to be unusable. Solution was to not allow IGNORE_FLUSH to skip waiting for a named locked table. And to not release the LOCK_open mutex between the calls to remove_table_from_cache and close_data_files_and_morph_locks by merging the functions abort_and_upgrade_locks and alter_close_tables. mysql-test/suite/parts/r/partition_debug_sync_innodb.result: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Added test result mysql-test/suite/parts/t/partition_debug_sync_innodb-master.opt: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Added test option mysql-test/suite/parts/t/partition_debug_sync_innodb.test: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Added test file sql/authors.h: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Time to be acknowledged :) sql/ha_partition.cc: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Added DEBUG_SYNC for deterministic testing sql/mysql_priv.h: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Renamed function since merging alter_close_tables into abort_and_upgrade_lock. sql/sql_base.cc: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Changed MYSQL_LOCK_IGNORE_FLUSH to not ignore name locks (open_placeholder). Merged alter_close_tables into abort_and_upgrade_locks (and added _and_close_table to the name) to not release LOCK_open between remove_table_from_cache and close_data_files_and_morph_locks. Added DEBUG_SYNC for deterministic testing. sql/sql_partition.cc: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Removed alter_close_tables, (merged it into abort_and_upgrad_lock) so that LOCK_open never is released between remove_table_from_cache and close_data_files_and_morph_locks. sql/sql_show.cc: Bug#50561: ALTER PARTITIONS does not have adequate lock, breaks with concurrent I_S query Added DEBUG_SYNC for deterministic testing
44 lines
1.5 KiB
Text
44 lines
1.5 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#50561: ALTER PARTITIONS does not have adequate lock, breaks with
|
|
--echo # concurrent I_S query
|
|
create table t1 (a int)
|
|
engine = innodb
|
|
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;
|
|
--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 * 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
|
|
--list_files $MYSQLD_DATADIR/test
|
|
SHOW CREATE TABLE t1;
|
|
SELECT * FROM t1;
|
|
drop table t1;
|
|
--list_files $MYSQLD_DATADIR/test
|
|
SET DEBUG_SYNC = 'RESET';
|