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
c4394949
Commit
c4394949
authored
Dec 10, 2011
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Unix build
parent
e91bbca5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
13 deletions
+14
-13
sql/sql_class.cc
sql/sql_class.cc
+2
-0
sql/sys_vars.cc
sql/sys_vars.cc
+2
-2
sql/threadpool_unix.cc
sql/threadpool_unix.cc
+10
-11
No files found.
sql/sql_class.cc
View file @
c4394949
...
...
@@ -766,6 +766,8 @@ THD::THD()
stmt_arena
=
this
;
thread_stack
=
0
;
scheduler
=
thread_scheduler
;
// Will be fixed later
event_scheduler
.
data
=
0
;
event_scheduler
.
m_psi
=
0
;
extra_port
=
0
;
catalog
=
(
char
*
)
"std"
;
// the only catalog we have for now
main_security_ctx
.
init
();
...
...
sql/sys_vars.cc
View file @
c4394949
...
...
@@ -2180,7 +2180,7 @@ static Sys_var_ulong Sys_thread_cache_size(
GLOBAL_VAR
(
thread_cache_size
),
CMD_LINE
(
REQUIRED_ARG
),
VALID_RANGE
(
0
,
16384
),
DEFAULT
(
0
),
BLOCK_SIZE
(
1
));
#ifndef HAVE_POOL_OF_THREADS
static
bool
fix_tp_max_threads
(
sys_var
*
,
THD
*
,
enum_var_type
)
{
#ifdef _WIN32
...
...
@@ -2197,6 +2197,7 @@ static bool fix_tp_min_threads(sys_var *, THD *, enum_var_type)
}
#endif
#ifdef _WIN32
static
Sys_var_uint
Sys_threadpool_min_threads
(
"thread_pool_min_threads"
,
...
...
@@ -2239,7 +2240,6 @@ static Sys_var_uint Sys_threadpool_max_threads(
NO_MUTEX_GUARD
,
NOT_IN_BINLOG
,
ON_CHECK
(
0
),
ON_UPDATE
(
fix_tp_max_threads
)
);
#endif
/* !HAVE_POOL_OF_THREADS */
/**
...
...
sql/threadpool_unix.cc
View file @
c4394949
...
...
@@ -124,7 +124,6 @@ struct connection_t
};
/* Externals functions and variables we use */
extern
uint
thread_created
;
extern
void
scheduler_init
();
extern
pthread_attr_t
*
get_connection_attrib
(
void
);
extern
int
skip_net_wait_timeout
;
...
...
@@ -408,7 +407,7 @@ static void timeout_check(pool_timer_t *timer)
if
(
thd
->
net
.
reading_or_writing
!=
1
)
continue
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
scheduler
.
data
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
event_
scheduler
.
data
;
if
(
!
connection
)
continue
;
...
...
@@ -416,7 +415,7 @@ static void timeout_check(pool_timer_t *timer)
{
/* Wait timeout exceeded, kill connection. */
mysql_mutex_lock
(
&
thd
->
LOCK_thd_data
);
thd
->
killed
=
THD
::
KILL_CONNECTION
;
thd
->
killed
=
KILL_CONNECTION
;
tp_post_kill_notification
(
thd
);
mysql_mutex_unlock
(
&
thd
->
LOCK_thd_data
);
}
...
...
@@ -449,7 +448,7 @@ static void* timer_thread(void *param)
pool_timer_t
*
timer
=
(
pool_timer_t
*
)
param
;
timer
->
next_timeout_check
=
ULONGLONG_MAX
;
timer
->
current_microtime
=
m
y_micro_time
();
timer
->
current_microtime
=
m
icrosecond_interval_timer
();
my_thread_init
();
DBUG_ENTER
(
"timer_thread"
);
...
...
@@ -464,7 +463,7 @@ static void* timer_thread(void *param)
break
;
if
(
err
==
ETIMEDOUT
)
{
timer
->
current_microtime
=
m
y_micro_time
();
timer
->
current_microtime
=
m
icrosecond_interval_timer
();
/* Check stallls in thread groups */
for
(
i
=
0
;
i
<
threadpool_size
;
i
++
)
...
...
@@ -643,7 +642,7 @@ static int create_worker(thread_group_t *thread_group)
if
(
!
err
)
{
thread_group
->
pending_thread_start_count
++
;
thread_group
->
last_thread_creation_time
=
m
y_micro_time
();
thread_group
->
last_thread_creation_time
=
m
icrosecond_interval_timer
();
}
DBUG_RETURN
(
err
);
}
...
...
@@ -673,7 +672,7 @@ static int wake_or_create_thread(thread_group_t *thread_group)
DBUG_RETURN
(
create_worker
(
thread_group
));
}
now
=
m
y_micro_time
();
now
=
m
icrosecond_interval_timer
();
time_since_last_thread_created
=
(
now
-
thread_group
->
last_thread_creation_time
)
/
1000
;
...
...
@@ -994,7 +993,7 @@ void tp_add_connection(THD *thd)
mysql_mutex_lock
(
&
c
->
thread_group
->
mutex
);
c
->
thread_group
->
connection_count
++
;
mysql_mutex_unlock
(
&
c
->
thread_group
->
mutex
);
c
->
thd
->
scheduler
.
data
=
c
;
c
->
thd
->
event_
scheduler
.
data
=
c
;
post_event
(
c
->
thread_group
,
&
c
->
event
);
}
...
...
@@ -1032,7 +1031,7 @@ void tp_wait_begin(THD *thd, int type)
if
(
!
thd
)
DBUG_VOID_RETURN
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
scheduler
.
data
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
event_
scheduler
.
data
;
if
(
connection
)
{
DBUG_ASSERT
(
!
connection
->
waiting
);
...
...
@@ -1049,7 +1048,7 @@ void tp_wait_end(THD *thd)
if
(
!
thd
)
DBUG_VOID_RETURN
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
scheduler
.
data
;
connection_t
*
connection
=
(
connection_t
*
)
thd
->
event_
scheduler
.
data
;
if
(
connection
)
{
DBUG_ASSERT
(
connection
->
waiting
);
...
...
@@ -1077,7 +1076,7 @@ static void set_wait_timeout(connection_t *c)
DBUG_ENTER
(
"set_wait_timeout"
);
/*
Calculate wait deadline for this connection.
Instead of using m
y_micro_time
() which has a syscall
Instead of using m
icrosecond_interval_timer
() which has a syscall
overhead, use pool_timer.current_microtime and take
into account that its value could be off by at most
one tick interval.
...
...
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