Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey 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, 2006-08-15 15:40:51+02:00, andrey@stripped +9 -0
1) Move Event_queue::check_system_tables() to Events::check_system_tables()
2) Create artificial THD in Events::init(). Hence, don't create a separate thread
in Event_queue::init_queue() to load the events from disk.
sql/event_db_repository.cc@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +3 -3
Use the return value but not some uninitialized value fomr ret.
Rename ret to res
sql/event_queue.cc@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +3 -126
The queue won't create a separate thread to load events on start up.
It gets the THD from the caller. The thd in the caller is artificially
and temporarily created.
sql/event_queue.h@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +1 -4
The queue won't create a separate thread to load events on start up.
It gets the THD from the caller. The thd in the caller is artificially
and temporarily created.
sql/event_scheduler.cc@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +1 -1
Initialize - fix warning
sql/events.cc@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +174 -17
The queue won't create a separate thread to load events on start up.
It gets the THD from the caller. The thd in the caller is artificially
and temporarily created.
Move Event_queue::check_system_tables to Events::check_system_tables()
Check the tables only on start-up. If not in order then throw an error
message anytime any query which uses events DDL is used.
If there was a problem during loading of events from disk on server start,
disable the queue functionality but allow creation on disk. The server needs
to be restarted to bring the queue to operation, if the problem that prevented
loading has been fixed.
sql/events.h@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +5 -0
Event_queue::check_system_tables() -> Events::check_system_tables()
db_ok -> TRUE, no problems during loading of events on server boot.
FALSE, there was an error.
sql/share/errmsg.txt@stripped, 2006-08-15 15:40:48+02:00, andrey@stripped +2 -0
New error message for the case when the system tables were not what Events subsystem
expects, on server-start.
sql/sql_acl.cc@stripped, 2006-08-15 15:40:47+02:00, andrey@stripped +7 -5
Use newly declared values
sql/sql_acl.h@stripped, 2006-08-15 15:40:48+02:00, andrey@stripped +46 -0
Declare the fields in mysql.user, as it is done for mysql.db
a bit above in the header.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: example.com
# Root: /work/mysql-5.1-runtime-wl3337
--- 1.203/sql/sql_acl.cc 2006-08-15 15:41:02 +02:00
+++ 1.204/sql/sql_acl.cc 2006-08-15 15:41:02 +02:00
@@ -374,8 +374,8 @@ static my_bool acl_load(THD *thd, TABLE_
init_read_record(&read_record_info,thd,table=tables[1].table,NULL,1,0);
table->use_all_columns();
VOID(my_init_dynamic_array(&acl_users,sizeof(ACL_USER),50,100));
- password_length= table->field[2]->field_length /
- table->field[2]->charset()->mbmaxlen;
+ password_length= table->field[MYSQL_USER_FIELD_PASSWORD]->field_length /
+ table->field[MYSQL_USER_FIELD_PASSWORD]->charset()->mbmaxlen;
if (password_length < SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
sql_print_error("Fatal error: mysql.user table is damaged or in "
@@ -419,8 +419,9 @@ static my_bool acl_load(THD *thd, TABLE_
while (!(read_record_info.read_record(&read_record_info)))
{
ACL_USER user;
- update_hostname(&user.host, get_field(&mem, table->field[0]));
- user.user= get_field(&mem, table->field[1]);
+ update_hostname(&user.host,
+ get_field(&mem, table->field[MYSQL_USER_FIELD_HOST]));
+ user.user= get_field(&mem, table->field[MYSQL_USER_FIELD_USER]);
if (check_no_resolve && hostname_requires_resolving(user.host.hostname))
{
sql_print_warning("'user' entry '%s@%s' "
@@ -430,7 +431,8 @@ static my_bool acl_load(THD *thd, TABLE_
continue;
}
- const char *password= get_field(&mem, table->field[2]);
+ const char *password=
+ get_field(&mem, table->field[MYSQL_USER_FIELD_PASSWORD]);
uint password_len= password ? strlen(password) : 0;
set_user_salt(&user, password, password_len);
if (user.salt_len == 0 && password_len != 0)
--- 1.50/sql/sql_acl.h 2006-08-15 15:41:02 +02:00
+++ 1.51/sql/sql_acl.h 2006-08-15 15:41:02 +02:00
@@ -161,6 +161,52 @@ enum mysql_db_table_field
MYSQL_DB_FIELD_COUNT
};
+
+enum mysql_user_table_field
+{
+ MYSQL_USER_FIELD_HOST = 0,
+ MYSQL_USER_FIELD_USER,
+ MYSQL_USER_FIELD_PASSWORD,
+ MYSQL_USER_FIELD_SELECT_PRIV,
+ MYSQL_USER_FIELD_INSERT_PRIV,
+ MYSQL_USER_FIELD_UPDATE_PRIV,
+ MYSQL_USER_FIELD_DELETE_PRIV,
+ MYSQL_USER_FIELD_CREATE_PRIV,
+ MYSQL_USER_FIELD_DROP_PRIV,
+ MYSQL_USER_FIELD_RELOAD_PRIV,
+ MYSQL_USER_FIELD_SHUTDOWN_PRIV,
+ MYSQL_USER_FIELD_PROCESS_PRIV,
+ MYSQL_USER_FIELD_FILE_PRIV,
+ MYSQL_USER_FIELD_GRANT_PRIV,
+ MYSQL_USER_FIELD_REFERENCES_PRIV,
+ MYSQL_USER_FIELD_INDEX_PRIV,
+ MYSQL_USER_FIELD_ALTER_PRIV,
+ MYSQL_USER_FIELD_SHOW_DB_PRIV,
+ MYSQL_USER_FIELD_SUPER_PRIV,
+ MYSQL_USER_FIELD_CREATE_TMP_TABLE_PRIV,
+ MYSQL_USER_FIELD_LOCK_TABLES_PRIV,
+ MYSQL_USER_FIELD_EXECUTE_PRIV,
+ MYSQL_USER_FIELD_REPL_SLAVE_PRIV,
+ MYSQL_USER_FIELD_REPL_CLIENT_PRIV,
+ MYSQL_USER_FIELD_CREATE_VIEW_PRIV,
+ MYSQL_USER_FIELD_SHOW_VIEW_PRIV,
+ MYSQL_USER_FIELD_CREATE_ROUTINE_PRIV,
+ MYSQL_USER_FIELD_ALTER_ROUTINE_PRIV,
+ MYSQL_USER_FIELD_CREATE_USER,
+ MYSQL_USER_FIELD_EVENT_PRIV,
+ MYSQL_USER_FIELD_TRIGGER_PRIV,
+ MYSQL_USER_FIELD_SSL_TYPE,
+ MYSQL_USER_FIELD_SSL_CIPHER,
+ MYSQL_USER_FIELD_SSL_ISSUER,
+ MYSQL_USER_FIELD_SSL_SUBJECT,
+ MYSQL_USER_FIELD_MAX_QUESTIONS,
+ MYSQL_USER_FIELD_MAX_UPDATES,
+ MYSQL_USER_FIELD_MAX_CONNECTIONS,
+ MYSQL_USER_FIELD_MAX_USER_CONNECTIONS,
+ MYSQL_USER_FIELD_COUNT
+};
+
+
extern TABLE_FIELD_W_TYPE mysql_db_table_fields[];
extern time_t mysql_db_table_last_check;
--- 1.58/sql/events.cc 2006-08-15 15:41:02 +02:00
+++ 1.59/sql/events.cc 2006-08-15 15:41:02 +02:00
@@ -296,13 +296,19 @@ Events::create_event(THD *thd, Event_par
{
int ret;
DBUG_ENTER("Events::create_event");
+ if (unlikely(!db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
pthread_mutex_lock(&LOCK_event_metadata);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->create_event(thd, parse_data, if_not_exists,
rows_affected)))
{
- if ((ret= event_queue->create_event(thd, parse_data->dbname,
+ if (opt_event_scheduler &&
+ (ret= event_queue->create_event(thd, parse_data->dbname,
parse_data->name)))
{
DBUG_ASSERT(ret == OP_LOAD_ERROR);
@@ -344,11 +350,18 @@ Events::update_event(THD *thd, Event_par
LEX_STRING *new_dbname= rename_to? &rename_to->m_db: NULL;
LEX_STRING *new_name= rename_to? &rename_to->m_name: NULL;
+ if (unlikely(!db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
+
pthread_mutex_lock(&LOCK_event_metadata);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->update_event(thd, parse_data, new_dbname, new_name)))
{
- if ((ret= event_queue->update_event(thd, parse_data->dbname,
+ if (opt_event_scheduler &&
+ (ret= event_queue->update_event(thd, parse_data->dbname,
parse_data->name, new_dbname, new_name)))
{
DBUG_ASSERT(ret == OP_LOAD_ERROR);
@@ -388,13 +401,18 @@ Events::drop_event(THD *thd, LEX_STRING
{
int ret;
DBUG_ENTER("Events::drop_event");
+ if (unlikely(!db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
pthread_mutex_lock(&LOCK_event_metadata);
/* On error conditions my_error() is called so no need to handle here */
if (!(ret= db_repository->drop_event(thd, dbname, name, if_exists,
rows_affected)))
{
- if (!only_from_disk)
+ if (opt_event_scheduler && !only_from_disk)
event_queue->drop_event(thd, dbname, name);
}
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -423,9 +441,15 @@ Events::drop_schema_events(THD *thd, cha
DBUG_ENTER("Events::drop_schema_events");
DBUG_PRINT("enter", ("dropping events from %s", db));
+ if (unlikely(!db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
pthread_mutex_lock(&LOCK_event_metadata);
- event_queue->drop_schema_events(thd, db_lex);
+ if (opt_event_scheduler)
+ event_queue->drop_schema_events(thd, db_lex);
ret= db_repository->drop_schema_events(thd, db_lex);
pthread_mutex_unlock(&LOCK_event_metadata);
@@ -455,6 +479,11 @@ Events::show_create_event(THD *thd, LEX_
DBUG_ENTER("Events::show_create_event");
DBUG_PRINT("enter", ("name: %s@%s", dbname.str, name.str));
+ if (unlikely(!db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
ret= db_repository->load_named_event(thd, dbname, name, et);
@@ -481,8 +510,8 @@ Events::show_create_event(THD *thd, LEX_
field_list.push_back(new Item_empty_string("sql_mode", sql_mode_len));
- field_list.
- push_back(new Item_empty_string("Create Event", show_str.length()));
+ field_list.push_back(new Item_empty_string("Create Event",
+ show_str.length()));
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
@@ -525,6 +554,11 @@ Events::fill_schema_events(THD *thd, TAB
{
char *db= NULL;
DBUG_ENTER("Events::fill_schema_events");
+ if (unlikely(!Events::get_instance()->db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(1);
+ }
/*
If it's SHOW EVENTS then thd->lex->select_lex.db is guaranteed not to
be NULL. Let's do an assert anyway.
@@ -559,24 +593,51 @@ Events::fill_schema_events(THD *thd, TAB
bool
Events::init()
{
- int res;
+ THD *thd;
+ bool res= FALSE;
DBUG_ENTER("Events::init");
- if (event_queue->init_queue(db_repository, scheduler))
- {
- sql_print_information("SCHEDULER: Error while loading from disk.");
+
+ /*
+ We need a temporary THD during boot.
+ */
+ if (!(thd=new THD))
DBUG_RETURN(TRUE);
+ /*
+ The thread stack does not start from this function but we cannot
+ guess the real value. So better some value that doesn't assert than
+ no value.
+ */
+ thd->thread_stack= (char*) &thd;
+ thd->store_globals();
+
+ if (check_system_tables(thd))
+ {
+ db_ok= FALSE;
+ sql_print_error("SCHEDULER: The system tables damaged. "
+ "The scheduler subsystem will be unusable during this run.");
+ DBUG_RETURN(FALSE);
+ }
+ db_ok= TRUE;
+
+ if (event_queue->init_queue(thd, db_repository, scheduler))
+ {
+ opt_event_scheduler= 0;
+ sql_print_error("SCHEDULER: Error while loading from disk.");
+ DBUG_RETURN(FALSE);
}
scheduler->init_scheduler(event_queue);
- /* it should be an assignment! */
if (opt_event_scheduler)
{
DBUG_ASSERT(opt_event_scheduler == 1 || opt_event_scheduler == 2);
if (opt_event_scheduler == 1)
- DBUG_RETURN(scheduler->start());
+ res= scheduler->start();
}
+ delete thd;
+ /* Remember that we don't have a THD */
+ my_pthread_setspecific_ptr(THR_THD, NULL);
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(res);
}
@@ -595,11 +656,13 @@ Events::deinit()
{
DBUG_ENTER("Events::deinit");
- scheduler->stop();
- scheduler->deinit_scheduler();
-
- event_queue->deinit_queue();
+ if (!unlikely(!Events::get_instance()->db_ok))
+ {
+ scheduler->stop();
+ scheduler->deinit_scheduler();
+ event_queue->deinit_queue();
+ }
DBUG_VOID_RETURN;
}
@@ -670,6 +733,12 @@ Events::dump_internal_status(THD *thd)
Protocol *protocol= thd->protocol;
List<Item> field_list;
+ if (unlikely(!Events::get_instance()->db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
+
field_list.push_back(new Item_empty_string("Name", 30));
field_list.push_back(new Item_empty_string("Value",20));
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
@@ -700,6 +769,11 @@ bool
Events::start_execution_of_events()
{
DBUG_ENTER("Events::start_execution_of_events");
+ if (unlikely(!Events::get_instance()->db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
DBUG_RETURN(scheduler->start());
}
@@ -721,6 +795,11 @@ bool
Events::stop_execution_of_events()
{
DBUG_ENTER("Events::stop_execution_of_events");
+ if (unlikely(!Events::get_instance()->db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
DBUG_RETURN(scheduler->stop());
}
@@ -740,5 +819,83 @@ bool
Events::is_started()
{
DBUG_ENTER("Events::is_started");
+ if (unlikely(!Events::get_instance()->db_ok))
+ {
+ my_error(ER_EVENTS_DB_ERROR, MYF(0));
+ DBUG_RETURN(TRUE);
+ }
DBUG_RETURN(scheduler->get_state() == Event_scheduler::RUNNING);
+}
+
+
+
+/*
+ Opens mysql.db and mysql.user and checks whether:
+ 1. mysql.db has column Event_priv at column 20 (0 based);
+ 2. mysql.user has column Event_priv at column 29 (0 based);
+
+ SYNOPSIS
+ Events::check_system_tables()
+ thd Thread
+
+ RETURN VALUE
+ FALSE OK
+ TRUE Error
+*/
+
+bool
+Events::check_system_tables(THD *thd)
+{
+ TABLE_LIST tables;
+ bool not_used;
+ Open_tables_state backup;
+ bool ret= FALSE;
+
+ DBUG_ENTER("Events::check_system_tables");
+ DBUG_PRINT("enter", ("thd=0x%lx", thd));
+
+ thd->reset_n_backup_open_tables_state(&backup);
+
+ bzero((char*) &tables, sizeof(tables));
+ tables.db= (char*) "mysql";
+ tables.table_name= tables.alias= (char*) "db";
+ tables.lock_type= TL_READ;
+
+ if ((ret= simple_open_n_lock_tables(thd, &tables)))
+ {
+ sql_print_error("Cannot open mysql.db");
+ ret= TRUE;
+ }
+ ret= table_check_intact(tables.table, MYSQL_DB_FIELD_COUNT,
+ mysql_db_table_fields, &mysql_db_table_last_check,
+ ER_CANNOT_LOAD_FROM_TABLE);
+ close_thread_tables(thd);
+
+ bzero((char*) &tables, sizeof(tables));
+ tables.db= (char*) "mysql";
+ tables.table_name= tables.alias= (char*) "user";
+ tables.lock_type= TL_READ;
+
+ if (simple_open_n_lock_tables(thd, &tables))
+ {
+ sql_print_error("Cannot open mysql.user");
+ ret= TRUE;
+ }
+ else
+ {
+ if (tables.table->s->fields < MYSQL_USER_FIELD_EVENT_PRIV ||
+ strncmp(tables.table->field[MYSQL_USER_FIELD_EVENT_PRIV]->field_name,
+ STRING_WITH_LEN("Event_priv")))
+ {
+ sql_print_error("mysql.user has no `Event_priv` column at position %d",
+ MYSQL_USER_FIELD_EVENT_PRIV);
+ ret= TRUE;
+ }
+ close_thread_tables(thd);
+ }
+
+end:
+ thd->restore_backup_open_tables_state(&backup);
+
+ DBUG_RETURN(ret);
}
--- 1.43/sql/events.h 2006-08-15 15:41:02 +02:00
+++ 1.44/sql/events.h 2006-08-15 15:41:02 +02:00
@@ -109,6 +109,9 @@ public:
dump_internal_status(THD *thd);
private:
+ bool
+ check_system_tables(THD *thd);
+
/* Singleton DP is used */
Events(){}
~Events(){}
@@ -119,6 +122,8 @@ private:
Event_queue *event_queue;
Event_scheduler *scheduler;
Event_db_repository *db_repository;
+
+ bool db_ok;
pthread_mutex_t LOCK_event_metadata;
--- 1.12/sql/event_db_repository.cc 2006-08-15 15:41:02 +02:00
+++ 1.13/sql/event_db_repository.cc 2006-08-15 15:41:02 +02:00
@@ -679,7 +679,6 @@ Event_db_repository::update_event(THD *t
{
CHARSET_INFO *scs= system_charset_info;
TABLE *table= NULL;
- int ret;
DBUG_ENTER("Event_db_repository::update_event");
if (open_event_table(thd, TL_WRITE, &table))
@@ -747,9 +746,10 @@ Event_db_repository::update_event(THD *t
if (end_active_trans(thd))
goto err;
- if (table->file->ha_update_row(table->record[1], table->record[0]))
+ int res;
+ if ((res= table->file->ha_update_row(table->record[1], table->record[0])))
{
- my_error(ER_EVENT_STORE_FAILED, MYF(0), parse_data->name.str, ret);
+ my_error(ER_EVENT_STORE_FAILED, MYF(0), parse_data->name.str, res);
goto err;
}
--- 1.11/sql/event_queue.cc 2006-08-15 15:41:02 +02:00
+++ 1.12/sql/event_queue.cc 2006-08-15 15:41:02 +02:00
@@ -73,35 +73,6 @@ event_queue_element_compare_q(void *vptr
}
-pthread_handler_t
-event_queue_loader_thread(void *arg)
-{
- /* needs to be first for thread_stack */
- THD *thd= (THD *)((struct event_queue_param *) arg)->thd;
- struct event_queue_param *param= (struct event_queue_param *) arg;
- thd->thread_stack= (char *) &thd;
-
- if (post_init_event_thread(thd))
- goto end;
-
- DBUG_ENTER("event_queue_loader_thread");
-
-
- pthread_mutex_lock(¶m->LOCK_loaded);
- param->queue->check_system_tables(thd);
- param->queue->load_events_from_db(thd);
-
- param->loading_finished= TRUE;
- pthread_cond_signal(¶m->COND_loaded);
-
- pthread_mutex_unlock(¶m->LOCK_loaded);
-
-end:
- deinit_event_thread(thd);
- DBUG_RETURN(0); // Against gcc warnings
-}
-
-
/*
Constructor of class Event_queue.
@@ -161,9 +132,9 @@ Event_queue::deinit_mutexes()
*/
bool
-Event_queue::init_queue(Event_db_repository *db_repo, Event_scheduler *sched)
+Event_queue::init_queue(THD *thd, Event_db_repository *db_repo,
+ Event_scheduler *sched)
{
- THD *new_thd;
pthread_t th;
bool res;
struct event_queue_param *event_queue_param_value= NULL;
@@ -191,36 +162,7 @@ Event_queue::init_queue(Event_db_reposit
goto err;
}
- if (!(new_thd= new THD))
- goto err;
-
- pre_init_event_thread(new_thd);
- new_thd->security_ctx->set_user((char*)"event_scheduler_loader");
-
- event_queue_param_value= (struct event_queue_param *)
- my_malloc(sizeof(struct event_queue_param), MYF(0));
-
- event_queue_param_value->thd= new_thd;
- event_queue_param_value->queue= this;
- event_queue_param_value->loading_finished= FALSE;
- pthread_mutex_init(&event_queue_param_value->LOCK_loaded, MY_MUTEX_INIT_FAST);
- pthread_cond_init(&event_queue_param_value->COND_loaded, NULL);
-
- pthread_mutex_lock(&event_queue_param_value->LOCK_loaded);
- DBUG_PRINT("info", ("Forking new thread for scheduduler. THD=0x%lx", new_thd));
- if (!(res= pthread_create(&th, &connection_attrib, event_queue_loader_thread,
- (void*)event_queue_param_value)))
- {
- do {
- pthread_cond_wait(&event_queue_param_value->COND_loaded,
- &event_queue_param_value->LOCK_loaded);
- } while (event_queue_param_value->loading_finished == FALSE);
- }
-
- pthread_mutex_unlock(&event_queue_param_value->LOCK_loaded);
- pthread_mutex_destroy(&event_queue_param_value->LOCK_loaded);
- pthread_cond_destroy(&event_queue_param_value->COND_loaded);
- my_free((char *)event_queue_param_value, MYF(0));
+ res= load_events_from_db(thd);
UNLOCK_QUEUE_DATA();
DBUG_RETURN(res);
@@ -673,71 +615,6 @@ end:
DBUG_PRINT("info", ("Status code %d. Loaded %d event(s)", ret, count));
DBUG_RETURN(ret);
-}
-
-
-/*
- Opens mysql.db and mysql.user and checks whether:
- 1. mysql.db has column Event_priv at column 20 (0 based);
- 2. mysql.user has column Event_priv at column 29 (0 based);
-
- SYNOPSIS
- Event_queue::check_system_tables()
- thd Thread
-
- RETURN VALUE
- FALSE OK
- TRUE Error
-*/
-
-void
-Event_queue::check_system_tables(THD *thd)
-{
- TABLE_LIST tables;
- bool not_used;
- Open_tables_state backup;
- bool ret;
-
- DBUG_ENTER("Event_queue::check_system_tables");
- DBUG_PRINT("enter", ("thd=0x%lx", thd));
-
- thd->reset_n_backup_open_tables_state(&backup);
-
- bzero((char*) &tables, sizeof(tables));
- tables.db= (char*) "mysql";
- tables.table_name= tables.alias= (char*) "db";
- tables.lock_type= TL_READ;
-
- if ((ret= simple_open_n_lock_tables(thd, &tables)))
- {
- sql_print_error("Cannot open mysql.db");
- goto end;
- }
- ret= table_check_intact(tables.table, MYSQL_DB_FIELD_COUNT,
- mysql_db_table_fields, &mysql_db_table_last_check,
- ER_CANNOT_LOAD_FROM_TABLE);
- close_thread_tables(thd);
-
- bzero((char*) &tables, sizeof(tables));
- tables.db= (char*) "mysql";
- tables.table_name= tables.alias= (char*) "user";
- tables.lock_type= TL_READ;
-
- if (simple_open_n_lock_tables(thd, &tables))
- sql_print_error("Cannot open mysql.db");
- else
- {
- if (tables.table->s->fields < 29 ||
- strncmp(tables.table->field[29]->field_name,
- STRING_WITH_LEN("Event_priv")))
- sql_print_error("mysql.user has no `Event_priv` column at position 29");
- close_thread_tables(thd);
- }
-
-end:
- thd->restore_backup_open_tables_state(&backup);
-
- DBUG_VOID_RETURN;
}
--- 1.9/sql/event_queue.h 2006-08-15 15:41:02 +02:00
+++ 1.10/sql/event_queue.h 2006-08-15 15:41:02 +02:00
@@ -36,7 +36,7 @@ public:
deinit_mutexes();
bool
- init_queue(Event_db_repository *db_repo, Event_scheduler *sched);
+ init_queue(THD *thd, Event_db_repository *db_repo, Event_scheduler *sched);
void
deinit_queue();
@@ -55,9 +55,6 @@ public:
void
drop_schema_events(THD *thd, LEX_STRING schema);
-
- void
- check_system_tables(THD *thd);
void
recalculate_activation_times(THD *thd);
--- 1.20/sql/event_scheduler.cc 2006-08-15 15:41:02 +02:00
+++ 1.21/sql/event_scheduler.cc 2006-08-15 15:41:02 +02:00
@@ -441,7 +441,7 @@ end:
bool
Event_scheduler::run(THD *thd)
{
- int res;
+ int res= FALSE;
struct timespec abstime;
Event_job_data *job_data;
DBUG_ENTER("Event_scheduler::run");
--- 1.118/sql/share/errmsg.txt 2006-08-15 15:41:02 +02:00
+++ 1.119/sql/share/errmsg.txt 2006-08-15 15:41:02 +02:00
@@ -5851,3 +5851,5 @@ ER_CANT_DROP_LOG_TABLE
eng "Cannot drop log table if log is enabled"
ER_EVENT_RECURSIVITY_FORBIDDEN
eng "Recursivity of EVENT DDL statements is forbidden when body is present"
+ER_EVENTS_DB_ERROR
+ eng "Cannot proceed because the tables used by events were found damaged at server start"
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2278) | ahristov | 15 Aug |