| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
|
| 4 |
CREATE TABLE t1 ( |
| 5 |
id INT PRIMARY KEY |
| 6 |
); |
| 7 |
INSERT INTO t1 (id) VALUES (1); |
| 8 |
|
| 9 |
--let $i=0 |
| 10 |
--let $k=4 |
| 11 |
while($i < $k){ |
| 12 |
INSERT INTO t1 (id) SELECT (SELECT MAX(id) FROM t1)+id FROM t1; |
| 13 |
--inc $i |
| 14 |
} |
| 15 |
|
| 16 |
CREATE TABLE t2 ( |
| 17 |
id INT PRIMARY KEY, |
| 18 |
c1 CHAR(250) NOT NULL DEFAULT 'a', |
| 19 |
c2 CHAR(250) NOT NULL DEFAULT 'a', |
| 20 |
c3 CHAR(250) NOT NULL DEFAULT 'a', |
| 21 |
c4 CHAR(250) NOT NULL DEFAULT 'a', |
| 22 |
c5 CHAR(250) NOT NULL DEFAULT 'a', |
| 23 |
c6 CHAR(250) NOT NULL DEFAULT 'a', |
| 24 |
c7 CHAR(250) NOT NULL DEFAULT 'a', |
| 25 |
c8 CHAR(250) NOT NULL DEFAULT 'a', |
| 26 |
c9 CHAR(250) NOT NULL DEFAULT 'a' |
| 27 |
); |
| 28 |
INSERT INTO t2 (id) SELECT id FROM t1; |
| 29 |
|
| 30 |
--let $restart_parameters=restart: --innodb_page_size=4k --innodb_buffer_pool_chunk_size=1048576 --innodb-buffer-pool-instances=1 --innodb-buffer-pool-size=6M |
| 31 |
--source include/restart_mysqld.inc |
| 32 |
|
| 33 |
--echo # Populate the buffer pool with pages |
| 34 |
SELECT COUNT(*) FROM t2; |
| 35 |
|
| 36 |
--echo # Connect now before updating the global system variable |
| 37 |
--connect (conn2,localhost,root,,) |
| 38 |
|
| 39 |
# This is required here because of the `global_system_variables` |
| 40 |
# object which is protected using `LOCK_global_system_variables` |
| 41 |
# mutex. Ongoing update of the global variable will hold the |
| 42 |
# mutex until completion - making the new sessions wait for it |
| 43 |
|
| 44 |
# The code paths where the mutex is acquired: |
| 45 |
# 1. A new session is started: |
| 46 |
# New session's THD::init (via plugin_thdvar_init) reads object |
| 47 |
# 2. A global variable is updated: |
| 48 |
# sys_var::update updates the object's members |
| 49 |
|
| 50 |
--connect (conn1,localhost,root,,) |
| 51 |
SET DEBUG_SYNC='buf_pool_clear_hash_index_will_process_block SIGNAL found_block WAIT_FOR process_block'; |
| 52 |
SET GLOBAL DEBUG="+d,buf_pool_clear_hash_index_check_other_blocks"; |
| 53 |
--send SET GLOBAL innodb_adaptive_hash_index=OFF |
| 54 |
|
| 55 |
--connection conn2 |
| 56 |
SET DEBUG_SYNC='now WAIT_FOR found_block'; |
| 57 |
BEGIN; |
| 58 |
SELECT COUNT(*) FROM t2 FOR SHARE; |
| 59 |
|
| 60 |
--connection default |
| 61 |
--echo # Wait for sometime to allow conn2 to bring new pages to the buffer pool |
| 62 |
--sleep 5 |
| 63 |
SET DEBUG_SYNC='now SIGNAL process_block'; |
| 64 |
|
| 65 |
--connection conn1 |
| 66 |
--reap |
| 67 |
|
| 68 |
--connection conn2 |
| 69 |
COMMIT; |
| 70 |
|
| 71 |
--connection default |
| 72 |
SET GLOBAL DEBUG="-d,buf_pool_clear_hash_index_check_other_blocks"; |
| 73 |
|
| 74 |
--let $restart_parameters=restart: |
| 75 |
--source include/restart_mysqld.inc |
| 76 |
|
| 77 |
DROP TABLE t1; |
| 78 |
DROP TABLE t2; |