3379 Christopher Powers 2011-08-18
WL#4896 "Performance Schema Net IO"
Disable socket_instances check in mtr_check.sql until
incomplete test case cleanup can be ruled out as a source
of failures, particularly with RPL.
modified:
mysql-test/include/mtr_check.sql
3378 Christopher Powers 2011-08-18
WL#4896 "Performance Schema Net IO"
Yet a third condition resulting in orphaned socket instances:
Even if all instrumentation is disabled, the socket still needs
to be destroyed after closesocket() is called.
get_thread_socket_locker() must be sensitive to this condition.
modified:
storage/perfschema/pfs.cc
3377 Christopher Powers 2011-08-18
WL#4896 "Performance Schema Net IO"
Two bugs caused orphaned socket instances:
1. If there is no thread instrumentation, then get_thread_socket_locker() returns a
null locker, preventing the PFS socket from being destroyed following closesocket().
2. SSL authentication calls vio_reset() for the active connection, which reset the
PSI pointer for the corresponding socket. This prevents a locker from being created
on a subsequent call to closesocket(), and the PFS socket is never deleted.
modified:
storage/perfschema/pfs.cc
vio/vio.c
3376 Christopher Powers 2011-08-17
WL#4896 "Performance Schema Net IO"
- Compiler warning in pfs.cc
modified:
storage/perfschema/pfs.cc
=== modified file 'mysql-test/include/mtr_check.sql'
--- a/mysql-test/include/mtr_check.sql 2011-08-17 21:08:59 +0000
+++ b/mysql-test/include/mtr_check.sql 2011-08-18 07:28:08 +0000
@@ -43,7 +43,7 @@ BEGIN
order by OBJECT_TYPE, OBJECT_SCHEMA, OBJECT_NAME;
-- Leave the same number of socket instances
- SELECT COUNT(*) FROM performance_schema.socket_instances;
+ --SELECT COUNT(*) FROM performance_schema.socket_instances;
END||
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2011-08-17 22:46:42 +0000
+++ b/storage/perfschema/pfs.cc 2011-08-18 05:58:49 +0000
@@ -2835,19 +2835,27 @@ get_thread_socket_locker_v1(PSI_socket_l
return NULL;
DBUG_ASSERT(pfs_socket->m_class != NULL);
- DBUG_ASSERT(!(pfs_socket->m_idle && op == PSI_SOCKET_CLOSE));
+
+ my_bool socket_close= false;
+ register uint flags= 0;
if (!pfs_socket->m_enabled || pfs_socket->m_idle)
- return NULL;
+ {
+ if (op == PSI_SOCKET_CLOSE)
+ socket_close= true;
+ else
+ return NULL;
+ }
- register uint flags;
+ PFS_thread *pfs_thread= pfs_socket->m_thread_owner;
- if (flag_thread_instrumentation)
+ if (flag_thread_instrumentation && likely(pfs_thread != NULL) &&
+ likely(!socket_close))
{
- PFS_thread *pfs_thread= pfs_socket->m_thread_owner;
+ //PFS_thread *pfs_thread= pfs_socket->m_thread_owner;
- if (unlikely(pfs_thread == NULL))
- return NULL;
+ //if (unlikely(pfs_thread == NULL))
+ // return NULL;
/*
If instrumentation for this thread has been disabled, then return a null
@@ -2856,9 +2864,7 @@ get_thread_socket_locker_v1(PSI_socket_l
*/
if (!pfs_thread->m_enabled)
{
- if (op == PSI_SOCKET_CLOSE)
- flags= 0;
- else
+ if (op != PSI_SOCKET_CLOSE)
return NULL;
}
else
@@ -2901,38 +2907,39 @@ get_thread_socket_locker_v1(PSI_socket_l
}
else
{
- if (pfs_socket->m_timed)
+ if (!socket_close)
{
- flags= STATE_FLAG_TIMED;
- }
- else
- {
- flags= 0;
-
- /*
- Even if timing is disabled, end_socket_wait() still needs a locker to
- capture the number of bytes sent or received by the socket operation.
- For operations that do not have a byte count, then just increment the
- event counter and return a NULL locker.
- */
- switch (op)
+ if (pfs_socket->m_timed)
+ {
+ flags= STATE_FLAG_TIMED;
+ }
+ else
{
- case PSI_SOCKET_CONNECT:
- case PSI_SOCKET_CREATE:
- case PSI_SOCKET_BIND:
- case PSI_SOCKET_SEEK:
- case PSI_SOCKET_OPT:
- case PSI_SOCKET_STAT:
- case PSI_SOCKET_SHUTDOWN:
- case PSI_SOCKET_CLOSE:
- case PSI_SOCKET_SELECT:
+ /*
+ Even if timing is disabled, end_socket_wait() still needs a locker to
+ capture the number of bytes sent or received by the socket operation.
+ For operations that do not have a byte count, then just increment the
+ event counter and return a NULL locker.
+ */
+ switch (op)
{
- pfs_socket->m_socket_stat.m_io_stat.m_misc.aggregate_counted();
- return NULL;
+ case PSI_SOCKET_CONNECT:
+ case PSI_SOCKET_CREATE:
+ case PSI_SOCKET_BIND:
+ case PSI_SOCKET_SEEK:
+ case PSI_SOCKET_OPT:
+ case PSI_SOCKET_STAT:
+ case PSI_SOCKET_SHUTDOWN:
+ case PSI_SOCKET_CLOSE:
+ case PSI_SOCKET_SELECT:
+ {
+ pfs_socket->m_socket_stat.m_io_stat.m_misc.aggregate_counted();
+ return NULL;
+ }
+ break;
+ default:
+ break;
}
- break;
- default:
- break;
}
}
}
=== modified file 'vio/vio.c'
--- a/vio/vio.c 2011-07-08 21:31:33 +0000
+++ b/vio/vio.c 2011-08-18 05:29:13 +0000
@@ -184,6 +184,9 @@ my_bool vio_reset(Vio* vio, enum enum_vi
vio_init(vio, type, sd, flags);
+ /* Preserve perfschema info for this connection */
+ vio->mysql_socket.m_psi= old_vio.mysql_socket.m_psi;
+
#ifdef HAVE_OPENSSL
vio->ssl_arg= ssl;
#endif
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (chris.powers:3376 to 3379) WL#4896 | Christopher Powers | 22 Aug |