mirror of
https://github.com/MariaDB/server.git
synced 2025-07-03 01:48:12 +02:00

In commit 6e6a1b316c
(MDEV-35000)
a race condition was exposed.
ha_innobase::check_if_incompatible_data(): If the statistics have
already been initialized for the table, skip the invocation of
innobase_copy_frm_flags_from_create_info() in order to avoid
unexpectedly ruining things for other threads that are concurrently
accessing the table.
dict_stats_save(): Add debug instrumentation that is necessary for
reproducing the interlocking of the failure scenario.
49 lines
1.4 KiB
Text
49 lines
1.4 KiB
Text
CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB
|
|
STATS_PERSISTENT=1 STATS_AUTO_RECALC=0
|
|
PARTITION BY RANGE(a)
|
|
(PARTITION pa VALUES LESS THAN (3),
|
|
PARTITION pb VALUES LESS THAN (5));
|
|
INSERT INTO t1 VALUES(2,'two'),(2,'two'),(4,'four');
|
|
connect ddl,localhost,root,,test;
|
|
SET DEBUG_SYNC = 'inplace_after_index_build SIGNAL go WAIT_FOR done';
|
|
ALTER TABLE t1 ADD UNIQUE KEY (a,b(3));
|
|
connection default;
|
|
SET DEBUG_SYNC = 'now WAIT_FOR go';
|
|
BEGIN;
|
|
SELECT * FROM t1 FOR UPDATE;
|
|
a b
|
|
2 two
|
|
2 two
|
|
4 four
|
|
SET DEBUG_SYNC = 'now SIGNAL done';
|
|
connection ddl;
|
|
ERROR 23000: Duplicate entry '2-two' for key 'a'
|
|
connection default;
|
|
DELETE FROM t1;
|
|
SET DEBUG_SYNC = 'RESET';
|
|
CHECK TABLE t1;
|
|
Table Op Msg_type Msg_text
|
|
test.t1 check status OK
|
|
CREATE TABLE t(a INT, b VARCHAR(10)) ENGINE=InnoDB
|
|
STATS_PERSISTENT=1 STATS_AUTO_RECALC=1;
|
|
RENAME TABLE t TO u;
|
|
DELETE FROM mysql.innodb_table_stats WHERE table_name='u';
|
|
DELETE FROM mysql.innodb_index_stats WHERE table_name='u';
|
|
SET STATEMENT debug_dbug='+d,dict_stats_save_exit_notify_and_wait' FOR
|
|
SELECT * FROM u;
|
|
connection ddl;
|
|
SET DEBUG_SYNC='open_tables_after_open_and_process_table
|
|
WAIT_FOR dict_stats_save_finished';
|
|
ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u;
|
|
connect sync,localhost,root;
|
|
SET DEBUG_SYNC='now SIGNAL dict_stats_save_unblock';
|
|
disconnect sync;
|
|
connection default;
|
|
a b
|
|
connection ddl;
|
|
disconnect ddl;
|
|
connection default;
|
|
SELECT * FROM u;
|
|
a b
|
|
SET DEBUG_SYNC = 'RESET';
|
|
DROP TABLE t1,u;
|