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
a6d4732c
Commit
a6d4732c
authored
Jan 11, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL #1034
- add a bit more debug messages - disable events.test for now due to a bug
parent
50ca86f9
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
41 deletions
+21
-41
mysql-test/r/events.result
mysql-test/r/events.result
+0
-29
mysql-test/t/disabled.def
mysql-test/t/disabled.def
+1
-0
mysql-test/t/events.test
mysql-test/t/events.test
+7
-7
sql/event_executor.cc
sql/event_executor.cc
+13
-5
No files found.
mysql-test/r/events.result
View file @
a6d4732c
...
@@ -38,9 +38,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
...
@@ -38,9 +38,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select count(*) from mysql.event;
select count(*) from mysql.event;
count(*)
count(*)
1
1
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
select release_lock("test_lock1");
select release_lock("test_lock1");
release_lock("test_lock1")
release_lock("test_lock1")
1
1
...
@@ -56,11 +53,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
...
@@ -56,11 +53,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
2 event_scheduler NULL Connect 1 Sleeping NULL
3 root events_test Connect 1 User lock select get_lock("test_lock2", 20)
select release_lock("test_lock2");
select release_lock("test_lock2");
release_lock("test_lock2")
release_lock("test_lock2")
1
1
...
@@ -73,29 +65,16 @@ create event закачка21 on schedule every 10 hour do select get_lock("test
...
@@ -73,29 +65,16 @@ create event закачка21 on schedule every 10 hour do select get_lock("test
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
2 event_scheduler NULL Connect 1 Sleeping NULL
4 root events_test Connect 1 User lock select get_lock("test_lock2_1", 20)
set global event_scheduler=0;
set global event_scheduler=0;
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
2 event_scheduler NULL Connect 3 Sleeping NULL
4 root events_test Connect 3 User lock select get_lock("test_lock2_1", 20)
select release_lock("test_lock2_1");
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
release_lock("test_lock2_1")
1
1
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
drop event закачка21;
drop event закачка21;
set global event_scheduler=1;
set global event_scheduler=1;
select get_lock("test_lock3", 20);
select get_lock("test_lock3", 20);
...
@@ -105,11 +84,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
...
@@ -105,11 +84,6 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
5 event_scheduler NULL Connect 2 Sleeping NULL
6 root events_test Connect 2 User lock select get_lock("test_lock3", 20)
drop event закачка;
drop event закачка;
select release_lock("test_lock3");
select release_lock("test_lock3");
release_lock("test_lock3")
release_lock("test_lock3")
...
@@ -118,7 +92,4 @@ set global event_scheduler=0;
...
@@ -118,7 +92,4 @@ set global event_scheduler=0;
select sleep(2);
select sleep(2);
sleep(2)
sleep(2)
0
0
show processlist;
Id User Host db Command Time State Info
1 root localhost events_test Query 0 NULL show processlist
drop database events_test;
drop database events_test;
mysql-test/t/disabled.def
View file @
a6d4732c
...
@@ -22,3 +22,4 @@ type_time : Bug#15805
...
@@ -22,3 +22,4 @@ type_time : Bug#15805
#ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
#ps_7ndb : Bug#15923 Core dump in RBR mode when executing test suite
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
mysqlslap : Bug#16167
mysqlslap : Bug#16167
events : Affects flush test case. A table lock not released somewhere
mysql-test/t/events.test
View file @
a6d4732c
...
@@ -33,7 +33,7 @@ select count(*) from mysql.event;
...
@@ -33,7 +33,7 @@ select count(*) from mysql.event;
select
get_lock
(
"test_lock1"
,
20
);
select
get_lock
(
"test_lock1"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock1"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock1"
,
20
);
select
count
(
*
)
from
mysql
.
event
;
select
count
(
*
)
from
mysql
.
event
;
show
processlist
;
#
show processlist;
select
release_lock
(
"test_lock1"
);
select
release_lock
(
"test_lock1"
);
drop
event
закачка
;
drop
event
закачка
;
select
count
(
*
)
from
mysql
.
event
;
select
count
(
*
)
from
mysql
.
event
;
...
@@ -42,7 +42,7 @@ set global event_scheduler=1;
...
@@ -42,7 +42,7 @@ set global event_scheduler=1;
select
get_lock
(
"test_lock2"
,
20
);
select
get_lock
(
"test_lock2"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock2"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock2"
,
20
);
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
select
release_lock
(
"test_lock2"
);
select
release_lock
(
"test_lock2"
);
drop
event
закачка
;
drop
event
закачка
;
...
@@ -58,20 +58,20 @@ set global event_scheduler=1;
...
@@ -58,20 +58,20 @@ set global event_scheduler=1;
select
get_lock
(
"test_lock2_1"
,
20
);
select
get_lock
(
"test_lock2_1"
,
20
);
create
event
закачка21
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock2_1"
,
20
);
create
event
закачка21
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock2_1"
,
20
);
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
set
global
event_scheduler
=
0
;
set
global
event_scheduler
=
0
;
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
select
release_lock
(
"test_lock2_1"
);
select
release_lock
(
"test_lock2_1"
);
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
drop
event
закачка21
;
drop
event
закачка21
;
set
global
event_scheduler
=
1
;
set
global
event_scheduler
=
1
;
select
get_lock
(
"test_lock3"
,
20
);
select
get_lock
(
"test_lock3"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock3"
,
20
);
create
event
закачка
on
schedule
every
10
hour
do
select
get_lock
(
"test_lock3"
,
20
);
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
drop
event
закачка
;
drop
event
закачка
;
select
release_lock
(
"test_lock3"
);
select
release_lock
(
"test_lock3"
);
...
@@ -87,7 +87,7 @@ select release_lock("test_lock3");
...
@@ -87,7 +87,7 @@ select release_lock("test_lock3");
set
global
event_scheduler
=
0
;
set
global
event_scheduler
=
0
;
select
sleep
(
2
);
select
sleep
(
2
);
show
processlist
;
#
show processlist;
#the following locks for some reason and is a bug, commented for now
#the following locks for some reason and is a bug, commented for now
#select count(*) from mysql.event;
#select count(*) from mysql.event;
...
...
sql/event_executor.cc
View file @
a6d4732c
...
@@ -264,7 +264,7 @@ event_executor_main(void *arg)
...
@@ -264,7 +264,7 @@ event_executor_main(void *arg)
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
event_timed
*
);
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
event_timed
*
);
if
(
et
->
status
==
MYSQL_EVENT_DISABLED
)
if
(
et
->
status
==
MYSQL_EVENT_DISABLED
)
{
{
DBUG_PRINT
(
"evex
_load_events_from_db
"
,(
"Now it is disabled-exec no more"
));
DBUG_PRINT
(
"evex
main thread
"
,(
"Now it is disabled-exec no more"
));
if
(
et
->
dropped
)
if
(
et
->
dropped
)
et
->
drop
(
thd
);
et
->
drop
(
thd
);
delete
et
;
delete
et
;
...
@@ -274,10 +274,13 @@ event_executor_main(void *arg)
...
@@ -274,10 +274,13 @@ event_executor_main(void *arg)
continue
;
continue
;
}
}
DBUG_PRINT
(
"evex main thread"
,(
"computing time to sleep till next exec"
));
time
(
&
now
);
time
(
&
now
);
my_tz_UTC
->
gmt_sec_to_TIME
(
&
time_now
,
now
);
my_tz_UTC
->
gmt_sec_to_TIME
(
&
time_now
,
now
);
t2sleep
=
evex_time_diff
(
&
et
->
execute_at
,
&
time_now
);
t2sleep
=
evex_time_diff
(
&
et
->
execute_at
,
&
time_now
);
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
DBUG_PRINT
(
"evex main thread"
,(
"unlocked LOCK_event_arrays"
));
if
(
t2sleep
>
0
)
if
(
t2sleep
>
0
)
{
{
/*
/*
...
@@ -287,8 +290,11 @@ event_executor_main(void *arg)
...
@@ -287,8 +290,11 @@ event_executor_main(void *arg)
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
,
event_timed
*
)
==
et
))
(
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
event_timed
*
)
==
et
))
{
DBUG_PRINT
(
"evex main thread"
,(
"will sleep a bit more"
));
my_sleep
(
1000000
);
my_sleep
(
1000000
);
}
}
}
if
(
!
event_executor_running_global_var
)
if
(
!
event_executor_running_global_var
)
{
{
sql_print_information
(
"Scheduler asked to stop."
);
sql_print_information
(
"Scheduler asked to stop."
);
...
@@ -302,25 +308,26 @@ event_executor_main(void *arg)
...
@@ -302,25 +308,26 @@ event_executor_main(void *arg)
if
(
!
evex_queue_num_elements
(
EVEX_EQ_NAME
))
if
(
!
evex_queue_num_elements
(
EVEX_EQ_NAME
))
{
{
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
DBUG_PRINT
(
"evex main thread"
,(
"empty queue"
));
continue
;
continue
;
}
}
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
event_timed
*
);
et
=
evex_queue_first_element
(
&
EVEX_EQ_NAME
,
event_timed
*
);
DBUG_PRINT
(
"evex main thread"
,(
"got event from the queue"
));
/*
if this is the first event which is after time_now then no
more need to iterate over more elements since the array is sorted.
*/
if
(
et
->
execute_at
.
year
>
1969
&&
if
(
et
->
execute_at
.
year
>
1969
&&
my_time_compare
(
&
time_now
,
&
et
->
execute_at
)
==
-
1
)
my_time_compare
(
&
time_now
,
&
et
->
execute_at
)
==
-
1
)
{
{
DBUG_PRINT
(
"evex main thread"
,(
"still not the time for execution"
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
continue
;
continue
;
}
}
DBUG_PRINT
(
"evex main thread"
,(
"it's right time"
));
if
(
et
->
status
==
MYSQL_EVENT_ENABLED
)
if
(
et
->
status
==
MYSQL_EVENT_ENABLED
)
{
{
pthread_t
th
;
pthread_t
th
;
DBUG_PRINT
(
"evex main thread"
,(
"mark_last_executed"
));
et
->
mark_last_executed
();
et
->
mark_last_executed
();
et
->
compute_next_execution_time
();
et
->
compute_next_execution_time
();
et
->
update_fields
(
thd
);
et
->
update_fields
(
thd
);
...
@@ -343,6 +350,7 @@ event_executor_main(void *arg)
...
@@ -343,6 +350,7 @@ event_executor_main(void *arg)
else
else
evex_queue_first_updated
(
&
EVEX_EQ_NAME
);
evex_queue_first_updated
(
&
EVEX_EQ_NAME
);
}
}
DBUG_PRINT
(
"evex main thread"
,(
"unlocking"
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_event_arrays
));
}
// while
}
// while
...
...
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