File: lock_sys_resize.test

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (76 lines) | stat: -rw-r--r-- 2,846 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc

--echo # Bug #31329634 ASSERTION FAILURE:
--echo #    LOCK0LATCHES.CC:42:LOCK_SYS->REC_HASH->N_CELLS == LOCK_SYS->P

# The two values in master-opt were chosen so that the following
# SET GLOBAL innodb_buffer_pool_size= ...
# will succeed, and will resize lock_sys in parallel to the UPDATE.
# (As opposed to say, block, as is the case when it shrinks instead of growing)
# Also it must be larger than BUF_LRU_MIN_LEN pages, as otherwise BP shrink will
# not be able to finish as it will try to keep BUF_LRU_MIN_LEN pages in BP.
SELECT @@innodb_buffer_pool_size;
SELECT @@innodb_buffer_pool_chunk_size;

CREATE TABLE t1 (id INT PRIMARY KEY, val VARCHAR(1000)) ENGINE=INNODB;
INSERT INTO t1 (id,val) VALUES (1,''),(2,''),(3,''),(4,''),(5,'');


--connect (con1,localhost,root,,)
  SET DEBUG_SYNC='lock_rec_restore_from_page_infimum_will_latch
    SIGNAL con1_will_latch
    WAIT_FOR con1_can_go';
  # This will cause resize of records and require calls to
  # lock_rec_restore_from_page_infimum() which exercise Shard_latches_guard
  --send UPDATE t1 SET val='aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'

--connect (con2,localhost,root,,)
  SET DEBUG_SYNC='now WAIT_FOR con1_will_latch';
  # resize happens in a background thread so we need to enable sync point
  SET GLOBAL DEBUG='+d,syncpoint_after_lock_sys_resize_rec_hash';
  SET GLOBAL innodb_buffer_pool_size=
    @@innodb_buffer_pool_size * 2 + @@innodb_buffer_pool_chunk_size;

--connection default
  SET DEBUG_SYNC='now WAIT_FOR reached_after_lock_sys_resize_rec_hash';
  SET DEBUG_SYNC='now SIGNAL con1_can_go';
  # This is the moment where con1 could observe assertion failure
  SET GLOBAL DEBUG='-d,syncpoint_after_lock_sys_resize_rec_hash';
  SET DEBUG_SYNC='now SIGNAL continue_after_lock_sys_resize_rec_hash';

--connection con1
  --reap


--connection default
--disconnect con1
--disconnect con2

DROP TABLE t1;

# Make sure we finish previous resizing before issuing another
let $wait_timeout = 60;
let $wait_condition =
  SELECT SUBSTR(variable_value, 1, 9) = 'Completed'
  FROM performance_schema.global_status
  WHERE variable_name = 'innodb_buffer_pool_resize_status';
--source include/wait_condition.inc

SELECT @@innodb_buffer_pool_size;

# Restore original smaller size
SET GLOBAL innodb_buffer_pool_size=
  (@@innodb_buffer_pool_size - @@innodb_buffer_pool_chunk_size) div 2;
# Make sure we finish resizing and restore original state before ending
let $wait_timeout = 60;
let $wait_condition =
  SELECT SUBSTR(variable_value, 1, 9) = 'Completed'
  FROM performance_schema.global_status
  WHERE variable_name = 'innodb_buffer_pool_resize_status';
--source include/wait_condition.inc

SELECT @@innodb_buffer_pool_size;

--source include/wait_until_count_sessions.inc