| 1 |
--source include/have_debug_sync.inc |
| 2 |
--source include/have_innodb_16k.inc |
| 3 |
|
| 4 |
# This test was useful when developing |
| 5 |
# Bug #29024344 QUERY ON PERFORMANCE_SCHEMA.DATA_LOCKS CAUSES REPLICATION ISSUES |
| 6 |
# I realize it is fragile as it depends on the hash function we use to assign |
| 7 |
# pages to hash table cells - the test hopes that the resizing of the buffer |
| 8 |
# pool will cause resizing of lock sys and further that it will map the page |
| 9 |
# with locks to a cell with larger id than before. |
| 10 |
# Feel free to entirely remove this test if it causes any trouble to maintain. |
| 11 |
# It did it's job already. |
| 12 |
|
| 13 |
CREATE TABLE t1 ( |
| 14 |
id INT PRIMARY KEY |
| 15 |
) ENGINE=InnoDB; |
| 16 |
|
| 17 |
INSERT INTO t1 VALUES (1),(2),(3); |
| 18 |
|
| 19 |
--connect (con1,localhost,root,,) |
| 20 |
BEGIN; |
| 21 |
SELECT * FROM t1 FOR UPDATE; |
| 22 |
SET DEBUG_SYNC = |
| 23 |
'all_locks_iterator_found_record_lock SIGNAL found WAIT_FOR resized'; |
| 24 |
# We expect that there should be exactly one lock of a given mode for this |
| 25 |
# transaction on a particular row. However as soon as first lock is reported |
| 26 |
# we will resize the lock sys causing reshuffling of the hash table used to |
| 27 |
# store locks, which might confuse a buggy implementation, and cause it to |
| 28 |
# report the same locks twice. |
| 29 |
--send |
| 30 |
SELECT COUNT(1) FROM performance_schema.data_locks |
| 31 |
WHERE object_name='t1' |
| 32 |
AND engine='INNODB' |
| 33 |
AND lock_mode='X' |
| 34 |
AND lock_data='1' |
| 35 |
AND lock_status='GRANTED'; |
| 36 |
|
| 37 |
--connection default |
| 38 |
SET DEBUG_SYNC = 'now WAIT_FOR found'; |
| 39 |
|
| 40 |
let $wait_timeout = 180; |
| 41 |
let $wait_condition = |
| 42 |
SELECT SUBSTR(variable_value, 1, 34) = 'Completed resizing buffer pool at ' |
| 43 |
FROM performance_schema.global_status |
| 44 |
WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; |
| 45 |
|
| 46 |
--disable_query_log |
| 47 |
set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; |
| 48 |
set @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; |
| 49 |
--enable_query_log |
| 50 |
|
| 51 |
set global innodb_adaptive_hash_index=ON; |
| 52 |
|
| 53 |
select @@innodb_buffer_pool_size; |
| 54 |
|
| 55 |
# Expand buffer pool, more than twice to trigger lock_sys_resize() |
| 56 |
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size*3; |
| 57 |
|
| 58 |
--source include/wait_condition.inc |
| 59 |
|
| 60 |
SET DEBUG_SYNC = 'now SIGNAL resized'; |
| 61 |
|
| 62 |
|
| 63 |
--connection con1 |
| 64 |
--reap |
| 65 |
|
| 66 |
--connection default |
| 67 |
--disconnect con1 |
| 68 |
|
| 69 |
--disable_query_log |
| 70 |
set global innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; |
| 71 |
set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; |
| 72 |
--enable_query_log |
| 73 |
--source include/wait_condition.inc |
| 74 |
|
| 75 |
DROP TABLE t1; |
| 76 |
|
| 77 |
|
| 78 |
|