From: Date: May 7 2008 2:57pm Subject: bk commit into 5.1 tree (thek:1.2605) BUG#35997 List-Archive: http://lists.mysql.com/commits/46452 X-Bug: 35997 Message-Id: <20080507125728.BAF344AC5AA@Adventure> Below is the list of changes that have just been committed into a local 5.1 repository of thek. When thek does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet@stripped, 2008-05-07 14:57:23+02:00, thek@adventure.(none) +9 -0 Bug#35997 Event scheduler seems to let the server crash, if it is embedded. The event scheduler was not designed to work in embedded mode. This patch disables the system variable 'event_scheduler' used to activate the event scheduler when the server is compiled in embedded mode. mysql-test/r/events_embedded.result@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +2 -0 Add test case to make sure the 'event_scheduler' can't be activated in embedded mode. mysql-test/r/events_embedded.result@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +0 -0 mysql-test/r/is_embedded.require@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +2 -0 Add test case to make sure the 'event_scheduler' can't be activated in embedded mode. mysql-test/r/is_embedded.require@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +0 -0 mysql-test/t/events_embedded.test@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +5 -0 Add test case to make sure the 'event_scheduler' can't be activated in embedded mode. mysql-test/t/events_embedded.test@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +0 -0 mysql-test/t/events_trans.test@stripped, 2008-05-07 14:57:20+02:00, thek@adventure.(none) +2 -0 Disable test if run in embedded mode. sql/events.cc@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +14 -2 Disable the event_scheduler system variable if the server is compiled in embedded mode. sql/mysqld.cc@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +4 -0 Disable the event_scheduler system variable if the server is compiled in embedded mode. sql/set_var.cc@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +5 -3 Disable the event_scheduler system variable if the server is compiled in embedded mode. sql/set_var.h@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +2 -1 Disable the event_scheduler system variable if the server is compiled in embedded mode. sql/sql_parse.cc@stripped, 2008-05-07 14:57:21+02:00, thek@adventure.(none) +12 -0 Disable the event_scheduler system variable if the server is compiled in embedded mode. diff -Nrup a/mysql-test/r/events_embedded.result b/mysql-test/r/events_embedded.result --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/r/events_embedded.result 2008-05-07 14:57:21 +02:00 @@ -0,0 +1,2 @@ +set global event_scheduler=ON; +ERROR HY000: Unknown system variable 'event_scheduler' diff -Nrup a/mysql-test/r/is_embedded.require b/mysql-test/r/is_embedded.require --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/r/is_embedded.require 2008-05-07 14:57:21 +02:00 @@ -0,0 +1,2 @@ +have_embedded +1 diff -Nrup a/mysql-test/t/events_embedded.test b/mysql-test/t/events_embedded.test --- /dev/null Wed Dec 31 16:00:00 196900 +++ b/mysql-test/t/events_embedded.test 2008-05-07 14:57:21 +02:00 @@ -0,0 +1,5 @@ +--source include/is_embedded.inc + +--error 1193 +set global event_scheduler=ON; + diff -Nrup a/mysql-test/t/events_trans.test b/mysql-test/t/events_trans.test --- a/mysql-test/t/events_trans.test 2007-05-26 16:36:32 +02:00 +++ b/mysql-test/t/events_trans.test 2008-05-07 14:57:20 +02:00 @@ -2,6 +2,8 @@ # Tests that require transactions # -- source include/have_innodb.inc +-- source include/not_embedded.inc + --disable_warnings drop database if exists events_test; drop database if exists mysqltest_no_such_database; diff -Nrup a/sql/events.cc b/sql/events.cc --- a/sql/events.cc 2008-02-22 16:20:03 +01:00 +++ b/sql/events.cc 2008-05-07 14:57:21 +02:00 @@ -843,7 +843,13 @@ Events::fill_schema_events(THD *thd, TAB DBUG_RETURN(ret); } - +#ifdef EMBEDDED_LIBRARY +bool +Events::init(my_bool opt_noacl) +{ + opt_event_scheduler= EVENTS_DISABLED; +} +#else /* Inits the scheduler's structures. @@ -861,6 +867,7 @@ Events::fill_schema_events(THD *thd, TAB bool Events::init(my_bool opt_noacl) { + THD *thd; bool res= FALSE; @@ -953,7 +960,7 @@ end: DBUG_RETURN(res); } - +#endif /* Cleans up scheduler's resources. Called at server shutdown. @@ -1075,8 +1082,13 @@ Events::switch_event_scheduler_state(enu if (opt_event_scheduler == EVENTS_DISABLED) { +#ifdef EMBEDDED_LIBRARY + my_error(ER_OPTION_PREVENTS_STATEMENT, + MYF(0), "embedded server"); +#else my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--event-scheduler=DISABLED or --skip-grant-tables"); +#endif ret= TRUE; goto end; } diff -Nrup a/sql/mysqld.cc b/sql/mysqld.cc --- a/sql/mysqld.cc 2008-04-02 00:42:29 +02:00 +++ b/sql/mysqld.cc 2008-05-07 14:57:21 +02:00 @@ -7831,8 +7831,12 @@ mysqld_get_one_option(int optid, } #endif case OPT_EVENT_SCHEDULER: +#ifdef EMBEDDED_SERVER + sql_perror("Event scheduler is not supported in embedded built."); +#endif if (Events::set_opt_event_scheduler(argument)) exit(1); +#endif break; case (int) OPT_SKIP_NEW: opt_specialflag|= SPECIAL_NO_NEW_FUNC; diff -Nrup a/sql/set_var.cc b/sql/set_var.cc --- a/sql/set_var.cc 2008-04-01 11:03:06 +02:00 +++ b/sql/set_var.cc 2008-05-07 14:57:21 +02:00 @@ -241,7 +241,10 @@ static sys_var_long_ptr sys_delayed_inse static sys_var_long_ptr sys_delayed_queue_size(&vars, "delayed_queue_size", &delayed_queue_size); +#ifndef EMBEDDED_LIBRARY static sys_var_event_scheduler sys_event_scheduler(&vars, "event_scheduler"); +#endif + static sys_var_long_ptr sys_expire_logs_days(&vars, "expire_logs_days", &expire_logs_days); static sys_var_bool_ptr sys_flush(&vars, "flush", &myisam_flush); @@ -4026,13 +4029,12 @@ uchar *sys_var_thd_dbug::value_ptr(THD * return (uchar*) thd->strdup(buf); } - +#ifndef EMBEDDED_LIBRARY bool sys_var_event_scheduler::check(THD *thd, set_var *var) { return check_enum(thd, var, &Events::var_typelib); } - /* The update method of the global variable event_scheduler. If event_scheduler is switched from 0 to 1 then the scheduler main @@ -4071,7 +4073,7 @@ uchar *sys_var_event_scheduler::value_pt { return (uchar *) Events::get_opt_event_scheduler_str(); } - +#endif /**************************************************************************** Used templates diff -Nrup a/sql/set_var.h b/sql/set_var.h --- a/sql/set_var.h 2008-03-25 15:20:36 +01:00 +++ b/sql/set_var.h 2008-05-07 14:57:21 +02:00 @@ -1085,7 +1085,7 @@ public: virtual void set_default(THD *thd, enum_var_type type); }; - +#ifndef EMBEDDED_LIBRARY class sys_var_event_scheduler :public sys_var_long_ptr { /* We need a derived class only to have a warn_deprecated() */ @@ -1101,6 +1101,7 @@ public: return type != STRING_RESULT && type != INT_RESULT; } }; +#endif extern void fix_binlog_format_after_update(THD *thd, enum_var_type type); diff -Nrup a/sql/sql_parse.cc b/sql/sql_parse.cc --- a/sql/sql_parse.cc 2008-04-29 05:03:14 +02:00 +++ b/sql/sql_parse.cc 2008-05-07 14:57:21 +02:00 @@ -3483,6 +3483,10 @@ end_with_restore_list: } case SQLCOM_CREATE_EVENT: case SQLCOM_ALTER_EVENT: +#ifdef EMBEDDED_LIBRARY + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "embedded server"); + break; +#endif do { DBUG_ASSERT(lex->event_parse_data); @@ -3527,10 +3531,18 @@ end_with_restore_list: /* lex->unit.cleanup() is called outside, no need to call it here */ break; case SQLCOM_SHOW_CREATE_EVENT: +#ifdef EMBEDDED_LIBRARY + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "embedded server"); + break; +#endif res= Events::show_create_event(thd, lex->spname->m_db, lex->spname->m_name); break; case SQLCOM_DROP_EVENT: +#ifdef EMBEDDED_LIBRARY + my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "embedded server"); + break; +#endif if (!(res= Events::drop_event(thd, lex->spname->m_db, lex->spname->m_name, lex->drop_if_exists)))