| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
--source include/count_sessions.inc |
| 4 |
|
| 5 |
--echo # Bug #31329634 ASSERTION FAILURE: |
| 6 |
--echo # LOCK0LATCHES.CC:42:LOCK_SYS->REC_HASH->N_CELLS == LOCK_SYS->P |
| 7 |
|
| 8 |
# The two values in master-opt were chosen so that the following |
| 9 |
# SET GLOBAL innodb_buffer_pool_size= ... |
| 10 |
# will succeed, and will resize lock_sys in parallel to the UPDATE. |
| 11 |
# (As opposed to say, block, as is the case when it shrinks instead of growing) |
| 12 |
# Also it must be larger than BUF_LRU_MIN_LEN pages, as otherwise BP shrink will |
| 13 |
# not be able to finish as it will try to keep BUF_LRU_MIN_LEN pages in BP. |
| 14 |
SELECT @@innodb_buffer_pool_size; |
| 15 |
SELECT @@innodb_buffer_pool_chunk_size; |
| 16 |
|
| 17 |
CREATE TABLE t1 (id INT PRIMARY KEY, val VARCHAR(1000)) ENGINE=INNODB; |
| 18 |
INSERT INTO t1 (id,val) VALUES (1,''),(2,''),(3,''),(4,''),(5,''); |
| 19 |
|
| 20 |
|
| 21 |
--connect (con1,localhost,root,,) |
| 22 |
SET DEBUG_SYNC='lock_rec_restore_from_page_infimum_will_latch |
| 23 |
SIGNAL con1_will_latch |
| 24 |
WAIT_FOR con1_can_go'; |
| 25 |
# This will cause resize of records and require calls to |
| 26 |
# lock_rec_restore_from_page_infimum() which exercise Shard_latches_guard |
| 27 |
--send UPDATE t1 SET val='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' |
| 28 |
|
| 29 |
--connect (con2,localhost,root,,) |
| 30 |
SET DEBUG_SYNC='now WAIT_FOR con1_will_latch'; |
| 31 |
# resize happens in a background thread so we need to enable sync point |
| 32 |
SET GLOBAL DEBUG='+d,syncpoint_after_lock_sys_resize_rec_hash'; |
| 33 |
SET GLOBAL innodb_buffer_pool_size= |
| 34 |
@@innodb_buffer_pool_size * 2 + @@innodb_buffer_pool_chunk_size; |
| 35 |
|
| 36 |
--connection default |
| 37 |
SET DEBUG_SYNC='now WAIT_FOR reached_after_lock_sys_resize_rec_hash'; |
| 38 |
SET DEBUG_SYNC='now SIGNAL con1_can_go'; |
| 39 |
# This is the moment where con1 could observe assertion failure |
| 40 |
SET GLOBAL DEBUG='-d,syncpoint_after_lock_sys_resize_rec_hash'; |
| 41 |
SET DEBUG_SYNC='now SIGNAL continue_after_lock_sys_resize_rec_hash'; |
| 42 |
|
| 43 |
--connection con1 |
| 44 |
--reap |
| 45 |
|
| 46 |
|
| 47 |
--connection default |
| 48 |
--disconnect con1 |
| 49 |
--disconnect con2 |
| 50 |
|
| 51 |
DROP TABLE t1; |
| 52 |
|
| 53 |
# Make sure we finish previous resizing before issuing another |
| 54 |
let $wait_timeout = 60; |
| 55 |
let $wait_condition = |
| 56 |
SELECT SUBSTR(variable_value, 1, 9) = 'Completed' |
| 57 |
FROM performance_schema.global_status |
| 58 |
WHERE variable_name = 'innodb_buffer_pool_resize_status'; |
| 59 |
--source include/wait_condition.inc |
| 60 |
|
| 61 |
SELECT @@innodb_buffer_pool_size; |
| 62 |
|
| 63 |
# Restore original smaller size |
| 64 |
SET GLOBAL innodb_buffer_pool_size= |
| 65 |
(@@innodb_buffer_pool_size - @@innodb_buffer_pool_chunk_size) div 2; |
| 66 |
# Make sure we finish resizing and restore original state before ending |
| 67 |
let $wait_timeout = 60; |
| 68 |
let $wait_condition = |
| 69 |
SELECT SUBSTR(variable_value, 1, 9) = 'Completed' |
| 70 |
FROM performance_schema.global_status |
| 71 |
WHERE variable_name = 'innodb_buffer_pool_resize_status'; |
| 72 |
--source include/wait_condition.inc |
| 73 |
|
| 74 |
SELECT @@innodb_buffer_pool_size; |
| 75 |
|
| 76 |
--source include/wait_until_count_sessions.inc |