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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
64d2033f
Commit
64d2033f
authored
Jan 10, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL 1034 update
(pre-push cleanups removing debugging code)
parent
3cd5a23f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
23 deletions
+53
-23
sql/event.cc
sql/event.cc
+24
-14
sql/event.h
sql/event.h
+13
-0
sql/event_executor.cc
sql/event_executor.cc
+16
-9
No files found.
sql/event.cc
View file @
64d2033f
...
@@ -100,13 +100,17 @@ my_time_compare(TIME *a, TIME *b)
...
@@ -100,13 +100,17 @@ my_time_compare(TIME *a, TIME *b)
}
}
in
line
in
t
int
event_timed_compare
(
event_timed
*
a
,
event_timed
*
b
)
event_timed_compare
(
event_timed
*
a
,
event_timed
*
b
)
{
{
return
my_time_compare
(
&
a
->
execute_at
,
&
b
->
execute_at
);
return
my_time_compare
(
&
a
->
execute_at
,
&
b
->
execute_at
);
}
}
/*
Callback for the prio queue
*/
int
int
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
)
event_timed_compare_q
(
void
*
vptr
,
byte
*
a
,
byte
*
b
)
{
{
...
@@ -244,14 +248,11 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -244,14 +248,11 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
store
(
et
->
name
.
str
,
et
->
name
.
length
,
system_charset_info
))
store
(
et
->
name
.
str
,
et
->
name
.
length
,
system_charset_info
))
goto
trunc_err
;
goto
trunc_err
;
table
->
field
[
EVEX_FIELD_ON_COMPLETION
]
->
set_notnull
();
// both ON_COMPLETION and STATUS are NOT NULL thus not calling set_notnull()
table
->
field
[
EVEX_FIELD_ON_COMPLETION
]
->
store
((
longlong
)
et
->
on_completion
);
table
->
field
[
EVEX_FIELD_ON_COMPLETION
]
->
store
((
longlong
)
et
->
on_completion
);
table
->
field
[
EVEX_FIELD_STATUS
]
->
set_notnull
();
table
->
field
[
EVEX_FIELD_STATUS
]
->
store
((
longlong
)
et
->
status
);
table
->
field
[
EVEX_FIELD_STATUS
]
->
store
((
longlong
)
et
->
status
);
// et->status_changed= false;
// ToDo: Andrey. How to use users current charset?
if
(
et
->
body
.
str
)
if
(
et
->
body
.
str
)
if
(
table
->
field
[
field_num
=
EVEX_FIELD_BODY
]
->
if
(
table
->
field
[
field_num
=
EVEX_FIELD_BODY
]
->
store
(
et
->
body
.
str
,
et
->
body
.
length
,
system_charset_info
))
store
(
et
->
body
.
str
,
et
->
body
.
length
,
system_charset_info
))
...
@@ -260,13 +261,15 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -260,13 +261,15 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
if
(
et
->
starts
.
year
)
if
(
et
->
starts
.
year
)
{
{
table
->
field
[
EVEX_FIELD_STARTS
]
->
set_notnull
();
// set NULL flag to OFF
table
->
field
[
EVEX_FIELD_STARTS
]
->
set_notnull
();
// set NULL flag to OFF
table
->
field
[
EVEX_FIELD_STARTS
]
->
store_time
(
&
et
->
starts
,
MYSQL_TIMESTAMP_DATETIME
);
table
->
field
[
EVEX_FIELD_STARTS
]
->
store_time
(
&
et
->
starts
,
MYSQL_TIMESTAMP_DATETIME
);
}
}
if
(
et
->
ends
.
year
)
if
(
et
->
ends
.
year
)
{
{
table
->
field
[
EVEX_FIELD_ENDS
]
->
set_notnull
();
table
->
field
[
EVEX_FIELD_ENDS
]
->
set_notnull
();
table
->
field
[
EVEX_FIELD_ENDS
]
->
store_time
(
&
et
->
ends
,
MYSQL_TIMESTAMP_DATETIME
);
table
->
field
[
EVEX_FIELD_ENDS
]
->
store_time
(
&
et
->
ends
,
MYSQL_TIMESTAMP_DATETIME
);
}
}
if
(
et
->
expression
)
if
(
et
->
expression
)
...
@@ -279,7 +282,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -279,7 +282,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
In the enum (C) intervals start from 0 but in mysql enum valid values start
In the enum (C) intervals start from 0 but in mysql enum valid values start
from 1. Thus +1 offset is needed!
from 1. Thus +1 offset is needed!
*/
*/
table
->
field
[
EVEX_FIELD_TRANSIENT_INTERVAL
]
->
store
((
longlong
)
et
->
interval
+
1
);
table
->
field
[
EVEX_FIELD_TRANSIENT_INTERVAL
]
->
store
((
longlong
)
et
->
interval
+
1
);
}
}
else
if
(
et
->
execute_at
.
year
)
else
if
(
et
->
execute_at
.
year
)
{
{
...
@@ -288,8 +291,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
...
@@ -288,8 +291,7 @@ evex_fill_row(THD *thd, TABLE *table, event_timed *et, my_bool is_update)
table
->
field
[
EVEX_FIELD_EXECUTE_AT
]
->
store_time
(
&
et
->
execute_at
,
table
->
field
[
EVEX_FIELD_EXECUTE_AT
]
->
store_time
(
&
et
->
execute_at
,
MYSQL_TIMESTAMP_DATETIME
);
MYSQL_TIMESTAMP_DATETIME
);
//this will make it NULL because we don't call set_notnull
table
->
field
[
EVEX_FIELD_TRANSIENT_INTERVAL
]
->
set_null
();
table
->
field
[
EVEX_FIELD_TRANSIENT_INTERVAL
]
->
store
((
longlong
)
0
);
}
}
else
else
{
{
...
@@ -692,9 +694,17 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock)
...
@@ -692,9 +694,17 @@ evex_remove_from_cache(LEX_STRING *db, LEX_STRING *name, bool use_lock)
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
)
&&
!
sortcmp_lex_string
(
*
db
,
et
->
dbname
,
system_charset_info
))
!
sortcmp_lex_string
(
*
db
,
et
->
dbname
,
system_charset_info
))
{
if
(
!
et
->
is_running
())
{
{
et
->
free_sp
();
et
->
free_sp
();
delete
et
;
delete
et
;
}
else
{
et
->
flags
|=
EVENT_EXEC_NO_MORE
;
et
->
dropped
=
true
;
}
evex_queue_delete_element
(
&
EVEX_EQ_NAME
,
i
);
evex_queue_delete_element
(
&
EVEX_EQ_NAME
,
i
);
// ok, we have cleaned
// ok, we have cleaned
goto
done
;
goto
done
;
...
...
sql/event.h
View file @
64d2033f
...
@@ -113,6 +113,7 @@ public:
...
@@ -113,6 +113,7 @@ public:
free_sp
();
free_sp
();
}
}
void
void
init
();
init
();
...
@@ -164,6 +165,18 @@ public:
...
@@ -164,6 +165,18 @@ public:
int
int
compile
(
THD
*
thd
,
MEM_ROOT
*
mem_root
=
NULL
);
compile
(
THD
*
thd
,
MEM_ROOT
*
mem_root
=
NULL
);
my_bool
is_running
()
{
my_bool
ret
;
VOID
(
pthread_mutex_lock
(
&
this
->
LOCK_running
));
ret
=
running
;
VOID
(
pthread_mutex_unlock
(
&
this
->
LOCK_running
));
return
ret
;
}
void
free_sp
()
void
free_sp
()
{
{
delete
sphead
;
delete
sphead
;
...
...
sql/event_executor.cc
View file @
64d2033f
...
@@ -313,10 +313,8 @@ event_executor_main(void *arg)
...
@@ -313,10 +313,8 @@ event_executor_main(void *arg)
{
{
pthread_t
th
;
pthread_t
th
;
printf
(
"[%10s] exec at [%llu]
\n
"
,
et
->
name
.
str
,
TIME_to_ulonglong_datetime
(
&
et
->
execute_at
));
et
->
mark_last_executed
();
et
->
mark_last_executed
();
et
->
compute_next_execution_time
();
et
->
compute_next_execution_time
();
printf
(
"[%10s] next at [%llu]
\n\n\n
"
,
et
->
name
.
str
,
TIME_to_ulonglong_datetime
(
&
et
->
execute_at
));
et
->
update_fields
(
thd
);
et
->
update_fields
(
thd
);
DBUG_PRINT
(
"info"
,
(
" Spawning a thread %d"
,
++
iter_num
));
DBUG_PRINT
(
"info"
,
(
" Spawning a thread %d"
,
++
iter_num
));
#ifndef DBUG_FAULTY_THR
#ifndef DBUG_FAULTY_THR
...
@@ -461,11 +459,19 @@ event_executor_worker(void *event_void)
...
@@ -461,11 +459,19 @@ event_executor_worker(void *event_void)
is_schema_db
(
event
->
dbname
.
str
)))
is_schema_db
(
event
->
dbname
.
str
)))
{
{
int
ret
;
int
ret
;
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTING event for event %s.%s [EXPR:%d]"
,
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
));
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTING event %s.%s [EXPR:%d]"
,
sql_print_information
(
" EVEX EXECUTING event for event %s.%s [EXPR:%d]"
,
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
);
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
));
sql_print_information
(
" EVEX EXECUTING event %s.%s [EXPR:%d]"
,
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
);
ret
=
event
->
execute
(
thd
,
&
worker_mem_root
);
ret
=
event
->
execute
(
thd
,
&
worker_mem_root
);
sql_print_information
(
" EVEX EXECUTED event for event %s.%s [EXPR:%d]. RetCode=%d"
,
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
,
ret
);
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTED event for event %s.%s [EXPR:%d]. RetCode=%d"
,
event
->
dbname
.
str
,
event
->
name
.
str
,(
int
)
event
->
expression
,
ret
));
sql_print_information
(
" EVEX EXECUTED event %s.%s [EXPR:%d]. RetCode=%d"
,
event
->
dbname
.
str
,
event
->
name
.
str
,
(
int
)
event
->
expression
,
ret
);
DBUG_PRINT
(
"info"
,
(
" EVEX EXECUTED event %s.%s [EXPR:%d]. RetCode=%d"
,
event
->
dbname
.
str
,
event
->
name
.
str
,
(
int
)
event
->
expression
,
ret
));
}
}
if
((
event
->
flags
&
EVENT_EXEC_NO_MORE
)
||
event
->
status
==
MYSQL_EVENT_DISABLED
)
if
((
event
->
flags
&
EVENT_EXEC_NO_MORE
)
||
event
->
status
==
MYSQL_EVENT_DISABLED
)
{
{
...
@@ -554,7 +560,7 @@ evex_load_events_from_db(THD *thd)
...
@@ -554,7 +560,7 @@ evex_load_events_from_db(THD *thd)
}
}
if
(
et
->
status
!=
MYSQL_EVENT_ENABLED
)
if
(
et
->
status
!=
MYSQL_EVENT_ENABLED
)
{
{
DBUG_PRINT
(
"evex_load_events_from_db"
,(
"
Event %s is disabled"
,
et
->
name
.
str
));
DBUG_PRINT
(
"evex_load_events_from_db"
,(
"
%s is disabled"
,
et
->
name
.
str
));
delete
et
;
delete
et
;
continue
;
continue
;
}
}
...
@@ -589,8 +595,9 @@ end:
...
@@ -589,8 +595,9 @@ end:
thd
->
version
--
;
// Force close to free memory
thd
->
version
--
;
// Force close to free memory
close_thread_tables
(
thd
);
close_thread_tables
(
thd
);
sql_print_information
(
"Scheduler loaded %d events"
,
count
);
sql_print_information
(
"Scheduler loaded %d event%s"
,
count
,
(
count
==
1
)
?
""
:
"s"
);
DBUG_PRINT
(
"info"
,
(
"Finishing with status code %d. Loaded %d events"
,
ret
,
count
));
DBUG_PRINT
(
"info"
,
(
"Status code %d. Loaded %d event(s)"
,
ret
,
count
));
DBUG_RETURN
(
ret
);
DBUG_RETURN
(
ret
);
}
}
...
...
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