Commit 2b2fb674 authored by unknown's avatar unknown

Bug#26807 "set global event_scheduler=1" and --skip-grant-tables crashes server

- Crash occured because Event engine is only initialized if
  ACLs are used but not properly marked as disabled.
- The patch is to mark the Event engine as DISABLED if no ACLs
  are used to avoid access of uninitialized variables.


mysql-test/r/skip_grants.result:
  Added test case
mysql-test/t/skip_grants.test:
  Added test case
parent 46928246
...@@ -58,3 +58,5 @@ DROP PROCEDURE p3; ...@@ -58,3 +58,5 @@ DROP PROCEDURE p3;
DROP FUNCTION f1; DROP FUNCTION f1;
DROP FUNCTION f2; DROP FUNCTION f2;
DROP FUNCTION f3; DROP FUNCTION f3;
set global event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED or --skip-grant-tables option so it cannot execute this statement
...@@ -108,3 +108,10 @@ DROP PROCEDURE p3; ...@@ -108,3 +108,10 @@ DROP PROCEDURE p3;
DROP FUNCTION f1; DROP FUNCTION f1;
DROP FUNCTION f2; DROP FUNCTION f2;
DROP FUNCTION f3; DROP FUNCTION f3;
#
# Bug #26807 "set global event_scheduler=1" and --skip-grant-tables crashes server
#
--error ER_OPTION_PREVENTS_STATEMENT
set global event_scheduler=1;
...@@ -3691,6 +3691,7 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3691,6 +3691,7 @@ we force server id to 2, but this MySQL server will not act as a slave.");
udf_init(); udf_init();
#endif #endif
} }
init_status_vars(); init_status_vars();
if (opt_bootstrap) /* If running with bootstrap, do not start replication. */ if (opt_bootstrap) /* If running with bootstrap, do not start replication. */
opt_skip_slave_start= 1; opt_skip_slave_start= 1;
...@@ -3737,6 +3738,10 @@ we force server id to 2, but this MySQL server will not act as a slave."); ...@@ -3737,6 +3738,10 @@ we force server id to 2, but this MySQL server will not act as a slave.");
if (Events::get_instance()->init()) if (Events::get_instance()->init())
unireg_abort(1); unireg_abort(1);
} }
else
{
Events::opt_event_scheduler = Events::EVENTS_DISABLED;
}
/* Signal threads waiting for server to be started */ /* Signal threads waiting for server to be started */
pthread_mutex_lock(&LOCK_server_started); pthread_mutex_lock(&LOCK_server_started);
......
...@@ -3990,7 +3990,7 @@ sys_var_event_scheduler::update(THD *thd, set_var *var) ...@@ -3990,7 +3990,7 @@ sys_var_event_scheduler::update(THD *thd, set_var *var)
DBUG_ENTER("sys_var_event_scheduler::update"); DBUG_ENTER("sys_var_event_scheduler::update");
if (Events::opt_event_scheduler == Events::EVENTS_DISABLED) if (Events::opt_event_scheduler == Events::EVENTS_DISABLED)
{ {
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED"); my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED or --skip-grant-tables");
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment