From: Date: May 9 2008 4:09pm Subject: bk commit into 6.0 tree (thek:1.2661) BUG#35997 List-Archive: http://lists.mysql.com/commits/46566 X-Bug: 35997 Message-Id: <20080509140958.F20B1530626@Adventure> Below is the list of changes that have just been committed into a local 6.0 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-09 16:09:52+02:00, thek@adventure.(none) +1 -0 Bug#35997 Event scheduler seems to let the server crash, if it is embedded. Part 2. This patch fixes event related methods in object services API (si_objects.c) so that they behave well also when events are disabled in the server. sql/si_objects.cc@stripped, 2008-05-09 16:09:48+02:00, thek@adventure.(none) +36 -6 Disable event code if the HAVE_EVENT_SCHEDULER directive isn't defined. Introduced a dummy implementation of ObjIterator interface. diff -Nrup a/sql/si_objects.cc b/sql/si_objects.cc --- a/sql/si_objects.cc 2008-04-16 09:53:13 +02:00 +++ b/sql/si_objects.cc 2008-05-09 16:09:48 +02:00 @@ -17,9 +17,11 @@ #include "si_objects.h" #include "ddl_blocker.h" #include "sql_show.h" +#ifdef HAVE_EVENT_SCHEDULER #include "events.h" #include "event_data_objects.h" #include "event_db_repository.h" +#endif #include "sql_trigger.h" #include "sp.h" #include "sp_head.h" // for sp_add_to_query_tables(). @@ -669,7 +671,7 @@ private: }; /////////////////////////////////////////////////////////////////////////// - +#ifdef HAVE_EVENT_SCHEDULER /** @class EventObj @@ -709,6 +711,7 @@ private: // These attributes are to be used only for materialization. String m_create_stmt; }; +#endif // HAVE_EVENT_SCHEDULER /** @class TablespaceObj @@ -817,6 +820,19 @@ private: /////////////////////////////////////////////////////////////////////////// +class ObjIteratorDummyImpl : ObjIterator +{ +public: + ObjIteratorDummyImpl() { return; } + virtual ~ObjIteratorDummyImpl() { return; } + virtual Obj *next() { return NULL; } + +protected: + virtual Obj *create_obj(TABLE *t) { return NULL; } + +}; + +/////////////////////////////////////////////////////////////////////////// class DatabaseIterator : public InformationSchemaIterator { public: @@ -955,7 +971,7 @@ protected: }; /////////////////////////////////////////////////////////////////////////// - +#ifdef HAVE_EVENT_SCHEDULER class DbEventIterator : public InformationSchemaIterator { public: @@ -975,7 +991,7 @@ protected: private: String m_db_name; }; - +#endif /////////////////////////////////////////////////////////////////////////// @@ -1292,6 +1308,7 @@ Obj *DbStoredFuncIterator::create_sr_obj return new StoredFuncObj(db_name, sr_name); } +#ifdef HAVE_EVENT_SCHEDULER /////////////////////////////////////////////////////////////////////////// // @@ -1299,7 +1316,6 @@ Obj *DbStoredFuncIterator::create_sr_obj // /////////////////////////////////////////////////////////////////////////// - EventObj *DbEventIterator::create_obj(TABLE *t) { String db_name; @@ -1315,7 +1331,7 @@ EventObj *DbEventIterator::create_obj(TA return new EventObj(&db_name, &event_name); } - +#endif /////////////////////////////////////////////////////////////////////////// // @@ -1486,9 +1502,11 @@ template DbStoredFuncIterator * create_is_iterator(THD *, enum_schema_tables, const String *); +#ifdef HAVE_EVENT_SCHEDULER template DbEventIterator * create_is_iterator(THD *, enum_schema_tables, const String *); +#endif ObjIterator *get_db_tables(THD *thd, const String *db_name) { @@ -1517,7 +1535,11 @@ ObjIterator *get_db_stored_functions(THD ObjIterator *get_db_events(THD *thd, const String *db_name) { +#ifdef HAVE_EVENT_SCHEDULER return create_is_iterator(thd, SCH_EVENTS, db_name); +#else + return (ObjIterator *)new ObjIteratorDummyImpl; +#endif } @@ -2257,7 +2279,7 @@ bool StoredFuncObj::drop(THD *thd) // ///////////////////////////////////////////////////////////////////////////// - +#ifdef HAVE_EVENT_SCHEDULER EventObj::EventObj(const String *db_name, const String *event_name) { @@ -2415,6 +2437,7 @@ bool EventObj::drop(THD *thd) &m_db_name, &m_event_name)); } +#endif // HAVE_EVENT_SCHEDULER /////////////////////////////////////////////////////////////////////////// @@ -2587,9 +2610,14 @@ Obj *get_stored_function(const String *d Obj *get_event(const String *db_name, const String *event_name) { +#ifdef HAVE_EVENT_SCHEDULER return new EventObj(db_name, event_name); +#else + return NULL; +#endif } + /////////////////////////////////////////////////////////////////////////// Obj *materialize_database(const String *db_name, @@ -2657,6 +2685,7 @@ Obj *materialize_stored_function(const S return obj; } +#ifdef HAVE_EVENT_SCHEDULER Obj *materialize_event(const String *db_name, const String *event_name, uint serialization_version, @@ -2667,6 +2696,7 @@ Obj *materialize_event(const String *db_ return obj; } +#endif Obj *materialize_tablespace(const String *ts_name, uint serialization_version,