| 1 |
--source include/have_innodb.inc |
| 2 |
--source include/have_debug.inc |
| 3 |
--source include/have_debug_sync.inc |
| 4 |
# This test is slow on buildbot. |
| 5 |
--source include/big_test.inc |
| 6 |
|
| 7 |
call mtr.add_suppression("InnoDB: innodb_open_files=.* is exceeded"); |
| 8 |
|
| 9 |
SET @save_tdc= @@GLOBAL.table_definition_cache; |
| 10 |
SET @save_toc= @@GLOBAL.table_open_cache; |
| 11 |
|
| 12 |
# InnoDB plugin essentially ignores table_definition_cache size |
| 13 |
# and hard-wires it to 400, which also is the minimum allowed value. |
| 14 |
SET GLOBAL table_definition_cache= 400; |
| 15 |
SET GLOBAL table_open_cache= 1024; |
| 16 |
|
| 17 |
CREATE TABLE to_be_evicted(a INT PRIMARY KEY, b INT NOT NULL) ENGINE=InnoDB; |
| 18 |
INSERT INTO to_be_evicted VALUES(1,2),(2,1); |
| 19 |
|
| 20 |
connect(ddl,localhost,root,,); |
| 21 |
SET DEBUG_SYNC = 'row_log_apply_before SIGNAL scanned WAIT_FOR got_duplicate'; |
| 22 |
--send |
| 23 |
ALTER TABLE to_be_evicted ADD UNIQUE INDEX(b); |
| 24 |
|
| 25 |
connection default; |
| 26 |
SET DEBUG_SYNC = 'now WAIT_FOR scanned'; |
| 27 |
|
| 28 |
# During the ADD UNIQUE INDEX, start a transaction that inserts a duplicate |
| 29 |
# and then hogs the table lock, so that the unique index cannot be dropped. |
| 30 |
BEGIN; |
| 31 |
INSERT INTO to_be_evicted VALUES(3, 2); |
| 32 |
COMMIT; |
| 33 |
SET DEBUG_SYNC = 'now SIGNAL got_duplicate'; |
| 34 |
|
| 35 |
connection ddl; |
| 36 |
--error ER_DUP_ENTRY |
| 37 |
reap; |
| 38 |
|
| 39 |
disconnect ddl; |
| 40 |
connection default; |
| 41 |
# Release the table lock. |
| 42 |
COMMIT; |
| 43 |
SET DEBUG_SYNC = RESET; |
| 44 |
|
| 45 |
# Allow cache eviction. |
| 46 |
FLUSH TABLES; |
| 47 |
--disable_query_log |
| 48 |
|
| 49 |
# Pollute the cache with many tables, so that our table will be evicted. |
| 50 |
let $N=1000; |
| 51 |
let $loop=$N; |
| 52 |
while ($loop) |
| 53 |
{ |
| 54 |
eval CREATE TABLE t_$loop(id INT)ENGINE=InnoDB; |
| 55 |
dec $loop; |
| 56 |
} |
| 57 |
|
| 58 |
# Hopefully let InnoDB evict the tables. |
| 59 |
sleep 10; |
| 60 |
|
| 61 |
let $loop=$N; |
| 62 |
while ($loop) |
| 63 |
{ |
| 64 |
eval DROP TABLE t_$loop; |
| 65 |
dec $loop; |
| 66 |
} |
| 67 |
|
| 68 |
SET GLOBAL table_definition_cache= @save_tdc; |
| 69 |
SET GLOBAL table_open_cache= @save_toc; |
| 70 |
|
| 71 |
DROP TABLE to_be_evicted; |