Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
991ff478
Commit
991ff478
authored
Feb 28, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class event_timed -> Event_timed
fix for bug#17793 (Scheduler uses class event_timed should be Event_timed)
parent
5f9b2873
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
128 additions
and
128 deletions
+128
-128
sql/event.cc
sql/event.cc
+32
-32
sql/event.h
sql/event.h
+9
-9
sql/event_executor.cc
sql/event_executor.cc
+14
-14
sql/event_priv.h
sql/event_priv.h
+1
-1
sql/event_timed.cc
sql/event_timed.cc
+63
-63
sql/sql_lex.h
sql/sql_lex.h
+2
-2
sql/sql_show.cc
sql/sql_show.cc
+1
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+6
-6
No files found.
sql/event.cc
View file @
991ff478
...
@@ -49,11 +49,11 @@
...
@@ -49,11 +49,11 @@
- Consider using conditional variable when doing shutdown instead of
- Consider using conditional variable when doing shutdown instead of
waiting till all worker threads end.
waiting till all worker threads end.
- Make
e
vent_timed::get_show_create_event() work
- Make
E
vent_timed::get_show_create_event() work
- Add logging to file
- Add logging to file
- Move comparison code to class
e
vent_timed
- Move comparison code to class
E
vent_timed
Warning:
Warning:
- For now parallel execution is not possible because the same sp_head cannot be
- For now parallel execution is not possible because the same sp_head cannot be
...
@@ -276,13 +276,13 @@ my_time_compare(TIME *a, TIME *b)
...
@@ -276,13 +276,13 @@ my_time_compare(TIME *a, TIME *b)
/*
/*
Compares the execute_at members of 2
e
vent_timed instances
Compares the execute_at members of 2
E
vent_timed instances
Synopsis
Synopsis
event_timed_compare()
event_timed_compare()
a - first
e
vent_timed object
a - first
E
vent_timed object
b - second
e
vent_timed object
b - second
E
vent_timed object
RETURNS:
RETURNS:
-1 - a->execute_at < b->execute_at
-1 - a->execute_at < b->execute_at
...
@@ -294,14 +294,14 @@ my_time_compare(TIME *a, TIME *b)
...
@@ -294,14 +294,14 @@ my_time_compare(TIME *a, TIME *b)
*/
*/
int
int
event_timed_compare
(
event_timed
*
a
,
e
vent_timed
*
b
)
event_timed_compare
(
Event_timed
*
a
,
E
vent_timed
*
b
)
{
{
return
my_time_compare
(
&
a
->
execute_at
,
&
b
->
execute_at
);
return
my_time_compare
(
&
a
->
execute_at
,
&
b
->
execute_at
);
}
}
/*
/*
Compares the execute_at members of 2
e
vent_timed instances.
Compares the execute_at members of 2
E
vent_timed instances.
Used as callback for the prioritized queue when shifting
Used as callback for the prioritized queue when shifting
elements inside.
elements inside.
...
@@ -309,8 +309,8 @@ event_timed_compare(event_timed *a, event_timed *b)
...
@@ -309,8 +309,8 @@ event_timed_compare(event_timed *a, event_timed *b)
event_timed_compare()
event_timed_compare()
vptr - not used (set it to NULL)
vptr - not used (set it to NULL)
a - first
e
vent_timed object
a - first
E
vent_timed object
b - second
e
vent_timed object
b - second
E
vent_timed object
RETURNS:
RETURNS:
-1 - a->execute_at < b->execute_at
-1 - a->execute_at < b->execute_at
...
@@ -324,7 +324,7 @@ event_timed_compare(event_timed *a, event_timed *b)
...
@@ -324,7 +324,7 @@ event_timed_compare(event_timed *a, event_timed *b)
int
int
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
)
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
)
{
{
return
event_timed_compare
((
event_timed
*
)
a
,
(
e
vent_timed
*
)
b
);
return
event_timed_compare
((
Event_timed
*
)
a
,
(
E
vent_timed
*
)
b
);
}
}
...
@@ -520,7 +520,7 @@ evex_open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table)
...
@@ -520,7 +520,7 @@ evex_open_event_table(THD *thd, enum thr_lock_type lock_type, TABLE **table)
*/
*/
inline
int
inline
int
evex_db_find_event_aux
(
THD
*
thd
,
e
vent_timed
*
et
,
TABLE
*
table
)
evex_db_find_event_aux
(
THD
*
thd
,
E
vent_timed
*
et
,
TABLE
*
table
)
{
{
return
evex_db_find_event_by_name
(
thd
,
et
->
dbname
,
et
->
name
,
return
evex_db_find_event_by_name
(
thd
,
et
->
dbname
,
et
->
name
,
et
->
definer
,
table
);
et
->
definer
,
table
);
...
@@ -600,7 +600,7 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
...
@@ -600,7 +600,7 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
*/
*/
static
int
static
int
evex_fill_row
(
THD
*
thd
,
TABLE
*
table
,
e
vent_timed
*
et
,
my_bool
is_update
)
evex_fill_row
(
THD
*
thd
,
TABLE
*
table
,
E
vent_timed
*
et
,
my_bool
is_update
)
{
{
enum
evex_table_field
field_num
;
enum
evex_table_field
field_num
;
...
@@ -707,7 +707,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -707,7 +707,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
SYNOPSIS
SYNOPSIS
db_create_event()
db_create_event()
thd THD
thd THD
et
e
vent_timed object containing information for the event
et
E
vent_timed object containing information for the event
create_if_not - if an warning should be generated in case event exists
create_if_not - if an warning should be generated in case event exists
rows_affected - how many rows were affected
rows_affected - how many rows were affected
...
@@ -720,7 +720,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -720,7 +720,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
*/
*/
static
int
static
int
db_create_event
(
THD
*
thd
,
e
vent_timed
*
et
,
my_bool
create_if_not
,
db_create_event
(
THD
*
thd
,
E
vent_timed
*
et
,
my_bool
create_if_not
,
uint
*
rows_affected
)
uint
*
rows_affected
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
@@ -855,7 +855,7 @@ db_create_event(THD *thd, event_timed *et, my_bool create_if_not,
...
@@ -855,7 +855,7 @@ db_create_event(THD *thd, event_timed *et, my_bool create_if_not,
*/
*/
static
int
static
int
db_update_event
(
THD
*
thd
,
e
vent_timed
*
et
,
sp_name
*
new_name
)
db_update_event
(
THD
*
thd
,
E
vent_timed
*
et
,
sp_name
*
new_name
)
{
{
TABLE
*
table
;
TABLE
*
table
;
int
ret
=
EVEX_OPEN_TABLE_FAILED
;
int
ret
=
EVEX_OPEN_TABLE_FAILED
;
...
@@ -954,13 +954,13 @@ db_update_event(THD *thd, event_timed *et, sp_name *new_name)
...
@@ -954,13 +954,13 @@ db_update_event(THD *thd, event_timed *et, sp_name *new_name)
*/
*/
static
int
static
int
db_find_event
(
THD
*
thd
,
sp_name
*
name
,
LEX_STRING
*
definer
,
e
vent_timed
**
ett
,
db_find_event
(
THD
*
thd
,
sp_name
*
name
,
LEX_STRING
*
definer
,
E
vent_timed
**
ett
,
TABLE
*
tbl
,
MEM_ROOT
*
root
)
TABLE
*
tbl
,
MEM_ROOT
*
root
)
{
{
TABLE
*
table
;
TABLE
*
table
;
int
ret
;
int
ret
;
char
*
ptr
;
char
*
ptr
;
e
vent_timed
*
et
=
NULL
;
E
vent_timed
*
et
=
NULL
;
DBUG_ENTER
(
"db_find_event"
);
DBUG_ENTER
(
"db_find_event"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
->
m_name
.
length
,
name
->
m_name
.
str
));
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
->
m_name
.
length
,
name
->
m_name
.
str
));
...
@@ -982,7 +982,7 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, event_timed **ett,
...
@@ -982,7 +982,7 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, event_timed **ett,
my_error
(
ER_EVENT_DOES_NOT_EXIST
,
MYF
(
0
),
name
->
m_name
.
str
);
my_error
(
ER_EVENT_DOES_NOT_EXIST
,
MYF
(
0
),
name
->
m_name
.
str
);
goto
done
;
goto
done
;
}
}
et
=
new
e
vent_timed
;
et
=
new
E
vent_timed
;
/*
/*
1)The table should not be closed beforehand. ::load_from_row() only loads
1)The table should not be closed beforehand. ::load_from_row() only loads
...
@@ -1032,7 +1032,7 @@ evex_load_and_compile_event(THD * thd, sp_name *spn, LEX_STRING definer,
...
@@ -1032,7 +1032,7 @@ evex_load_and_compile_event(THD * thd, sp_name *spn, LEX_STRING definer,
{
{
int
ret
=
0
;
int
ret
=
0
;
MEM_ROOT
*
tmp_mem_root
;
MEM_ROOT
*
tmp_mem_root
;
e
vent_timed
*
ett
;
E
vent_timed
*
ett
;
Open_tables_state
backup
;
Open_tables_state
backup
;
DBUG_ENTER
(
"db_load_and_compile_event"
);
DBUG_ENTER
(
"db_load_and_compile_event"
);
...
@@ -1089,7 +1089,7 @@ evex_load_and_compile_event(THD * thd, sp_name *spn, LEX_STRING definer,
...
@@ -1089,7 +1089,7 @@ evex_load_and_compile_event(THD * thd, sp_name *spn, LEX_STRING definer,
use_lock - whether to lock the mutex LOCK_event_arrays or not in case it
use_lock - whether to lock the mutex LOCK_event_arrays or not in case it
has been already locked outside
has been already locked outside
is_drop - if an event is currently being executed then we can also delete
is_drop - if an event is currently being executed then we can also delete
the
e
vent_timed instance, so we alarm the event that it should
the
E
vent_timed instance, so we alarm the event that it should
drop itself if this parameter is set to TRUE. It's false on
drop itself if this parameter is set to TRUE. It's false on
ALTER EVENT.
ALTER EVENT.
...
@@ -1116,7 +1116,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
...
@@ -1116,7 +1116,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
{
{
event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
e
vent_timed
*
);
Event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
E
vent_timed
*
);
DBUG_PRINT
(
"info"
,
(
"[%s.%s]==[%s.%s]?"
,
db
->
str
,
name
->
str
,
et
->
dbname
.
str
,
DBUG_PRINT
(
"info"
,
(
"[%s.%s]==[%s.%s]?"
,
db
->
str
,
name
->
str
,
et
->
dbname
.
str
,
et
->
name
.
str
));
et
->
name
.
str
));
if
(
!
sortcmp_lex_string
(
*
name
,
et
->
name
,
system_charset_info
)
&&
if
(
!
sortcmp_lex_string
(
*
name
,
et
->
name
,
system_charset_info
)
&&
...
@@ -1168,7 +1168,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
...
@@ -1168,7 +1168,7 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock,
*/
*/
int
int
evex_create_event
(
THD
*
thd
,
e
vent_timed
*
et
,
uint
create_options
,
evex_create_event
(
THD
*
thd
,
E
vent_timed
*
et
,
uint
create_options
,
uint
*
rows_affected
)
uint
*
rows_affected
)
{
{
int
ret
=
0
;
int
ret
=
0
;
...
@@ -1213,7 +1213,7 @@ evex_create_event(THD *thd, event_timed *et, uint create_options,
...
@@ -1213,7 +1213,7 @@ evex_create_event(THD *thd, event_timed *et, uint create_options,
*/
*/
int
int
evex_update_event
(
THD
*
thd
,
e
vent_timed
*
et
,
sp_name
*
new_name
,
evex_update_event
(
THD
*
thd
,
E
vent_timed
*
et
,
sp_name
*
new_name
,
uint
*
rows_affected
)
uint
*
rows_affected
)
{
{
int
ret
,
i
;
int
ret
,
i
;
...
@@ -1267,7 +1267,7 @@ evex_update_event(THD *thd, event_timed *et, sp_name *new_name,
...
@@ -1267,7 +1267,7 @@ evex_update_event(THD *thd, event_timed *et, sp_name *new_name,
rows_affected affected number of rows is returned heres
rows_affected affected number of rows is returned heres
*/
*/
int
db_drop_event
(
THD
*
thd
,
e
vent_timed
*
et
,
bool
drop_if_exists
,
int
db_drop_event
(
THD
*
thd
,
E
vent_timed
*
et
,
bool
drop_if_exists
,
uint
*
rows_affected
)
uint
*
rows_affected
)
{
{
TABLE
*
table
;
TABLE
*
table
;
...
@@ -1308,7 +1308,7 @@ int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
...
@@ -1308,7 +1308,7 @@ int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
done:
done:
/*
/*
evex_drop_event() is used by
e
vent_timed::drop therefore
evex_drop_event() is used by
E
vent_timed::drop therefore
we have to close our thread tables.
we have to close our thread tables.
*/
*/
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
...
@@ -1330,7 +1330,7 @@ int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
...
@@ -1330,7 +1330,7 @@ int db_drop_event(THD *thd, event_timed *et, bool drop_if_exists,
*/
*/
int
int
evex_drop_event
(
THD
*
thd
,
e
vent_timed
*
et
,
bool
drop_if_exists
,
evex_drop_event
(
THD
*
thd
,
E
vent_timed
*
et
,
bool
drop_if_exists
,
uint
*
rows_affected
)
uint
*
rows_affected
)
{
{
TABLE
*
table
;
TABLE
*
table
;
...
@@ -1373,7 +1373,7 @@ int
...
@@ -1373,7 +1373,7 @@ int
evex_show_create_event
(
THD
*
thd
,
sp_name
*
spn
,
LEX_STRING
definer
)
evex_show_create_event
(
THD
*
thd
,
sp_name
*
spn
,
LEX_STRING
definer
)
{
{
int
ret
;
int
ret
;
e
vent_timed
*
et
=
NULL
;
E
vent_timed
*
et
=
NULL
;
Open_tables_state
backup
;
Open_tables_state
backup
;
DBUG_ENTER
(
"evex_update_event"
);
DBUG_ENTER
(
"evex_update_event"
);
...
@@ -1442,15 +1442,15 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
...
@@ -1442,15 +1442,15 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
1. Go through the in-memory cache, if the scheduler is working
1. Go through the in-memory cache, if the scheduler is working
and for every event whose dbname matches the database we drop
and for every event whose dbname matches the database we drop
check whether is currently in execution:
check whether is currently in execution:
-
e
vent_timed::can_spawn() returns true -> the event is not
-
E
vent_timed::can_spawn() returns true -> the event is not
being executed in a child thread. The reason not to use
being executed in a child thread. The reason not to use
e
vent_timed::is_running() is that the latter shows only if
E
vent_timed::is_running() is that the latter shows only if
it is being executed, which is 99% of the time in the thread
it is being executed, which is 99% of the time in the thread
but there are some initiliazations before and after the
but there are some initiliazations before and after the
anonymous SP is being called. So if we delete in this moment
anonymous SP is being called. So if we delete in this moment
-=> *boom*, so we have to check whether the thread has been
-=> *boom*, so we have to check whether the thread has been
spawned and can_spawn() is the right method.
spawned and can_spawn() is the right method.
-
e
vent_timed::can_spawn() returns false -> being runned ATM
-
E
vent_timed::can_spawn() returns false -> being runned ATM
just set the flags so it should drop itself.
just set the flags so it should drop itself.
*/
*/
...
@@ -1484,7 +1484,7 @@ evex_drop_db_events(THD *thd, char *db)
...
@@ -1484,7 +1484,7 @@ evex_drop_db_events(THD *thd, char *db)
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
{
{
event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
e
vent_timed
*
);
Event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
E
vent_timed
*
);
if
(
sortcmp_lex_string
(
et
->
dbname
,
db_lex
,
system_charset_info
))
if
(
sortcmp_lex_string
(
et
->
dbname
,
db_lex
,
system_charset_info
))
continue
;
continue
;
...
@@ -1561,7 +1561,7 @@ evex_drop_db_events(THD *thd, char *db)
...
@@ -1561,7 +1561,7 @@ evex_drop_db_events(THD *thd, char *db)
LEX_STRING
et_db_lex
=
{
et_db
,
strlen
(
et_db
)};
LEX_STRING
et_db_lex
=
{
et_db
,
strlen
(
et_db
)};
if
(
!
sortcmp_lex_string
(
et_db_lex
,
db_lex
,
system_charset_info
))
if
(
!
sortcmp_lex_string
(
et_db_lex
,
db_lex
,
system_charset_info
))
{
{
e
vent_timed
ett
;
E
vent_timed
ett
;
char
*
ptr
;
char
*
ptr
;
if
((
ptr
=
get_field
(
thd
->
mem_root
,
table
->
field
[
EVEX_FIELD_STATUS
]))
if
((
ptr
=
get_field
(
thd
->
mem_root
,
table
->
field
[
EVEX_FIELD_STATUS
]))
...
...
sql/event.h
View file @
991ff478
...
@@ -76,10 +76,10 @@ enum evex_table_field
...
@@ -76,10 +76,10 @@ enum evex_table_field
EVEX_FIELD_COUNT
/* a cool trick to count the number of fields :) */
EVEX_FIELD_COUNT
/* a cool trick to count the number of fields :) */
}
;
}
;
class
e
vent_timed
class
E
vent_timed
{
{
event_timed
(
const
e
vent_timed
&
);
/* Prevent use of these */
Event_timed
(
const
E
vent_timed
&
);
/* Prevent use of these */
void
operator
=
(
e
vent_timed
&
);
void
operator
=
(
E
vent_timed
&
);
my_bool
in_spawned_thread
;
my_bool
in_spawned_thread
;
ulong
locked_by_thread_id
;
ulong
locked_by_thread_id
;
my_bool
running
;
my_bool
running
;
...
@@ -122,7 +122,7 @@ class event_timed
...
@@ -122,7 +122,7 @@ class event_timed
bool
free_sphead_on_delete
;
bool
free_sphead_on_delete
;
uint
flags
;
//all kind of purposes
uint
flags
;
//all kind of purposes
e
vent_timed
()
:
in_spawned_thread
(
0
),
locked_by_thread_id
(
0
),
E
vent_timed
()
:
in_spawned_thread
(
0
),
locked_by_thread_id
(
0
),
running
(
0
),
status_changed
(
false
),
running
(
0
),
status_changed
(
false
),
last_executed_changed
(
false
),
expression
(
0
),
created
(
0
),
last_executed_changed
(
false
),
expression
(
0
),
created
(
0
),
modified
(
0
),
on_completion
(
MYSQL_EVENT_ON_COMPLETION_DROP
),
modified
(
0
),
on_completion
(
MYSQL_EVENT_ON_COMPLETION_DROP
),
...
@@ -135,7 +135,7 @@ class event_timed
...
@@ -135,7 +135,7 @@ class event_timed
init
();
init
();
}
}
~
e
vent_timed
()
~
E
vent_timed
()
{
{
pthread_mutex_destroy
(
&
this
->
LOCK_running
);
pthread_mutex_destroy
(
&
this
->
LOCK_running
);
if
(
free_sphead_on_delete
)
if
(
free_sphead_on_delete
)
...
@@ -259,15 +259,15 @@ class event_timed
...
@@ -259,15 +259,15 @@ class event_timed
int
int
evex_create_event
(
THD
*
thd
,
e
vent_timed
*
et
,
uint
create_options
,
evex_create_event
(
THD
*
thd
,
E
vent_timed
*
et
,
uint
create_options
,
uint
*
rows_affected
);
uint
*
rows_affected
);
int
int
evex_update_event
(
THD
*
thd
,
e
vent_timed
*
et
,
sp_name
*
new_name
,
evex_update_event
(
THD
*
thd
,
E
vent_timed
*
et
,
sp_name
*
new_name
,
uint
*
rows_affected
);
uint
*
rows_affected
);
int
int
evex_drop_event
(
THD
*
thd
,
e
vent_timed
*
et
,
bool
drop_if_exists
,
evex_drop_event
(
THD
*
thd
,
E
vent_timed
*
et
,
bool
drop_if_exists
,
uint
*
rows_affected
);
uint
*
rows_affected
);
int
int
...
@@ -296,7 +296,7 @@ shutdown_events();
...
@@ -296,7 +296,7 @@ shutdown_events();
// auxiliary
// auxiliary
int
int
event_timed_compare
(
event_timed
**
a
,
e
vent_timed
**
b
);
event_timed_compare
(
Event_timed
**
a
,
E
vent_timed
**
b
);
...
...
sql/event_executor.cc
View file @
991ff478
...
@@ -55,7 +55,7 @@ static int
...
@@ -55,7 +55,7 @@ static int
evex_load_events_from_db
(
THD
*
thd
);
evex_load_events_from_db
(
THD
*
thd
);
bool
bool
evex_print_warnings
(
THD
*
thd
,
e
vent_timed
*
et
);
evex_print_warnings
(
THD
*
thd
,
E
vent_timed
*
et
);
/*
/*
TODO Andrey: Check for command line option whether to start
TODO Andrey: Check for command line option whether to start
...
@@ -316,7 +316,7 @@ init_event_thread(THD* thd)
...
@@ -316,7 +316,7 @@ init_event_thread(THD* thd)
static
int
static
int
executor_wait_till_next_event_exec
(
THD
*
thd
)
executor_wait_till_next_event_exec
(
THD
*
thd
)
{
{
e
vent_timed
*
et
;
E
vent_timed
*
et
;
TIME
time_now
;
TIME
time_now
;
int
t2sleep
;
int
t2sleep
;
...
@@ -331,7 +331,7 @@ executor_wait_till_next_event_exec(THD *thd)
...
@@ -331,7 +331,7 @@ executor_wait_till_next_event_exec(THD *thd)
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
DBUG_RETURN
(
WAIT_STATUS_EMPTY_QUEUE
);
DBUG_RETURN
(
WAIT_STATUS_EMPTY_QUEUE
);
}
}
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
e
vent_timed
*
);
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
E
vent_timed
*
);
DBUG_ASSERT
(
et
);
DBUG_ASSERT
(
et
);
if
(
et
->
status
==
MYSQL_EVENT_DISABLED
)
if
(
et
->
status
==
MYSQL_EVENT_DISABLED
)
{
{
...
@@ -361,7 +361,7 @@ executor_wait_till_next_event_exec(THD *thd)
...
@@ -361,7 +361,7 @@ executor_wait_till_next_event_exec(THD *thd)
*/
*/
while
(
t2sleep
--
&&
!
thd
->
killed
&&
event_executor_running_global_var
&&
while
(
t2sleep
--
&&
!
thd
->
killed
&&
event_executor_running_global_var
&&
evex_queue_num_elements
(
EVEX_EQ_NAME
)
&&
evex_queue_num_elements
(
EVEX_EQ_NAME
)
&&
(
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
e
vent_timed
*
)
==
et
))
(
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
E
vent_timed
*
)
==
et
))
{
{
DBUG_PRINT
(
"evex main thread"
,(
"will sleep a bit more"
));
DBUG_PRINT
(
"evex main thread"
,(
"will sleep a bit more"
));
my_sleep
(
1000000
);
my_sleep
(
1000000
);
...
@@ -371,7 +371,7 @@ executor_wait_till_next_event_exec(THD *thd)
...
@@ -371,7 +371,7 @@ executor_wait_till_next_event_exec(THD *thd)
int
ret
=
WAIT_STATUS_READY
;
int
ret
=
WAIT_STATUS_READY
;
if
(
!
evex_queue_num_elements
(
EVEX_EQ_NAME
))
if
(
!
evex_queue_num_elements
(
EVEX_EQ_NAME
))
ret
=
WAIT_STATUS_EMPTY_QUEUE
;
ret
=
WAIT_STATUS_EMPTY_QUEUE
;
else
if
(
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
e
vent_timed
*
)
!=
et
)
else
if
(
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
E
vent_timed
*
)
!=
et
)
ret
=
WAIT_STATUS_NEW_TOP_EVENT
;
ret
=
WAIT_STATUS_NEW_TOP_EVENT
;
if
(
thd
->
killed
&&
event_executor_running_global_var
)
if
(
thd
->
killed
&&
event_executor_running_global_var
)
ret
=
WAIT_STATUS_STOP_EXECUTOR
;
ret
=
WAIT_STATUS_STOP_EXECUTOR
;
...
@@ -470,7 +470,7 @@ event_executor_main(void *arg)
...
@@ -470,7 +470,7 @@ event_executor_main(void *arg)
while
(
!
thd
->
killed
)
while
(
!
thd
->
killed
)
{
{
TIME
time_now
;
TIME
time_now
;
e
vent_timed
*
et
;
E
vent_timed
*
et
;
cnt
++
;
cnt
++
;
DBUG_PRINT
(
"info"
,
(
"EVEX External Loop %d thd->k"
,
cnt
));
DBUG_PRINT
(
"info"
,
(
"EVEX External Loop %d thd->k"
,
cnt
));
...
@@ -519,7 +519,7 @@ event_executor_main(void *arg)
...
@@ -519,7 +519,7 @@ event_executor_main(void *arg)
DBUG_PRINT
(
"evex main thread"
,(
"empty queue"
));
DBUG_PRINT
(
"evex main thread"
,(
"empty queue"
));
continue
;
continue
;
}
}
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
e
vent_timed
*
);
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
E
vent_timed
*
);
DBUG_PRINT
(
"evex main thread"
,(
"got event from the queue"
));
DBUG_PRINT
(
"evex main thread"
,(
"got event from the queue"
));
if
(
!
et
->
execute_at_null
&&
my_time_compare
(
&
time_now
,
&
et
->
execute_at
)
==
-
1
)
if
(
!
et
->
execute_at_null
&&
my_time_compare
(
&
time_now
,
&
et
->
execute_at
)
==
-
1
)
...
@@ -621,7 +621,7 @@ event_executor_main(void *arg)
...
@@ -621,7 +621,7 @@ event_executor_main(void *arg)
VOID
(
pthread_mutex_lock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_lock
(
&
LOCK_event_arrays
));
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
for
(
i
=
0
;
i
<
evex_queue_num_elements
(
EVEX_EQ_NAME
);
++
i
)
{
{
event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
e
vent_timed
*
);
Event_timed
*
et
=
evex_queue_element
(
&
EVEX_EQ_NAME
,
i
,
E
vent_timed
*
);
et
->
free_sp
();
et
->
free_sp
();
delete
et
;
delete
et
;
}
}
...
@@ -666,14 +666,14 @@ event_executor_main(void *arg)
...
@@ -666,14 +666,14 @@ event_executor_main(void *arg)
SYNOPSIS
SYNOPSIS
event_executor_worker()
event_executor_worker()
arg The
e
vent_timed object to be processed
arg The
E
vent_timed object to be processed
*/
*/
pthread_handler_t
pthread_handler_t
event_executor_worker
(
void
*
event_void
)
event_executor_worker
(
void
*
event_void
)
{
{
THD
*
thd
;
/* needs to be first for thread_stack */
THD
*
thd
;
/* needs to be first for thread_stack */
event_timed
*
event
=
(
e
vent_timed
*
)
event_void
;
Event_timed
*
event
=
(
E
vent_timed
*
)
event_void
;
MEM_ROOT
worker_mem_root
;
MEM_ROOT
worker_mem_root
;
DBUG_ENTER
(
"event_executor_worker"
);
DBUG_ENTER
(
"event_executor_worker"
);
...
@@ -771,7 +771,7 @@ event_executor_worker(void *event_void)
...
@@ -771,7 +771,7 @@ event_executor_worker(void *event_void)
/*
/*
Loads all ENABLED events from mysql.event into the prioritized
Loads all ENABLED events from mysql.event into the prioritized
queue. Called during scheduler main thread initialization. Compiles
queue. Called during scheduler main thread initialization. Compiles
the events. Creates
e
vent_timed instances for every ENABLED event
the events. Creates
E
vent_timed instances for every ENABLED event
from mysql.event.
from mysql.event.
SYNOPSIS
SYNOPSIS
...
@@ -808,8 +808,8 @@ evex_load_events_from_db(THD *thd)
...
@@ -808,8 +808,8 @@ evex_load_events_from_db(THD *thd)
init_read_record
(
&
read_record_info
,
thd
,
table
,
NULL
,
1
,
0
);
init_read_record
(
&
read_record_info
,
thd
,
table
,
NULL
,
1
,
0
);
while
(
!
(
read_record_info
.
read_record
(
&
read_record_info
)))
while
(
!
(
read_record_info
.
read_record
(
&
read_record_info
)))
{
{
e
vent_timed
*
et
;
E
vent_timed
*
et
;
if
(
!
(
et
=
new
e
vent_timed
))
if
(
!
(
et
=
new
E
vent_timed
))
{
{
DBUG_PRINT
(
"evex_load_events_from_db"
,
(
"Out of memory"
));
DBUG_PRINT
(
"evex_load_events_from_db"
,
(
"Out of memory"
));
ret
=
-
1
;
ret
=
-
1
;
...
@@ -941,7 +941,7 @@ static sql_print_xxx_func sql_print_xxx_handlers[3] =
...
@@ -941,7 +941,7 @@ static sql_print_xxx_func sql_print_xxx_handlers[3] =
*/
*/
bool
bool
evex_print_warnings
(
THD
*
thd
,
e
vent_timed
*
et
)
evex_print_warnings
(
THD
*
thd
,
E
vent_timed
*
et
)
{
{
MYSQL_ERROR
*
err
;
MYSQL_ERROR
*
err
;
DBUG_ENTER
(
"evex_show_warnings"
);
DBUG_ENTER
(
"evex_show_warnings"
);
...
...
sql/event_priv.h
View file @
991ff478
...
@@ -44,7 +44,7 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
...
@@ -44,7 +44,7 @@ evex_db_find_event_by_name(THD *thd, const LEX_STRING dbname,
int
int
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
);
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
);
int
db_drop_event
(
THD
*
thd
,
e
vent_timed
*
et
,
bool
drop_if_exists
,
int
db_drop_event
(
THD
*
thd
,
E
vent_timed
*
et
,
bool
drop_if_exists
,
uint
*
rows_affected
);
uint
*
rows_affected
);
...
...
sql/event_timed.cc
View file @
991ff478
...
@@ -26,13 +26,13 @@ extern int yyparse(void *thd);
...
@@ -26,13 +26,13 @@ extern int yyparse(void *thd);
Init all member variables
Init all member variables
SYNOPSIS
SYNOPSIS
e
vent_timed::init()
E
vent_timed::init()
*/
*/
void
void
e
vent_timed
::
init
()
E
vent_timed
::
init
()
{
{
DBUG_ENTER
(
"
e
vent_timed::init"
);
DBUG_ENTER
(
"
E
vent_timed::init"
);
dbname
.
str
=
name
.
str
=
body
.
str
=
comment
.
str
=
0
;
dbname
.
str
=
name
.
str
=
body
.
str
=
comment
.
str
=
0
;
dbname
.
length
=
name
.
length
=
body
.
length
=
comment
.
length
=
0
;
dbname
.
length
=
name
.
length
=
body
.
length
=
comment
.
length
=
0
;
...
@@ -56,15 +56,15 @@ event_timed::init()
...
@@ -56,15 +56,15 @@ event_timed::init()
Set a name of the event
Set a name of the event
SYNOPSIS
SYNOPSIS
e
vent_timed::init_name()
E
vent_timed::init_name()
thd THD
thd THD
spn the name extracted in the parser
spn the name extracted in the parser
*/
*/
void
void
e
vent_timed
::
init_name
(
THD
*
thd
,
sp_name
*
spn
)
E
vent_timed
::
init_name
(
THD
*
thd
,
sp_name
*
spn
)
{
{
DBUG_ENTER
(
"
e
vent_timed::init_name"
);
DBUG_ENTER
(
"
E
vent_timed::init_name"
);
uint
n
;
/* Counter for nul trimming */
uint
n
;
/* Counter for nul trimming */
/* During parsing, we must use thd->mem_root */
/* During parsing, we must use thd->mem_root */
MEM_ROOT
*
root
=
thd
->
mem_root
;
MEM_ROOT
*
root
=
thd
->
mem_root
;
...
@@ -100,7 +100,7 @@ event_timed::init_name(THD *thd, sp_name *spn)
...
@@ -100,7 +100,7 @@ event_timed::init_name(THD *thd, sp_name *spn)
Set body of the event - what should be executed.
Set body of the event - what should be executed.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_body()
E
vent_timed::init_body()
thd THD
thd THD
NOTE
NOTE
...
@@ -109,9 +109,9 @@ event_timed::init_name(THD *thd, sp_name *spn)
...
@@ -109,9 +109,9 @@ event_timed::init_name(THD *thd, sp_name *spn)
*/
*/
void
void
e
vent_timed
::
init_body
(
THD
*
thd
)
E
vent_timed
::
init_body
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"
e
vent_timed::init_body"
);
DBUG_ENTER
(
"
E
vent_timed::init_body"
);
DBUG_PRINT
(
"info"
,
(
"body=[%s] body_begin=0x%ld end=0x%ld"
,
body_begin
,
DBUG_PRINT
(
"info"
,
(
"body=[%s] body_begin=0x%ld end=0x%ld"
,
body_begin
,
body_begin
,
thd
->
lex
->
ptr
));
body_begin
,
thd
->
lex
->
ptr
));
...
@@ -136,7 +136,7 @@ event_timed::init_body(THD *thd)
...
@@ -136,7 +136,7 @@ event_timed::init_body(THD *thd)
Set time for execution for one time events.
Set time for execution for one time events.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_execute_at()
E
vent_timed::init_execute_at()
expr when (datetime)
expr when (datetime)
RETURN VALUE
RETURN VALUE
...
@@ -147,14 +147,14 @@ event_timed::init_body(THD *thd)
...
@@ -147,14 +147,14 @@ event_timed::init_body(THD *thd)
*/
*/
int
int
e
vent_timed
::
init_execute_at
(
THD
*
thd
,
Item
*
expr
)
E
vent_timed
::
init_execute_at
(
THD
*
thd
,
Item
*
expr
)
{
{
my_bool
not_used
;
my_bool
not_used
;
TIME
ltime
;
TIME
ltime
;
my_time_t
my_time_tmp
;
my_time_t
my_time_tmp
;
TIME
time_tmp
;
TIME
time_tmp
;
DBUG_ENTER
(
"
e
vent_timed::init_execute_at"
);
DBUG_ENTER
(
"
E
vent_timed::init_execute_at"
);
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
...
@@ -192,7 +192,7 @@ event_timed::init_execute_at(THD *thd, Item *expr)
...
@@ -192,7 +192,7 @@ event_timed::init_execute_at(THD *thd, Item *expr)
Set time for execution for transient events.
Set time for execution for transient events.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_interval()
E
vent_timed::init_interval()
expr how much?
expr how much?
new_interval what is the interval
new_interval what is the interval
...
@@ -204,13 +204,13 @@ event_timed::init_execute_at(THD *thd, Item *expr)
...
@@ -204,13 +204,13 @@ event_timed::init_execute_at(THD *thd, Item *expr)
*/
*/
int
int
e
vent_timed
::
init_interval
(
THD
*
thd
,
Item
*
expr
,
interval_type
new_interval
)
E
vent_timed
::
init_interval
(
THD
*
thd
,
Item
*
expr
,
interval_type
new_interval
)
{
{
longlong
tmp
;
longlong
tmp
;
String
value
;
String
value
;
INTERVAL
interval
;
INTERVAL
interval
;
DBUG_ENTER
(
"
e
vent_timed::init_interval"
);
DBUG_ENTER
(
"
E
vent_timed::init_interval"
);
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
if
(
expr
->
fix_fields
(
thd
,
&
expr
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
...
@@ -289,7 +289,7 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
...
@@ -289,7 +289,7 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
Set activation time.
Set activation time.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_starts()
E
vent_timed::init_starts()
expr how much?
expr how much?
interval what is the interval
interval what is the interval
...
@@ -307,12 +307,12 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
...
@@ -307,12 +307,12 @@ event_timed::init_interval(THD *thd, Item *expr, interval_type new_interval)
*/
*/
int
int
e
vent_timed
::
init_starts
(
THD
*
thd
,
Item
*
new_starts
)
E
vent_timed
::
init_starts
(
THD
*
thd
,
Item
*
new_starts
)
{
{
my_bool
not_used
;
my_bool
not_used
;
TIME
ltime
,
time_tmp
;
TIME
ltime
,
time_tmp
;
DBUG_ENTER
(
"
e
vent_timed::init_starts"
);
DBUG_ENTER
(
"
E
vent_timed::init_starts"
);
if
(
new_starts
->
fix_fields
(
thd
,
&
new_starts
))
if
(
new_starts
->
fix_fields
(
thd
,
&
new_starts
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
...
@@ -346,7 +346,7 @@ event_timed::init_starts(THD *thd, Item *new_starts)
...
@@ -346,7 +346,7 @@ event_timed::init_starts(THD *thd, Item *new_starts)
Set deactivation time.
Set deactivation time.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_ends()
E
vent_timed::init_ends()
thd THD
thd THD
new_ends when?
new_ends when?
...
@@ -365,12 +365,12 @@ event_timed::init_starts(THD *thd, Item *new_starts)
...
@@ -365,12 +365,12 @@ event_timed::init_starts(THD *thd, Item *new_starts)
*/
*/
int
int
e
vent_timed
::
init_ends
(
THD
*
thd
,
Item
*
new_ends
)
E
vent_timed
::
init_ends
(
THD
*
thd
,
Item
*
new_ends
)
{
{
TIME
ltime
,
ltime_now
;
TIME
ltime
,
ltime_now
;
my_bool
not_used
;
my_bool
not_used
;
DBUG_ENTER
(
"
e
vent_timed::init_ends"
);
DBUG_ENTER
(
"
E
vent_timed::init_ends"
);
if
(
new_ends
->
fix_fields
(
thd
,
&
new_ends
))
if
(
new_ends
->
fix_fields
(
thd
,
&
new_ends
))
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
DBUG_RETURN
(
EVEX_PARSE_ERROR
);
...
@@ -411,15 +411,15 @@ event_timed::init_ends(THD *thd, Item *new_ends)
...
@@ -411,15 +411,15 @@ event_timed::init_ends(THD *thd, Item *new_ends)
Sets comment.
Sets comment.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_comment()
E
vent_timed::init_comment()
thd THD - used for memory allocation
thd THD - used for memory allocation
comment the string.
comment the string.
*/
*/
void
void
e
vent_timed
::
init_comment
(
THD
*
thd
,
LEX_STRING
*
set_comment
)
E
vent_timed
::
init_comment
(
THD
*
thd
,
LEX_STRING
*
set_comment
)
{
{
DBUG_ENTER
(
"
e
vent_timed::init_comment"
);
DBUG_ENTER
(
"
E
vent_timed::init_comment"
);
comment
.
str
=
strmake_root
(
thd
->
mem_root
,
set_comment
->
str
,
comment
.
str
=
strmake_root
(
thd
->
mem_root
,
set_comment
->
str
,
comment
.
length
=
set_comment
->
length
);
comment
.
length
=
set_comment
->
length
);
...
@@ -432,13 +432,13 @@ event_timed::init_comment(THD *thd, LEX_STRING *set_comment)
...
@@ -432,13 +432,13 @@ event_timed::init_comment(THD *thd, LEX_STRING *set_comment)
Inits definer (definer_user and definer_host) during parsing.
Inits definer (definer_user and definer_host) during parsing.
SYNOPSIS
SYNOPSIS
e
vent_timed::init_definer()
E
vent_timed::init_definer()
*/
*/
int
int
e
vent_timed
::
init_definer
(
THD
*
thd
)
E
vent_timed
::
init_definer
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"
e
vent_timed::init_definer"
);
DBUG_ENTER
(
"
E
vent_timed::init_definer"
);
DBUG_PRINT
(
"info"
,(
"init definer_user thd->mem_root=0x%lx "
DBUG_PRINT
(
"info"
,(
"init definer_user thd->mem_root=0x%lx "
"thd->sec_ctx->priv_user=0x%lx"
,
thd
->
mem_root
,
"thd->sec_ctx->priv_user=0x%lx"
,
thd
->
mem_root
,
...
@@ -473,7 +473,7 @@ event_timed::init_definer(THD *thd)
...
@@ -473,7 +473,7 @@ event_timed::init_definer(THD *thd)
Loads an event from a row from mysql.event
Loads an event from a row from mysql.event
SYNOPSIS
SYNOPSIS
e
vent_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
E
vent_timed::load_from_row(MEM_ROOT *mem_root, TABLE *table)
NOTES
NOTES
This method is silent on errors and should behave like that. Callers
This method is silent on errors and should behave like that. Callers
...
@@ -482,16 +482,16 @@ event_timed::init_definer(THD *thd)
...
@@ -482,16 +482,16 @@ event_timed::init_definer(THD *thd)
*/
*/
int
int
e
vent_timed
::
load_from_row
(
MEM_ROOT
*
mem_root
,
TABLE
*
table
)
E
vent_timed
::
load_from_row
(
MEM_ROOT
*
mem_root
,
TABLE
*
table
)
{
{
longlong
created
;
longlong
created
;
longlong
modified
;
longlong
modified
;
char
*
ptr
;
char
*
ptr
;
e
vent_timed
*
et
;
E
vent_timed
*
et
;
uint
len
;
uint
len
;
bool
res1
,
res2
;
bool
res1
,
res2
;
DBUG_ENTER
(
"
e
vent_timed::load_from_row"
);
DBUG_ENTER
(
"
E
vent_timed::load_from_row"
);
if
(
!
table
)
if
(
!
table
)
goto
error
;
goto
error
;
...
@@ -698,7 +698,7 @@ bool get_next_time(TIME *next, TIME *start, int i_value, interval_type i_type)
...
@@ -698,7 +698,7 @@ bool get_next_time(TIME *next, TIME *start, int i_value, interval_type i_type)
Computes next execution time.
Computes next execution time.
SYNOPSIS
SYNOPSIS
e
vent_timed::compute_next_execution_time()
E
vent_timed::compute_next_execution_time()
NOTES
NOTES
The time is set in execute_at, if no more executions the latter is set to
The time is set in execute_at, if no more executions the latter is set to
...
@@ -706,13 +706,13 @@ bool get_next_time(TIME *next, TIME *start, int i_value, interval_type i_type)
...
@@ -706,13 +706,13 @@ bool get_next_time(TIME *next, TIME *start, int i_value, interval_type i_type)
*/
*/
bool
bool
e
vent_timed
::
compute_next_execution_time
()
E
vent_timed
::
compute_next_execution_time
()
{
{
TIME
time_now
;
TIME
time_now
;
my_time_t
now
;
my_time_t
now
;
int
tmp
;
int
tmp
;
DBUG_ENTER
(
"
e
vent_timed::compute_next_execution_time"
);
DBUG_ENTER
(
"
E
vent_timed::compute_next_execution_time"
);
if
(
status
==
MYSQL_EVENT_DISABLED
)
if
(
status
==
MYSQL_EVENT_DISABLED
)
{
{
...
@@ -918,12 +918,12 @@ event_timed::compute_next_execution_time()
...
@@ -918,12 +918,12 @@ event_timed::compute_next_execution_time()
time according to thd->query_start(), so the THD's clock.
time according to thd->query_start(), so the THD's clock.
SYNOPSIS
SYNOPSIS
e
vent_timed::drop()
E
vent_timed::drop()
thd thread context
thd thread context
*/
*/
void
void
e
vent_timed
::
mark_last_executed
(
THD
*
thd
)
E
vent_timed
::
mark_last_executed
(
THD
*
thd
)
{
{
TIME
time_now
;
TIME
time_now
;
...
@@ -942,7 +942,7 @@ event_timed::mark_last_executed(THD *thd)
...
@@ -942,7 +942,7 @@ event_timed::mark_last_executed(THD *thd)
Drops the event
Drops the event
SYNOPSIS
SYNOPSIS
e
vent_timed::drop()
E
vent_timed::drop()
thd thread context
thd thread context
RETURN VALUE
RETURN VALUE
...
@@ -955,11 +955,11 @@ event_timed::mark_last_executed(THD *thd)
...
@@ -955,11 +955,11 @@ event_timed::mark_last_executed(THD *thd)
*/
*/
int
int
e
vent_timed
::
drop
(
THD
*
thd
)
E
vent_timed
::
drop
(
THD
*
thd
)
{
{
TABLE
*
table
;
TABLE
*
table
;
uint
tmp
=
0
;
uint
tmp
=
0
;
DBUG_ENTER
(
"
e
vent_timed::drop"
);
DBUG_ENTER
(
"
E
vent_timed::drop"
);
DBUG_RETURN
(
db_drop_event
(
thd
,
this
,
false
,
&
tmp
));
DBUG_RETURN
(
db_drop_event
(
thd
,
this
,
false
,
&
tmp
));
}
}
...
@@ -969,7 +969,7 @@ event_timed::drop(THD *thd)
...
@@ -969,7 +969,7 @@ event_timed::drop(THD *thd)
Saves status and last_executed_at to the disk if changed.
Saves status and last_executed_at to the disk if changed.
SYNOPSIS
SYNOPSIS
e
vent_timed::update_fields()
E
vent_timed::update_fields()
thd - thread context
thd - thread context
RETURN VALUE
RETURN VALUE
...
@@ -982,14 +982,14 @@ event_timed::drop(THD *thd)
...
@@ -982,14 +982,14 @@ event_timed::drop(THD *thd)
*/
*/
bool
bool
e
vent_timed
::
update_fields
(
THD
*
thd
)
E
vent_timed
::
update_fields
(
THD
*
thd
)
{
{
TABLE
*
table
;
TABLE
*
table
;
Open_tables_state
backup
;
Open_tables_state
backup
;
int
ret
=
0
;
int
ret
=
0
;
bool
opened
;
bool
opened
;
DBUG_ENTER
(
"
e
vent_timed::update_time_fields"
);
DBUG_ENTER
(
"
E
vent_timed::update_time_fields"
);
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
.
length
,
name
.
str
));
DBUG_PRINT
(
"enter"
,
(
"name: %*s"
,
name
.
length
,
name
.
str
));
...
@@ -1043,7 +1043,7 @@ extern LEX_STRING interval_type_to_name[];
...
@@ -1043,7 +1043,7 @@ extern LEX_STRING interval_type_to_name[];
Get SHOW CREATE EVENT as string
Get SHOW CREATE EVENT as string
SYNOPSIS
SYNOPSIS
e
vent_timed::get_create_event(THD *thd, String *buf)
E
vent_timed::get_create_event(THD *thd, String *buf)
thd Thread
thd Thread
buf String*, should be already allocated. CREATE EVENT goes inside.
buf String*, should be already allocated. CREATE EVENT goes inside.
...
@@ -1055,7 +1055,7 @@ extern LEX_STRING interval_type_to_name[];
...
@@ -1055,7 +1055,7 @@ extern LEX_STRING interval_type_to_name[];
*/
*/
int
int
e
vent_timed
::
get_create_event
(
THD
*
thd
,
String
*
buf
)
E
vent_timed
::
get_create_event
(
THD
*
thd
,
String
*
buf
)
{
{
int
multipl
=
0
;
int
multipl
=
0
;
char
tmp_buff
[
128
];
char
tmp_buff
[
128
];
...
@@ -1133,14 +1133,14 @@ event_timed::get_create_event(THD *thd, String *buf)
...
@@ -1133,14 +1133,14 @@ event_timed::get_create_event(THD *thd, String *buf)
*/
*/
int
int
e
vent_timed
::
execute
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
E
vent_timed
::
execute
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
{
{
Security_context
*
save_ctx
;
Security_context
*
save_ctx
;
/* this one is local and not needed after exec */
/* this one is local and not needed after exec */
Security_context
security_ctx
;
Security_context
security_ctx
;
int
ret
=
0
;
int
ret
=
0
;
DBUG_ENTER
(
"
e
vent_timed::execute"
);
DBUG_ENTER
(
"
E
vent_timed::execute"
);
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTING event %s.%s [EXPR:%d]"
,
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTING event %s.%s [EXPR:%d]"
,
dbname
.
str
,
name
.
str
,
(
int
)
expression
));
dbname
.
str
,
name
.
str
,
(
int
)
expression
));
...
@@ -1207,7 +1207,7 @@ event_timed::execute(THD *thd, MEM_ROOT *mem_root)
...
@@ -1207,7 +1207,7 @@ event_timed::execute(THD *thd, MEM_ROOT *mem_root)
/*
/*
Switches the security context
Switches the security context
Synopsis
Synopsis
e
vent_timed::change_security_context()
E
vent_timed::change_security_context()
thd - thread
thd - thread
backup - where to store the old context
backup - where to store the old context
...
@@ -1216,10 +1216,10 @@ event_timed::execute(THD *thd, MEM_ROOT *mem_root)
...
@@ -1216,10 +1216,10 @@ event_timed::execute(THD *thd, MEM_ROOT *mem_root)
1 - Error (generates error too)
1 - Error (generates error too)
*/
*/
bool
bool
e
vent_timed
::
change_security_context
(
THD
*
thd
,
Security_context
*
s_ctx
,
E
vent_timed
::
change_security_context
(
THD
*
thd
,
Security_context
*
s_ctx
,
Security_context
**
backup
)
Security_context
**
backup
)
{
{
DBUG_ENTER
(
"
e
vent_timed::change_security_context"
);
DBUG_ENTER
(
"
E
vent_timed::change_security_context"
);
DBUG_PRINT
(
"info"
,(
"%s@%s@%s"
,
definer_user
.
str
,
definer_host
.
str
,
dbname
.
str
));
DBUG_PRINT
(
"info"
,(
"%s@%s@%s"
,
definer_user
.
str
,
definer_host
.
str
,
dbname
.
str
));
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#ifndef NO_EMBEDDED_ACCESS_CHECKS
s_ctx
->
init
();
s_ctx
->
init
();
...
@@ -1240,15 +1240,15 @@ event_timed::change_security_context(THD *thd, Security_context *s_ctx,
...
@@ -1240,15 +1240,15 @@ event_timed::change_security_context(THD *thd, Security_context *s_ctx,
/*
/*
Restores the security context
Restores the security context
Synopsis
Synopsis
e
vent_timed::restore_security_context()
E
vent_timed::restore_security_context()
thd - thread
thd - thread
backup - switch to this context
backup - switch to this context
*/
*/
void
void
e
vent_timed
::
restore_security_context
(
THD
*
thd
,
Security_context
*
backup
)
E
vent_timed
::
restore_security_context
(
THD
*
thd
,
Security_context
*
backup
)
{
{
DBUG_ENTER
(
"
e
vent_timed::change_security_context"
);
DBUG_ENTER
(
"
E
vent_timed::change_security_context"
);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if
(
backup
)
if
(
backup
)
thd
->
security_ctx
=
backup
;
thd
->
security_ctx
=
backup
;
...
@@ -1262,7 +1262,7 @@ event_timed::restore_security_context(THD *thd, Security_context *backup)
...
@@ -1262,7 +1262,7 @@ event_timed::restore_security_context(THD *thd, Security_context *backup)
sp_head object held by the event
sp_head object held by the event
SYNOPSIS
SYNOPSIS
e
vent_timed::compile()
E
vent_timed::compile()
thd thread context, used for memory allocation mostly
thd thread context, used for memory allocation mostly
mem_root if != NULL then this memory root is used for allocs
mem_root if != NULL then this memory root is used for allocs
instead of thd->mem_root
instead of thd->mem_root
...
@@ -1274,14 +1274,14 @@ event_timed::restore_security_context(THD *thd, Security_context *backup)
...
@@ -1274,14 +1274,14 @@ event_timed::restore_security_context(THD *thd, Security_context *backup)
*/
*/
int
int
e
vent_timed
::
compile
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
E
vent_timed
::
compile
(
THD
*
thd
,
MEM_ROOT
*
mem_root
)
{
{
int
ret
=
0
;
int
ret
=
0
;
MEM_ROOT
*
tmp_mem_root
=
0
;
MEM_ROOT
*
tmp_mem_root
=
0
;
LEX
*
old_lex
=
thd
->
lex
,
lex
;
LEX
*
old_lex
=
thd
->
lex
,
lex
;
char
*
old_db
;
char
*
old_db
;
int
old_db_length
;
int
old_db_length
;
e
vent_timed
*
ett
;
E
vent_timed
*
ett
;
sp_name
*
spn
;
sp_name
*
spn
;
char
*
old_query
;
char
*
old_query
;
uint
old_query_len
;
uint
old_query_len
;
...
@@ -1293,7 +1293,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
...
@@ -1293,7 +1293,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
*
old_collation_connection
,
*
old_collation_connection
,
*
old_character_set_results
;
*
old_character_set_results
;
DBUG_ENTER
(
"
e
vent_timed::compile"
);
DBUG_ENTER
(
"
E
vent_timed::compile"
);
show_create
.
length
(
0
);
show_create
.
length
(
0
);
...
@@ -1335,7 +1335,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
...
@@ -1335,7 +1335,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
thd
->
query
=
show_create
.
c_ptr
();
thd
->
query
=
show_create
.
c_ptr
();
thd
->
query_length
=
show_create
.
length
();
thd
->
query_length
=
show_create
.
length
();
DBUG_PRINT
(
"
e
vent_timed::compile"
,
(
"query:%s"
,
thd
->
query
));
DBUG_PRINT
(
"
E
vent_timed::compile"
,
(
"query:%s"
,
thd
->
query
));
thd
->
lex
=
&
lex
;
thd
->
lex
=
&
lex
;
lex_start
(
thd
,
(
uchar
*
)
thd
->
query
,
thd
->
query_length
);
lex_start
(
thd
,
(
uchar
*
)
thd
->
query
,
thd
->
query_length
);
...
@@ -1407,7 +1407,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
...
@@ -1407,7 +1407,7 @@ event_timed::compile(THD *thd, MEM_ROOT *mem_root)
*/
*/
my_bool
my_bool
e
vent_timed
::
can_spawn_now_n_lock
(
THD
*
thd
)
E
vent_timed
::
can_spawn_now_n_lock
(
THD
*
thd
)
{
{
my_bool
ret
=
FALSE
;
my_bool
ret
=
FALSE
;
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
...
@@ -1434,11 +1434,11 @@ extern pthread_attr_t connection_attrib;
...
@@ -1434,11 +1434,11 @@ extern pthread_attr_t connection_attrib;
*/
*/
int
int
e
vent_timed
::
spawn_now
(
void
*
(
*
thread_func
)(
void
*
))
E
vent_timed
::
spawn_now
(
void
*
(
*
thread_func
)(
void
*
))
{
{
int
ret
=
EVENT_EXEC_STARTED
;
int
ret
=
EVENT_EXEC_STARTED
;
static
uint
exec_num
=
0
;
static
uint
exec_num
=
0
;
DBUG_ENTER
(
"
e
vent_timed::spawn_now"
);
DBUG_ENTER
(
"
E
vent_timed::spawn_now"
);
DBUG_PRINT
(
"info"
,
(
"[%s.%s]"
,
dbname
.
str
,
name
.
str
));
DBUG_PRINT
(
"info"
,
(
"[%s.%s]"
,
dbname
.
str
,
name
.
str
));
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
...
@@ -1472,9 +1472,9 @@ event_timed::spawn_now(void * (*thread_func)(void*))
...
@@ -1472,9 +1472,9 @@ event_timed::spawn_now(void * (*thread_func)(void*))
void
void
e
vent_timed
::
spawn_thread_finish
(
THD
*
thd
)
E
vent_timed
::
spawn_thread_finish
(
THD
*
thd
)
{
{
DBUG_ENTER
(
"
e
vent_timed::spawn_thread_finish"
);
DBUG_ENTER
(
"
E
vent_timed::spawn_thread_finish"
);
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
in_spawned_thread
=
false
;
in_spawned_thread
=
false
;
if
((
flags
&
EVENT_EXEC_NO_MORE
)
||
status
==
MYSQL_EVENT_DISABLED
)
if
((
flags
&
EVENT_EXEC_NO_MORE
)
||
status
==
MYSQL_EVENT_DISABLED
)
...
@@ -1501,7 +1501,7 @@ event_timed::spawn_thread_finish(THD *thd)
...
@@ -1501,7 +1501,7 @@ event_timed::spawn_thread_finish(THD *thd)
int
int
e
vent_timed
::
spawn_unlock
(
THD
*
thd
)
E
vent_timed
::
spawn_unlock
(
THD
*
thd
)
{
{
int
ret
=
0
;
int
ret
=
0
;
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
...
...
sql/sql_lex.h
View file @
991ff478
...
@@ -27,7 +27,7 @@ class sp_instr;
...
@@ -27,7 +27,7 @@ class sp_instr;
class
sp_pcontext
;
class
sp_pcontext
;
class
st_alter_tablespace
;
class
st_alter_tablespace
;
class
partition_info
;
class
partition_info
;
class
e
vent_timed
;
class
E
vent_timed
;
#ifdef MYSQL_SERVER
#ifdef MYSQL_SERVER
/*
/*
...
@@ -932,7 +932,7 @@ typedef struct st_lex
...
@@ -932,7 +932,7 @@ typedef struct st_lex
st_sp_chistics
sp_chistics
;
st_sp_chistics
sp_chistics
;
e
vent_timed
*
et
;
E
vent_timed
*
et
;
bool
et_compile_phase
;
bool
et_compile_phase
;
bool
only_view
;
/* used for SHOW CREATE TABLE/VIEW */
bool
only_view
;
/* used for SHOW CREATE TABLE/VIEW */
...
...
sql/sql_show.cc
View file @
991ff478
...
@@ -3936,7 +3936,7 @@ fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
...
@@ -3936,7 +3936,7 @@ fill_events_copy_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
const
char
*
wild
=
thd
->
lex
->
wild
?
thd
->
lex
->
wild
->
ptr
()
:
NullS
;
const
char
*
wild
=
thd
->
lex
->
wild
?
thd
->
lex
->
wild
->
ptr
()
:
NullS
;
CHARSET_INFO
*
scs
=
system_charset_info
;
CHARSET_INFO
*
scs
=
system_charset_info
;
TIME
time
;
TIME
time
;
e
vent_timed
et
;
E
vent_timed
et
;
DBUG_ENTER
(
"fill_events_copy_to_schema_tab"
);
DBUG_ENTER
(
"fill_events_copy_to_schema_tab"
);
restore_record
(
sch_table
,
s
->
default_values
);
restore_record
(
sch_table
,
s
->
default_values
);
...
...
sql/sql_yacc.yy
View file @
991ff478
...
@@ -1343,7 +1343,7 @@ create:
...
@@ -1343,7 +1343,7 @@ create:
lex->create_info.options= $3;
lex->create_info.options= $3;
if (!(lex->et= new
event_timed())) // implicitly calls e
vent_timed::init()
if (!(lex->et= new
Event_timed())) // implicitly calls E
vent_timed::init()
YYABORT;
YYABORT;
/*
/*
...
@@ -4822,7 +4822,7 @@ alter:
...
@@ -4822,7 +4822,7 @@ alter:
*/
*/
{
{
LEX *lex=Lex;
LEX *lex=Lex;
e
vent_timed *et;
E
vent_timed *et;
if (lex->et)
if (lex->et)
{
{
...
@@ -4835,7 +4835,7 @@ alter:
...
@@ -4835,7 +4835,7 @@ alter:
}
}
lex->spname= 0;//defensive programming
lex->spname= 0;//defensive programming
if (!(et= new
event_timed()))// implicitly calls e
vent_timed::init()
if (!(et= new
Event_timed()))// implicitly calls E
vent_timed::init()
YYABORT;
YYABORT;
lex->et = et;
lex->et = et;
...
@@ -4911,7 +4911,7 @@ opt_ev_rename_to: /* empty */ { $$= 0;}
...
@@ -4911,7 +4911,7 @@ opt_ev_rename_to: /* empty */ { $$= 0;}
{
{
LEX *lex=Lex;
LEX *lex=Lex;
lex->spname= $3; //use lex's spname to hold the new name
lex->spname= $3; //use lex's spname to hold the new name
//the original name is in the
e
vent_timed object
//the original name is in the
E
vent_timed object
$$= 1;
$$= 1;
}
}
;
;
...
@@ -7734,7 +7734,7 @@ drop:
...
@@ -7734,7 +7734,7 @@ drop:
YYABORT;
YYABORT;
}
}
if (!(lex->et= new
e
vent_timed()))
if (!(lex->et= new
E
vent_timed()))
YYABORT;
YYABORT;
if (!lex->et_compile_phase)
if (!lex->et_compile_phase)
...
@@ -8458,7 +8458,7 @@ show_param:
...
@@ -8458,7 +8458,7 @@ show_param:
{
{
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
Lex->sql_command = SQLCOM_SHOW_CREATE_EVENT;
Lex->spname= $3;
Lex->spname= $3;
Lex->et= new
e
vent_timed();
Lex->et= new
E
vent_timed();
if (!Lex->et)
if (!Lex->et)
YYABORT;
YYABORT;
Lex->et->init_definer(YYTHD);
Lex->et->init_definer(YYTHD);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment