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
3f4e1f5c
Commit
3f4e1f5c
authored
Jul 12, 2006
by
andrey@lmy004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WL#3337 (Event scheduler new architecture)
event_scheduler_ng.cc/h is no more
parent
0d517461
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
992 additions
and
1028 deletions
+992
-1028
mysql-test/r/not_embedded_server.result
mysql-test/r/not_embedded_server.result
+0
-1
sql/Makefile.am
sql/Makefile.am
+2
-2
sql/event_queue.cc
sql/event_queue.cc
+2
-2
sql/event_queue.h
sql/event_queue.h
+3
-3
sql/event_scheduler.cc
sql/event_scheduler.cc
+865
-0
sql/event_scheduler.h
sql/event_scheduler.h
+104
-0
sql/event_scheduler_ng.cc
sql/event_scheduler_ng.cc
+0
-881
sql/event_scheduler_ng.h
sql/event_scheduler_ng.h
+0
-123
sql/events.cc
sql/events.cc
+14
-14
sql/events.h
sql/events.h
+2
-2
No files found.
mysql-test/r/not_embedded_server.result
View file @
3f4e1f5c
prepare stmt1 from ' show full processlist ';
prepare stmt1 from ' show full processlist ';
execute stmt1;
execute stmt1;
Id User Host db Command Time State Info
Id User Host db Command Time State Info
number event_scheduler localhost NULL Connect time Suspended NULL
number root localhost test Query time NULL show full processlist
number root localhost test Query time NULL show full processlist
deallocate prepare stmt1;
deallocate prepare stmt1;
sql/Makefile.am
View file @
3f4e1f5c
...
@@ -67,7 +67,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
...
@@ -67,7 +67,7 @@ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
sql_array.h sql_cursor.h events.h
\
sql_array.h sql_cursor.h events.h
\
sql_plugin.h authors.h sql_partition.h event_data_objects.h
\
sql_plugin.h authors.h sql_partition.h event_data_objects.h
\
event_queue.h event_db_repository.h
\
event_queue.h event_db_repository.h
\
partition_info.h partition_element.h event_scheduler
_ng
.h
\
partition_info.h partition_element.h event_scheduler.h
\
contributors.h
contributors.h
mysqld_SOURCES
=
sql_lex.cc sql_handler.cc sql_partition.cc
\
mysqld_SOURCES
=
sql_lex.cc sql_handler.cc sql_partition.cc
\
item.cc item_sum.cc item_buff.cc item_func.cc
\
item.cc item_sum.cc item_buff.cc item_func.cc
\
...
@@ -105,7 +105,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
...
@@ -105,7 +105,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc sql_partition.cc \
tztime.cc my_time.c my_user.c my_decimal.cc
\
tztime.cc my_time.c my_user.c my_decimal.cc
\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc
\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc
\
sp_cache.cc parse_file.cc sql_trigger.cc event_scheduler.cc
\
sp_cache.cc parse_file.cc sql_trigger.cc event_scheduler.cc
\
event
_scheduler_ng.cc event
s.cc event_data_objects.cc
\
events.cc event_data_objects.cc
\
event_queue.cc event_db_repository.cc
\
event_queue.cc event_db_repository.cc
\
sql_plugin.cc sql_binlog.cc
\
sql_plugin.cc sql_binlog.cc
\
sql_builtin.cc sql_tablespace.cc partition_info.cc
sql_builtin.cc sql_tablespace.cc partition_info.cc
...
...
sql/event_queue.cc
View file @
3f4e1f5c
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include "event_queue.h"
#include "event_queue.h"
#include "event_data_objects.h"
#include "event_data_objects.h"
#include "event_db_repository.h"
#include "event_db_repository.h"
#include "event_scheduler
_ng
.h"
#include "event_scheduler.h"
#define EVENT_QUEUE_INITIAL_SIZE 30
#define EVENT_QUEUE_INITIAL_SIZE 30
...
@@ -123,7 +123,7 @@ Event_queue::deinit_mutexes()
...
@@ -123,7 +123,7 @@ Event_queue::deinit_mutexes()
*/
*/
bool
bool
Event_queue
::
init_queue
(
Event_db_repository
*
db_repo
,
Event_scheduler
_ng
*
sched
)
Event_queue
::
init_queue
(
Event_db_repository
*
db_repo
,
Event_scheduler
*
sched
)
{
{
int
i
=
0
;
int
i
=
0
;
bool
ret
=
FALSE
;
bool
ret
=
FALSE
;
...
...
sql/event_queue.h
View file @
3f4e1f5c
...
@@ -22,7 +22,7 @@ class Event_job_data;
...
@@ -22,7 +22,7 @@ class Event_job_data;
class
Event_queue_element
;
class
Event_queue_element
;
class
THD
;
class
THD
;
class
Event_scheduler
_ng
;
class
Event_scheduler
;
class
Event_queue
class
Event_queue
{
{
...
@@ -36,7 +36,7 @@ class Event_queue
...
@@ -36,7 +36,7 @@ class Event_queue
deinit_mutexes
();
deinit_mutexes
();
bool
bool
init_queue
(
Event_db_repository
*
db_repo
,
Event_scheduler
_ng
*
sched
);
init_queue
(
Event_db_repository
*
db_repo
,
Event_scheduler
*
sched
);
void
void
deinit_queue
();
deinit_queue
();
...
@@ -109,7 +109,7 @@ class Event_queue
...
@@ -109,7 +109,7 @@ class Event_queue
void
void
dbug_dump_queue
(
time_t
now
);
dbug_dump_queue
(
time_t
now
);
Event_scheduler
_ng
*
scheduler
;
Event_scheduler
*
scheduler
;
/* The sorted queue with the Event_job_data objects */
/* The sorted queue with the Event_job_data objects */
QUEUE
queue
;
QUEUE
queue
;
...
...
sql/event_scheduler.cc
View file @
3f4e1f5c
This diff is collapsed.
Click to expand it.
sql/event_scheduler.h
View file @
3f4e1f5c
...
@@ -16,4 +16,108 @@
...
@@ -16,4 +16,108 @@
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
class
Event_queue
;
class
Event_job_data
;
class
Event_scheduler
{
public:
Event_scheduler
(){}
~
Event_scheduler
(){}
enum
enum_state
{
INITIALIZED
=
0
,
RUNNING
,
STOPPING
};
/* State changing methods follow */
bool
start
();
bool
stop
();
/*
Need to be public because has to be called from the function
passed to pthread_create.
*/
bool
run
(
THD
*
thd
);
bool
init_scheduler
(
Event_queue
*
queue
);
void
deinit_scheduler
();
void
init_mutexes
();
void
deinit_mutexes
();
/* Information retrieving methods follow */
enum
enum_state
get_state
();
void
queue_changed
();
bool
dump_internal_status
(
THD
*
thd
);
private:
uint
workers_count
();
/* helper functions */
bool
execute_top
(
THD
*
thd
,
Event_job_data
*
job_data
);
/* helper functions for working with mutexes & conditionals */
void
lock_data
(
const
char
*
func
,
uint
line
);
void
unlock_data
(
const
char
*
func
,
uint
line
);
void
cond_wait
(
struct
timespec
*
abstime
,
const
char
*
func
,
uint
line
);
pthread_mutex_t
LOCK_scheduler_state
;
/* This is the current status of the life-cycle of the scheduler. */
enum
enum_state
state
;
/*
Holds the thread id of the executor thread or 0 if the scheduler is not
running. It is used by ::shutdown() to know which thread to kill with
kill_one_thread(). The latter wake ups a thread if it is waiting on a
conditional variable and sets thd->killed to non-zero.
*/
ulong
thread_id
;
pthread_cond_t
COND_state
;
Event_queue
*
queue
;
uint
mutex_last_locked_at_line
;
uint
mutex_last_unlocked_at_line
;
const
char
*
mutex_last_locked_in_func
;
const
char
*
mutex_last_unlocked_in_func
;
bool
mutex_scheduler_data_locked
;
bool
waiting_on_cond
;
ulonglong
started_events
;
private:
/* Prevent use of these */
Event_scheduler
(
const
Event_scheduler
&
);
void
operator
=
(
Event_scheduler
&
);
};
#endif
/* _EVENT_SCHEDULER_H_ */
#endif
/* _EVENT_SCHEDULER_H_ */
sql/event_scheduler_ng.cc
deleted
100644 → 0
View file @
0d517461
This diff is collapsed.
Click to expand it.
sql/event_scheduler_ng.h
deleted
100644 → 0
View file @
0d517461
#ifndef _EVENT_SCHEDULER_NG_H_
#define _EVENT_SCHEDULER_NG_H_
/* Copyright (C) 2004-2006 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
class
Event_queue
;
class
Event_job_data
;
class
Event_scheduler_ng
{
public:
Event_scheduler_ng
(){}
~
Event_scheduler_ng
(){}
enum
enum_state
{
INITIALIZED
=
0
,
RUNNING
,
STOPPING
};
/* State changing methods follow */
bool
start
();
bool
stop
();
/*
Need to be public because has to be called from the function
passed to pthread_create.
*/
bool
run
(
THD
*
thd
);
bool
init_scheduler
(
Event_queue
*
queue
);
void
deinit_scheduler
();
void
init_mutexes
();
void
deinit_mutexes
();
/* Information retrieving methods follow */
enum
enum_state
get_state
();
void
queue_changed
();
bool
dump_internal_status
(
THD
*
thd
);
private:
uint
workers_count
();
/* helper functions */
bool
execute_top
(
THD
*
thd
,
Event_job_data
*
job_data
);
/* helper functions for working with mutexes & conditionals */
void
lock_data
(
const
char
*
func
,
uint
line
);
void
unlock_data
(
const
char
*
func
,
uint
line
);
void
cond_wait
(
struct
timespec
*
abstime
,
const
char
*
func
,
uint
line
);
pthread_mutex_t
LOCK_scheduler_state
;
/* This is the current status of the life-cycle of the scheduler. */
enum
enum_state
state
;
/*
Holds the thread id of the executor thread or 0 if the scheduler is not
running. It is used by ::shutdown() to know which thread to kill with
kill_one_thread(). The latter wake ups a thread if it is waiting on a
conditional variable and sets thd->killed to non-zero.
*/
ulong
thread_id
;
pthread_cond_t
COND_state
;
Event_queue
*
queue
;
uint
mutex_last_locked_at_line
;
uint
mutex_last_unlocked_at_line
;
const
char
*
mutex_last_locked_in_func
;
const
char
*
mutex_last_unlocked_in_func
;
bool
mutex_scheduler_data_locked
;
bool
waiting_on_cond
;
ulonglong
started_events
;
private:
/* Prevent use of these */
Event_scheduler_ng
(
const
Event_scheduler_ng
&
);
void
operator
=
(
Event_scheduler_ng
&
);
};
#endif
/* _EVENT_SCHEDULER_NG_H_ */
sql/events.cc
View file @
3f4e1f5c
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
#include "event_data_objects.h"
#include "event_data_objects.h"
#include "event_db_repository.h"
#include "event_db_repository.h"
#include "event_queue.h"
#include "event_queue.h"
#include "event_scheduler
_ng
.h"
#include "event_scheduler.h"
#include "sp_head.h"
#include "sp_head.h"
/*
/*
...
@@ -560,15 +560,15 @@ int
...
@@ -560,15 +560,15 @@ int
Events
::
init
()
Events
::
init
()
{
{
DBUG_ENTER
(
"Events::init"
);
DBUG_ENTER
(
"Events::init"
);
event_queue
->
init_queue
(
db_repository
,
scheduler
_ng
);
event_queue
->
init_queue
(
db_repository
,
scheduler
);
scheduler
_ng
->
init_scheduler
(
event_queue
);
scheduler
->
init_scheduler
(
event_queue
);
/* it should be an assignment! */
/* it should be an assignment! */
if
(
opt_event_scheduler
)
if
(
opt_event_scheduler
)
{
{
DBUG_ASSERT
(
opt_event_scheduler
==
1
||
opt_event_scheduler
==
2
);
DBUG_ASSERT
(
opt_event_scheduler
==
1
||
opt_event_scheduler
==
2
);
if
(
opt_event_scheduler
==
1
)
if
(
opt_event_scheduler
==
1
)
DBUG_RETURN
(
scheduler
_ng
->
start
());
DBUG_RETURN
(
scheduler
->
start
());
}
}
DBUG_RETURN
(
0
);
DBUG_RETURN
(
0
);
...
@@ -590,8 +590,8 @@ Events::deinit()
...
@@ -590,8 +590,8 @@ Events::deinit()
{
{
DBUG_ENTER
(
"Events::deinit"
);
DBUG_ENTER
(
"Events::deinit"
);
scheduler
_ng
->
stop
();
scheduler
->
stop
();
scheduler
_ng
->
deinit_scheduler
();
scheduler
->
deinit_scheduler
();
event_queue
->
deinit_queue
();
event_queue
->
deinit_queue
();
...
@@ -617,8 +617,8 @@ Events::init_mutexes()
...
@@ -617,8 +617,8 @@ Events::init_mutexes()
event_queue
=
new
Event_queue
;
event_queue
=
new
Event_queue
;
event_queue
->
init_mutexes
();
event_queue
->
init_mutexes
();
scheduler
_ng
=
new
Event_scheduler_ng
();
scheduler
=
new
Event_scheduler
();
scheduler
_ng
->
init_mutexes
();
scheduler
->
init_mutexes
();
}
}
...
@@ -633,9 +633,9 @@ void
...
@@ -633,9 +633,9 @@ void
Events
::
destroy_mutexes
()
Events
::
destroy_mutexes
()
{
{
event_queue
->
deinit_mutexes
();
event_queue
->
deinit_mutexes
();
scheduler
_ng
->
deinit_mutexes
();
scheduler
->
deinit_mutexes
();
delete
scheduler
_ng
;
delete
scheduler
;
delete
db_repository
;
delete
db_repository
;
pthread_mutex_destroy
(
&
LOCK_event_metadata
);
pthread_mutex_destroy
(
&
LOCK_event_metadata
);
...
@@ -670,7 +670,7 @@ Events::dump_internal_status(THD *thd)
...
@@ -670,7 +670,7 @@ Events::dump_internal_status(THD *thd)
Protocol
::
SEND_EOF
))
Protocol
::
SEND_EOF
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
if
(
scheduler
_ng
->
dump_internal_status
(
thd
)
||
if
(
scheduler
->
dump_internal_status
(
thd
)
||
event_queue
->
dump_internal_status
(
thd
))
event_queue
->
dump_internal_status
(
thd
))
DBUG_RETURN
(
TRUE
);
DBUG_RETURN
(
TRUE
);
...
@@ -694,7 +694,7 @@ bool
...
@@ -694,7 +694,7 @@ bool
Events
::
start_execution_of_events
()
Events
::
start_execution_of_events
()
{
{
DBUG_ENTER
(
"Events::start_execution_of_events"
);
DBUG_ENTER
(
"Events::start_execution_of_events"
);
DBUG_RETURN
(
scheduler
_ng
->
start
());
DBUG_RETURN
(
scheduler
->
start
());
}
}
...
@@ -715,7 +715,7 @@ bool
...
@@ -715,7 +715,7 @@ bool
Events
::
stop_execution_of_events
()
Events
::
stop_execution_of_events
()
{
{
DBUG_ENTER
(
"Events::stop_execution_of_events"
);
DBUG_ENTER
(
"Events::stop_execution_of_events"
);
DBUG_RETURN
(
scheduler
_ng
->
stop
());
DBUG_RETURN
(
scheduler
->
stop
());
}
}
...
@@ -734,5 +734,5 @@ bool
...
@@ -734,5 +734,5 @@ bool
Events
::
is_started
()
Events
::
is_started
()
{
{
DBUG_ENTER
(
"Events::is_started"
);
DBUG_ENTER
(
"Events::is_started"
);
DBUG_RETURN
(
scheduler
_ng
->
get_state
()
==
Event_scheduler_ng
::
RUNNING
);
DBUG_RETURN
(
scheduler
->
get_state
()
==
Event_scheduler
::
RUNNING
);
}
}
sql/events.h
View file @
3f4e1f5c
...
@@ -21,7 +21,7 @@ class Event_parse_data;
...
@@ -21,7 +21,7 @@ class Event_parse_data;
class
Event_db_repository
;
class
Event_db_repository
;
class
Event_queue
;
class
Event_queue
;
class
Event_queue_element
;
class
Event_queue_element
;
class
Event_scheduler
_ng
;
class
Event_scheduler
;
/* Return codes */
/* Return codes */
enum
enum_events_error_code
enum
enum_events_error_code
...
@@ -117,7 +117,7 @@ class Events
...
@@ -117,7 +117,7 @@ class Events
static
Events
singleton
;
static
Events
singleton
;
Event_queue
*
event_queue
;
Event_queue
*
event_queue
;
Event_scheduler
_ng
*
scheduler_ng
;
Event_scheduler
*
scheduler
;
Event_db_repository
*
db_repository
;
Event_db_repository
*
db_repository
;
pthread_mutex_t
LOCK_event_metadata
;
pthread_mutex_t
LOCK_event_metadata
;
...
...
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