Bug #84065 innodb_monitor_enable and innodb_monitor_disable do not clear each other

Submitted: 5 Dec 2016 22:41 Modified: 6 Dec 2016 11:36
Reporter: Bradley Mickel Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6/5.7/8.0 OS:Any
Assigned to: CPU Architecture:Any

[5 Dec 2016 22:41] Bradley Mickel
Description:
When updating the global variables the previous item is not adjusted, so they both may say 'all'.

select @@version, @@innodb_monitor_enable, @@innodb_monitor_disable;
+------------+-------------------------+--------------------------+
| @@version  | @@innodb_monitor_enable | @@innodb_monitor_disable |
+------------+-------------------------+--------------------------+
| 5.6.28-log | all                     | all                      |
+------------+-------------------------+--------------------------+

Without going to the status field of the INFORMATION_SCHEMA.INNODB_METRICS table there is no way to know which variable is correct. Whichever was updated last will take precedence.

How to repeat:
db2 (none)> set global innodb_monitor_disable='all';
Query OK, 0 rows affected (0.00 sec)

db2 (none)>set global innodb_monitor_enable='all';
Query OK, 0 rows affected (0.00 sec)

db2 (none)>select @@innodb_monitor_enable, @@innodb_monitor_disable;

+-------------------------+--------------------------+
| @@innodb_monitor_enable | @@innodb_monitor_disable |
+-------------------------+--------------------------+
| all                     | all                      |
+-------------------------+--------------------------+
1 row in set (0.00 sec)

db2 (none)>select distinct status from INFORMATION_SCHEMA.INNODB_METRICS;

+---------+
| status  |
+---------+
| enabled |
+---------+
1 row in set (0.01 sec)

db2 (none)> set global innodb_monitor_disable='all';
Query OK, 0 rows affected (0.00 sec)

db2 (none)>select @@innodb_monitor_enable, @@innodb_monitor_disable;

+-------------------------+--------------------------+
| @@innodb_monitor_enable | @@innodb_monitor_disable |
+-------------------------+--------------------------+
| all                     | all                      |
+-------------------------+--------------------------+
1 row in set (0.00 sec)

db2 (none)>select distinct status from INFORMATION_SCHEMA.INNODB_METRICS;

+---------+
| status  |
+---------+
| disabled |
+---------+
1 row in set (0.01 sec)

Suggested fix:
When updating one of the variables to all, if the same thing is in the other variable then set it to NULL
[6 Dec 2016 11:36] MySQL Verification Team
Thank you for the bug report. Verified as described.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.