Debian Codegraph @

mysql-test/suite/innodb/t/mon_lock_wait_current_count.test

raw
1 # Check if lock_row_lock_current_waits counter in
2 # information_schema.innodb_metrics does not become negative after disabling,
3 # resetting and enabling.
4
5 --source include/have_innodb.inc
6 --source include/have_debug.inc
7 --source include/count_sessions.inc
8
9 --connect (prevent_purge,localhost,root,,)
10 START TRANSACTION WITH CONSISTENT SNAPSHOT;
11
12 --connection default
13 # lock_row_lock_time_avg is filled under lock_sys.wait_mutex lock, which
14 # will be held by connection 2, that is why the following SELECT
15 # from information_schema.innodb_metrics will be blocked.
16 #
17 # And setting innodb_monitor_disable=all causes innodb monitor enabling
18 # status changing. The status will not be restored to default value even
19 # after
20 # -----------------------
21 # SET GLOBAL innodb_monitor_reset_all=default;
22 # SET GLOBAL innodb_monitor_enable=default;
23 # -----------------------
24 # execution. See MDEV-32553 for details.
25 #
26 # All monitors disabling, i.e. "innodb_monitor_disable=all" causes
27 # innodb.monitor test failure due to MDEV-32553. 10.5 is not affected, as
28 # innodb.monitor differs there.
29 #
30 # Disable not all monitors at the beggining of the test,
31 # but only the monitor, which causes hanging, i.e. lock_row_lock_time_avg.
32 SET GLOBAL innodb_monitor_disable='lock_row_lock_time_avg';
33 # 'lock_row_lock_current_waits' should be enabled by default;
34 CREATE TABLE `t` (a INT PRIMARY KEY) engine=InnoDB STATS_PERSISTENT=0;
35 INSERT INTO t VALUES (5);
36 SELECT name, count FROM information_schema.innodb_metrics
37 WHERE name ='lock_row_lock_current_waits';
38
39 --connect (con1,localhost,root,,)
40 BEGIN;
41 SELECT * FROM t FOR UPDATE;
42
43 --connect (con2,localhost,root,,)
44 SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL blocked WAIT_FOR cont";
45 BEGIN;
46 --send SELECT * FROM t FOR UPDATE
47
48 --connection default
49 SET DEBUG_SYNC="now WAIT_FOR blocked";
50 SELECT name, count FROM information_schema.innodb_metrics
51 WHERE name ='lock_row_lock_current_waits';
52 SET GLOBAL innodb_monitor_disable='lock_row_lock_current_waits';
53 SET GLOBAL innodb_monitor_reset_all='lock_row_lock_current_waits';
54 SET GLOBAL innodb_monitor_enable='lock_row_lock_current_waits';
55 ######################################
56 # Equals to zero if the bug is not fixed, as MONITOR_DISPLAY_CURRENT is not
57 # set for this counter and its value is reset during previous
58 # "SET GLOBAL innodb_monitor_reset_all='lock_row_lock_current_waits'" execution.
59 #####
60 SELECT name, count FROM information_schema.innodb_metrics
61 WHERE name ='lock_row_lock_current_waits';
62 SET DEBUG_SYNC="now SIGNAL cont";
63
64 --disconnect con1
65
66 --connection con2
67 --reap
68 COMMIT;
69 --disconnect con2
70
71 --connection default
72 SET DEBUG_SYNC="reset";
73 ######################################
74 # Equals to -1 if the bug is not fixed. I.e.
75 # innodb_counter_value[MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT].mon_start_value is
76 # set to 1 during
77 # "set global innodb_monitor_disable='lock_row_lock_current_waits'" execution,
78 # and the value is counted as
79 # (value = 0) - (mon_value_reset = 0) - (mon_start_value = 1) +
80 # (mon_last_value = 0) = -1. See MONITOR_SET_DIFF() macro in
81 # srv_mon_process_existing_counter() for details.
82 #####
83 SELECT name, count FROM information_schema.innodb_metrics
84 WHERE name ='lock_row_lock_current_waits';
85 DROP TABLE `t`;
86 SET GLOBAL innodb_monitor_disable='lock_row_lock_current_waits';
87 SET GLOBAL innodb_monitor_reset_all='lock_row_lock_current_waits';
88 SET GLOBAL innodb_monitor_enable='lock_row_lock_current_waits';
89 # TODO: remove it when MDEV-32553 is fixed
90 SET GLOBAL innodb_monitor_enable='lock_row_lock_time_avg';
91 --disable_warnings
92 SET GLOBAL innodb_monitor_disable=default;
93 SET GLOBAL innodb_monitor_reset_all=default;
94 SET GLOBAL innodb_monitor_enable=default;
95 --enable_warnings
96 --disconnect prevent_purge
97 --source include/wait_until_count_sessions.inc