mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#3337 (Events new architecture)
This cut No 7 should finish the part of fixing the parsing of the events : - Event_timed is no more used during parsing. Less problems because it has a mutex. Event_parse_data class is used during parsing. It is suited only for this purpose. It's pretty lightweight - Late checking of data from parsing is being performed. This should solve the problems of nested events in SP or other events (for the situation of no nested bodies). Before if an ALTER EVENT was in a SP, then when the SP was compiled, and not executed, the actual init_xxx methods of Event_timed were called, which is wrong. - It could be a side effect of using a specialized class, but test events_stress is now 25% quicker. Cut No8 will start splitting Event_scheduler into 2 parts, the QUEUE will be moved to Event_queue.
This commit is contained in:
@ -3833,57 +3833,31 @@ end_with_restore_list:
|
||||
case SQLCOM_ALTER_EVENT:
|
||||
{
|
||||
uint rows_affected= 1;
|
||||
DBUG_ASSERT(lex->et);
|
||||
do {
|
||||
if (! lex->et->dbname.str ||
|
||||
(lex->sql_command == SQLCOM_ALTER_EVENT && lex->spname &&
|
||||
!lex->spname->m_db.str))
|
||||
{
|
||||
my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0));
|
||||
res= true;
|
||||
break;
|
||||
}
|
||||
DBUG_ASSERT(lex->event_parse_data);
|
||||
switch (lex->sql_command) {
|
||||
case SQLCOM_CREATE_EVENT:
|
||||
res= Events::get_instance()->create_event(thd, lex->event_parse_data,
|
||||
(uint) lex->create_info.options,
|
||||
&rows_affected);
|
||||
break;
|
||||
case SQLCOM_ALTER_EVENT:
|
||||
res= Events::get_instance()->update_event(thd, lex->event_parse_data,
|
||||
lex->spname, &rows_affected);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
DBUG_PRINT("info", ("CREATE/ALTER/DROP returned error code=%d af_rows=%d",
|
||||
res, rows_affected));
|
||||
if (!res)
|
||||
send_ok(thd, rows_affected);
|
||||
|
||||
if (check_access(thd, EVENT_ACL, lex->et->dbname.str, 0, 0, 0,
|
||||
is_schema_db(lex->et->dbname.str)) ||
|
||||
(lex->sql_command == SQLCOM_ALTER_EVENT && lex->spname &&
|
||||
(check_access(thd, EVENT_ACL, lex->spname->m_db.str, 0, 0, 0,
|
||||
is_schema_db(lex->spname->m_db.str)))))
|
||||
break;
|
||||
|
||||
if (end_active_trans(thd))
|
||||
{
|
||||
res= -1;
|
||||
break;
|
||||
}
|
||||
|
||||
switch (lex->sql_command) {
|
||||
case SQLCOM_CREATE_EVENT:
|
||||
res= Events::get_instance()->
|
||||
create_event(thd, lex->et, lex->event_parse_data,
|
||||
(uint) lex->create_info.options, &rows_affected);
|
||||
break;
|
||||
case SQLCOM_ALTER_EVENT:
|
||||
res= Events::get_instance()->
|
||||
update_event(thd, lex->et, lex->event_parse_data,
|
||||
lex->spname, &rows_affected);
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
DBUG_PRINT("info", ("CREATE/ALTER/DROP returned error code=%d af_rows=%d",
|
||||
res, rows_affected));
|
||||
if (!res)
|
||||
send_ok(thd, rows_affected);
|
||||
|
||||
/* lex->unit.cleanup() is called outside, no need to call it here */
|
||||
} while (0);
|
||||
if (!thd->spcont)
|
||||
{
|
||||
lex->et->free_sphead_on_delete= true;
|
||||
lex->et->free_sp();
|
||||
lex->et->deinit_mutexes();
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
}
|
||||
|
||||
|
||||
/* lex->unit.cleanup() is called outside, no need to call it here */
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DROP_EVENT:
|
||||
@ -3912,11 +3886,6 @@ end_with_restore_list:
|
||||
else
|
||||
{
|
||||
uint rows_affected= 1;
|
||||
if (end_active_trans(thd))
|
||||
{
|
||||
res= -1;
|
||||
break;
|
||||
}
|
||||
if (!(res= Events::get_instance()->drop_event(thd, lex->spname,
|
||||
lex->drop_if_exists,
|
||||
&rows_affected)))
|
||||
@ -6020,14 +5989,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
||||
{
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
if (lex->et)
|
||||
{
|
||||
lex->et->free_sphead_on_delete= true;
|
||||
/* alloced on thd->mem_root so no real memory free but dtor call */
|
||||
lex->et->free_sp();
|
||||
lex->et->deinit_mutexes();
|
||||
lex->et= NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -6064,13 +6025,6 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
}
|
||||
if (lex->et)
|
||||
{
|
||||
lex->et->free_sphead_on_delete= true;
|
||||
lex->et->free_sp();
|
||||
lex->et->deinit_mutexes();
|
||||
lex->et= NULL;
|
||||
}
|
||||
}
|
||||
thd->proc_info="freeing items";
|
||||
thd->end_statement();
|
||||
|
Reference in New Issue
Block a user