[MDEV-21780] event_scheduler system variable's usage message doesn't mention the possible value "ORIGINAL" Created: 2020-02-19  Updated: 2023-04-27

Status: Open
Project: MariaDB Server
Component/s: Events, Variables
Affects Version/s: 10.1.44, 10.2.31, 10.3.22, 10.4.12
Fix Version/s: 10.4

Type: Bug Priority: Major
Reporter: Geoff Montee (Inactive) Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-21782 lower_case_table_names system variabl... Open

 Description   

The event_scheduler system variable supports the values: OFF, ON, DISABLED, and ORIGINAL. We can see that from the following code:

static const char *event_scheduler_names[]= { "OFF", "ON", "DISABLED",
                                              "ORIGINAL", NullS };

https://github.com/MariaDB/server/blob/mariadb-10.4.12/sql/sys_vars.cc#L1010

According to the source code, the value ORIGINAL means that the value should revert back to the startup state:

  /* EVENTS_ORIGINAL means we should revert back to the startup state */
  if (opt_event_scheduler_value == Events::EVENTS_ORIGINAL)
  {
    opt_event_scheduler_value= Events::opt_event_scheduler=
      Events::startup_state;
  }

https://github.com/MariaDB/server/blob/mariadb-10.4.12/sql/sys_vars.cc#L1049

This can be easily confirmed by performing a simple test:

MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.002 sec)
 
MariaDB [(none)]> SET GLOBAL event_scheduler=ON;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.001 sec)
 
MariaDB [(none)]> SET GLOBAL event_scheduler=ORIGINAL;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.001 sec)

Unfortunately, the ORIGINAL value is not mentioned in the variable's usage message:

MariaDB [(none)]> SELECT VARIABLE_COMMENT FROM information_schema.SYSTEM_VARIABLES WHERE VARIABLE_NAME='event_scheduler';
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| VARIABLE_COMMENT                                                                                                                                         |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
| Enable the event scheduler. Possible values are ON, OFF, and DISABLED (keep the event scheduler completely deactivated, it cannot be activated run-time) |
+----------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

The usage message should be changed to mention this value, and it should describe what the value does.



 Comments   
Comment by Sergei Golubchik [ 2020-02-20 ]

is it any different in behavior from DEFAULT?

Comment by Geoff Montee (Inactive) [ 2020-02-20 ]

Hi serg,

Yes, the behavior of the ORIGINAL value is quite different from the behavior of the DEFAULT value. See the following example:

[ec2-user@ip-172-30-0-123 ~]$ sudo tee /etc/my.cnf.d/event_scheduler.cnf <<EOF
> [mariadb]
> event_scheduler=ON
> EOF
[mariadb]
event_scheduler=ON
[ec2-user@ip-172-30-0-123 ~]$ sudo systemctl start mariadb
[ec2-user@ip-172-30-0-123 ~]$ sudo mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 10.4.11-5-MariaDB-enterprise-log MariaDB Enterprise Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.001 sec)
 
MariaDB [(none)]> SET GLOBAL event_scheduler=OFF;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.001 sec)
 
MariaDB [(none)]> SET GLOBAL event_scheduler=ORIGINAL;
Query OK, 0 rows affected (0.000 sec)
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | ON    |
+-----------------+-------+
1 row in set (0.001 sec)
 
MariaDB [(none)]> SET GLOBAL event_scheduler=DEFAULT;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> SHOW GLOBAL VARIABLES LIKE 'event_scheduler';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| event_scheduler | OFF   |
+-----------------+-------+
1 row in set (0.001 sec)

Generated at Thu Feb 08 09:09:44 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.