summaryrefslogtreecommitdiff
path: root/mysql-test/main/events_skip_grant_tables.result
diff options
context:
space:
mode:
authorDaniel Lenski <dlenski@amazon.com>2023-03-09 10:39:29 -0800
committerDaniel Black <daniel@mariadb.org>2023-04-27 15:28:24 +1000
commit3ef111610b7f8a6a323975cfdf4a4257feb9dcd9 (patch)
tree46eeb1e7f058023b0f2d0072bb77f52551e1d0de /mysql-test/main/events_skip_grant_tables.result
parent7321c71aa187ac55a248e68142df5606249a556e (diff)
downloadmariadb-git-3ef111610b7f8a6a323975cfdf4a4257feb9dcd9.tar.gz
[MDEV-29827] Clear error when --event-scheduler=ON is combined with --skip-grant-tables
When the server is started with `--event-scheduler=ON` and with `--skip-grant-tables` (or built as embedded server which has no grant tables at all), the event scheduler *appears* to be enabled (`SELECT @@global.event_scheduler` returns `'ON'`), but attempting to manipulate it in any way returns a misleading error message: "Cannot proceed, because event scheduler is disabled" Possible solutions: 1. Fast-fail: fail immediately on startup if `EVENT_SCHEDULER` is set to any value other than `DISABLED` when starting up without grant tables, then prevent `SET GLOBAL event_scheduler` while running. Problem: there are existing setup scripts and code which start with this combination and assume it will not fail. 2. Warn and change value: if `EVENT_SCHEDULER` is set to any value other than `DISABLED` when starting, print a warning and change it immediately to `DISABLED`. Advantage: The value of the `EVENT_SCHEDULER` system variable after startup will be consistent with its functional unavailability. 3. Display a clear error: if `EVENT_SCHEDULER` is enabled, but grant tables are not enabled, then ensure error messages clearly explain the fact that the combination is not supported. Advantage: The error message encountered by the end user when attempting to manipulate the event scheduler (such as `CREATE EVENT`) is clear and explicit. This commit implements the combination of solutions (2) and (3): it will set `EVENT_SCHEDULER=DISABLED` on startup (reflecting the functional reality) and it will print a startup warning, *and* it will print a *distinct* error message each time that an end user attempts to manipulate the event scheduler, so that the end user will clearly understand the problem even if the startup messages are not visible at that point. It also adds an MTR test `main.events_skip_grant_tables` to verify the expected behavior, and the unmodified `main.events_restart` test continues to demonstrate no change in the error message when the event scheduler is non-functional for *different* reasons. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services
Diffstat (limited to 'mysql-test/main/events_skip_grant_tables.result')
-rw-r--r--mysql-test/main/events_skip_grant_tables.result8
1 files changed, 8 insertions, 0 deletions
diff --git a/mysql-test/main/events_skip_grant_tables.result b/mysql-test/main/events_skip_grant_tables.result
new file mode 100644
index 00000000000..2bd2e383a23
--- /dev/null
+++ b/mysql-test/main/events_skip_grant_tables.result
@@ -0,0 +1,8 @@
+call mtr.add_suppression("Event Scheduler will not function when starting with --skip-grant-tables or --bootstrap.");
+CREATE EVENT test ON SCHEDULE AT CURRENT_TIMESTAMP DO DO NULL;
+ERROR HY000: Event scheduler cannot function with --skip-grant-tables, --bootstrap, or embedded build
+select (@@global.event_scheduler='DISABLED') as expect_1;
+expect_1
+1
+set global event_scheduler=1;
+ERROR HY000: The MariaDB server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement