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
41013f16
Commit
41013f16
authored
Feb 19, 2013
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-156 Threadpool - add thd_wait_begin/thd_wait_end to the network IO functions
parent
35bc8f9f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
16 deletions
+66
-16
include/mysql/plugin_audit.h.pp
include/mysql/plugin_audit.h.pp
+2
-1
include/mysql/plugin_auth.h.pp
include/mysql/plugin_auth.h.pp
+2
-1
include/mysql/plugin_ftparser.h.pp
include/mysql/plugin_ftparser.h.pp
+2
-1
include/mysql/service_thd_wait.h
include/mysql/service_thd_wait.h
+2
-1
include/violite.h
include/violite.h
+3
-1
sql/scheduler.cc
sql/scheduler.cc
+13
-0
vio/viosocket.c
vio/viosocket.c
+42
-11
No files found.
include/mysql/plugin_audit.h.pp
View file @
41013f16
...
...
@@ -43,7 +43,8 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG
=
8
,
THD_WAIT_GROUP_COMMIT
=
9
,
THD_WAIT_SYNC
=
10
,
THD_WAIT_LAST
=
11
THD_WAIT_NET
=
11
,
THD_WAIT_LAST
=
12
}
thd_wait_type
;
extern
struct
thd_wait_service_st
{
void
(
*
thd_wait_begin_func
)(
void
*
,
int
);
...
...
include/mysql/plugin_auth.h.pp
View file @
41013f16
...
...
@@ -43,7 +43,8 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG
=
8
,
THD_WAIT_GROUP_COMMIT
=
9
,
THD_WAIT_SYNC
=
10
,
THD_WAIT_LAST
=
11
THD_WAIT_NET
=
11
,
THD_WAIT_LAST
=
12
}
thd_wait_type
;
extern
struct
thd_wait_service_st
{
void
(
*
thd_wait_begin_func
)(
void
*
,
int
);
...
...
include/mysql/plugin_ftparser.h.pp
View file @
41013f16
...
...
@@ -43,7 +43,8 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG
=
8
,
THD_WAIT_GROUP_COMMIT
=
9
,
THD_WAIT_SYNC
=
10
,
THD_WAIT_LAST
=
11
THD_WAIT_NET
=
11
,
THD_WAIT_LAST
=
12
}
thd_wait_type
;
extern
struct
thd_wait_service_st
{
void
(
*
thd_wait_begin_func
)(
void
*
,
int
);
...
...
include/mysql/service_thd_wait.h
View file @
41013f16
...
...
@@ -74,7 +74,8 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG
=
8
,
THD_WAIT_GROUP_COMMIT
=
9
,
THD_WAIT_SYNC
=
10
,
THD_WAIT_LAST
=
11
THD_WAIT_NET
=
11
,
THD_WAIT_LAST
=
12
}
thd_wait_type
;
extern
struct
thd_wait_service_st
{
...
...
include/violite.h
View file @
41013f16
...
...
@@ -105,7 +105,9 @@ my_bool vio_is_connected(Vio *vio);
ssize_t
vio_pending
(
Vio
*
vio
);
#endif
/* Set timeout for a network operation. */
int
vio_timeout
(
Vio
*
vio
,
uint
which
,
int
timeout_sec
);
extern
int
vio_timeout
(
Vio
*
vio
,
uint
which
,
int
timeout_sec
);
extern
void
vio_set_wait_callback
(
void
(
*
before_wait
)(
void
),
void
(
*
after_wait
)(
void
));
/* Connect to a peer. */
my_bool
vio_socket_connect
(
Vio
*
vio
,
struct
sockaddr
*
addr
,
socklen_t
len
,
int
timeout
);
...
...
sql/scheduler.cc
View file @
41013f16
...
...
@@ -27,6 +27,7 @@
#include "mysqld.h"
#include "sql_class.h"
#include "sql_callback.h"
#include <violite.h>
/*
End connection, in case when we are using 'no-threads'
...
...
@@ -61,6 +62,15 @@ static void scheduler_wait_sync_begin(void) {
static
void
scheduler_wait_sync_end
(
void
)
{
thd_wait_end
(
NULL
);
}
static
void
scheduler_wait_net_begin
(
void
)
{
thd_wait_begin
(
NULL
,
THD_WAIT_NET
);
}
static
void
scheduler_wait_net_end
(
void
)
{
thd_wait_end
(
NULL
);
}
};
/**@}*/
...
...
@@ -76,6 +86,9 @@ void scheduler_init() {
scheduler_wait_lock_end
);
thr_set_sync_wait_callback
(
scheduler_wait_sync_begin
,
scheduler_wait_sync_end
);
vio_set_wait_callback
(
scheduler_wait_net_begin
,
scheduler_wait_net_end
);
}
...
...
vio/viosocket.c
View file @
41013f16
...
...
@@ -37,6 +37,38 @@
# include <sys/filio.h>
#endif
/* Network io wait callbacks for threadpool */
static
void
(
*
before_io_wait
)(
void
)
=
0
;
static
void
(
*
after_io_wait
)(
void
)
=
0
;
/* Wait callback macros (both performance schema and threadpool */
#define START_SOCKET_WAIT(locker, state_ptr, sock, which) \
do \
{ \
MYSQL_START_SOCKET_WAIT(locker, state_ptr, sock, \
which, 0); \
if (before_io_wait) \
before_io_wait(); \
} while(0)
#define END_SOCKET_WAIT(locker) \
do \
{ \
MYSQL_END_SOCKET_WAIT(locker, 0); \
if (after_io_wait) \
after_io_wait(); \
} while(0)
void
vio_set_wait_callback
(
void
(
*
before_wait
)(
void
),
void
(
*
after_wait
)(
void
))
{
before_io_wait
=
before_wait
;
after_io_wait
=
after_wait
;
}
int
vio_errno
(
Vio
*
vio
__attribute__
((
unused
)))
{
/* These transport types are not Winsock based. */
...
...
@@ -903,12 +935,12 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
*/
if
(
timeout
!=
0
&&
vio
->
async_context
&&
vio
->
async_context
->
active
)
{
MYSQL_
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
,
0
);
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
);
ret
=
my_io_wait_async
(
vio
->
async_context
,
event
,
timeout
);
if
(
ret
==
0
)
errno
=
SOCKET_ETIMEDOUT
;
MYSQL_END_SOCKET_WAIT
(
locker
,
0
);
END_SOCKET_WAIT
(
locker
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -933,8 +965,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
break
;
}
MYSQL_START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
,
0
);
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
);
/*
Wait for the I/O event and return early in case of
error or timeout.
...
...
@@ -957,7 +988,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
break
;
}
MYSQL_END_SOCKET_WAIT
(
locker
,
0
);
END_SOCKET_WAIT
(
locker
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -978,12 +1009,12 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
*/
if
(
timeout
!=
0
&&
vio
->
async_context
&&
vio
->
async_context
->
active
)
{
MYSQL_
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
,
0
);
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
);
ret
=
my_io_wait_async
(
vio
->
async_context
,
event
,
timeout
);
if
(
ret
==
0
)
WSASetLastError
(
SOCKET_ETIMEDOUT
);
MYSQL_END_SOCKET_WAIT
(
locker
,
0
);
END_SOCKET_WAIT
(
locker
);
DBUG_RETURN
(
ret
);
}
...
...
@@ -1014,12 +1045,12 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout)
break
;
}
MYSQL_START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
,
0
);
START_SOCKET_WAIT
(
locker
,
&
state
,
vio
->
mysql_socket
,
PSI_SOCKET_SELECT
);
/* The first argument is ignored on Windows. */
ret
=
select
(
0
,
&
readfds
,
&
writefds
,
&
exceptfds
,
(
timeout
>=
0
)
?
&
tm
:
NULL
);
MYSQL_END_SOCKET_WAIT
(
locker
,
0
);
END_SOCKET_WAIT
(
locker
);
/* Set error code to indicate a timeout error. */
if
(
ret
==
0
)
...
...
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