3326 Christopher Powers 2011-07-20
WL#4896 "Performance Schema Net IO"
- Remove unnecessary debug asserts in set_socket() functions
- Use 'sql' instead of 'com' category for socket keys and
update socket_instances_func.test accordingly
@ storage/perfschema/pfs.cc
Remove unnecessary DBUG_ASSERTs
modified:
mysql-test/suite/perfschema/r/socket_instances_func.result
mysql-test/suite/perfschema/t/socket_instances_func.test
storage/perfschema/pfs.cc
3325 Christopher Powers 2011-07-20
WL#4896 "Performance Schema Net IO"
Capture number of bytes read from socket recv() for
sockets in IDLE state.
modified:
sql/sql_parse.cc
storage/perfschema/pfs.cc
=== modified file 'mysql-test/suite/perfschema/r/socket_instances_func.result'
--- a/mysql-test/suite/perfschema/r/socket_instances_func.result 2011-07-15 00:50:02 +0000
+++ b/mysql-test/suite/perfschema/r/socket_instances_func.result 2011-07-21 00:12:39 +0000
@@ -72,52 +72,52 @@ WHERE PORT = @port;
Expect 1
1
# Check the content for the default connection (unix domain)
-SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
- AND IP = '' AND PORT = 0 AS 'Expect 1'
+SELECT COUNT(*) = 1 as 'Expect 1'
FROM performance_schema.socket_instances
-WHERE THREAD_ID = @thread_id;
+WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'
+AND PORT = 0 AND THREAD_ID = @thread_id;
Expect 1
1
# Characteristics of 'server_tcpip_socket' entry
# Server listening socket, TCP/IP
-# There is only one entry with 'wait/io/socket/com/server_tcpip_socket'.
-# It shares the same thread id as 'wait/io/socket/com/server_unix_socket'.
+# There is only one entry with 'wait/io/socket/sql/server_tcpip_socket'.
+# It shares the same thread id as 'wait/io/socket/sql/server_unix_socket'.
SELECT COUNT(*) = 1 AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
Expect 1
1
# Get the 'server_tcpip_socket' thread id
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
# Check the content.
SELECT THREAD_ID = @thread_id
AND PORT = <MASTER_MYPORT> AND IP = '0.0.0.0'
AND STATE = 'ACTIVE' AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
Expect 1
1
# Characteristics of 'server_unix_socket' entry
# Server listening socket, unix domain (socket file)
-# There is only one entry with 'wait/io/socket/com/server_unix_socket'.
-# It shares the same thread id as 'wait/io/socket/com/server_tcpip_socket'.
+# There is only one entry with 'wait/io/socket/sql/server_unix_socket'.
+# It shares the same thread id as 'wait/io/socket/sql/server_tcpip_socket'.
SELECT COUNT(*) = 1 AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
Expect 1
1
# Get the 'server_unix_socket' thread id
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
# Check the content.
SELECT THREAD_ID = @thread_id
AND PORT = 0 AND IP = ''
AND STATE = 'ACTIVE' AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
Expect 1
1
# Server listening sockets (TCP and Unix) are handled on the same thread
@@ -136,7 +136,7 @@ select @match_thread_id;
@match_thread_id
1
# Check content for client connection 1 (tcpip)
-SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = '127.0.0.1'
AND PORT = @port
AS 'Expect 1'
@@ -152,7 +152,7 @@ WHERE THREAD_ID = @thread_id;
Expect 1
1
# Check content for client connection 2 (tcpip)
-SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = '127.0.0.1'
AND PORT = @port
AS 'Expect 1'
@@ -168,7 +168,7 @@ WHERE THREAD_ID = @thread_id;
Expect 1
1
# Check the content for client connection 3 (unix domain).
-SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = ''
AND PORT = 0
AS 'Expect 1'
@@ -191,9 +191,9 @@ NOT IN (SELECT EVENT_NAME,OBJECT_INSTANC
FROM my_socket_instances)
ORDER BY THREAD_ID;
EVENT_NAME IP
-wait/io/socket/com/client_connection 127.0.0.1
-wait/io/socket/com/client_connection 127.0.0.1
-wait/io/socket/com/client_connection
+wait/io/socket/sql/client_connection 127.0.0.1
+wait/io/socket/sql/client_connection 127.0.0.1
+wait/io/socket/sql/client_connection
# Disconnect con1, con2 and con3
# Show differences to socket_instances before con1,con1 connecting.
# There should be none.
=== modified file 'mysql-test/suite/perfschema/t/socket_instances_func.test'
--- a/mysql-test/suite/perfschema/t/socket_instances_func.test 2011-07-15 00:50:02 +0000
+++ b/mysql-test/suite/perfschema/t/socket_instances_func.test 2011-07-21 00:12:39 +0000
@@ -182,16 +182,16 @@ WHERE PORT = @port;
--echo # Check the content for the default connection (unix domain)
# EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE
-# wait/io/socket/com/client_connection 139799531958280 16 37 0 ACTIVE
+# wait/io/socket/sql/client_connection 139799531958280 16 37 0 ACTIVE
--disable_query_log
eval set @thread_id = $con0_thread_id;
--enable_query_log
-SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
- AND IP = '' AND PORT = 0 AS 'Expect 1'
+SELECT COUNT(*) = 1 as 'Expect 1'
FROM performance_schema.socket_instances
-WHERE THREAD_ID = @thread_id;
+WHERE EVENT_NAME = 'wait/io/socket/sql/client_connection'
+AND PORT = 0 AND THREAD_ID = @thread_id;
#
# VERIFY SERVER LISTENING SOCKET, TCP/IP
@@ -199,19 +199,19 @@ WHERE THREAD_ID = @thread_id;
--echo # Characteristics of 'server_tcpip_socket' entry
--echo # Server listening socket, TCP/IP
---echo # There is only one entry with 'wait/io/socket/com/server_tcpip_socket'.
---echo # It shares the same thread id as 'wait/io/socket/com/server_unix_socket'.
+--echo # There is only one entry with 'wait/io/socket/sql/server_tcpip_socket'.
+--echo # It shares the same thread id as 'wait/io/socket/sql/server_unix_socket'.
SELECT COUNT(*) = 1 AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
# Store the thread id of server_tcpip_socket
--echo # Get the 'server_tcpip_socket' thread id
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
let $server_tcpip_thread_id= `SELECT @thread_id`;
@@ -222,7 +222,7 @@ eval SELECT THREAD_ID = @thread_id
AND PORT = $MASTER_MYPORT AND IP = '0.0.0.0'
AND STATE = 'ACTIVE' AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_tcpip_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket';
#
# VERIFY SERVER LISTENING SOCKET, UNIX DOMAIN
@@ -230,19 +230,19 @@ WHERE EVENT_NAME = 'wait/io/socket/com/s
--echo # Characteristics of 'server_unix_socket' entry
--echo # Server listening socket, unix domain (socket file)
---echo # There is only one entry with 'wait/io/socket/com/server_unix_socket'.
---echo # It shares the same thread id as 'wait/io/socket/com/server_tcpip_socket'.
+--echo # There is only one entry with 'wait/io/socket/sql/server_unix_socket'.
+--echo # It shares the same thread id as 'wait/io/socket/sql/server_tcpip_socket'.
SELECT COUNT(*) = 1 AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
# Store the thread id of 'server_unix_socket'
--echo # Get the 'server_unix_socket' thread id
SELECT THREAD_ID INTO @thread_id
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
let $server_unix_thread_id= `SELECT @thread_id`;
@@ -251,7 +251,7 @@ eval SELECT THREAD_ID = @thread_id
AND PORT = 0 AND IP = ''
AND STATE = 'ACTIVE' AS 'Expect 1'
FROM performance_schema.socket_instances
-WHERE EVENT_NAME = 'wait/io/socket/com/server_unix_socket';
+WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket';
#
# VERIFY SERVER LISTENING SOCKET THREAD IDs
@@ -287,7 +287,7 @@ select @match_thread_id;
#
# EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE
-# wait/io/socket/com/client_connection 140707865187120 18 59 127.0.0.1 59298 IDLE or ACTIVE
+# wait/io/socket/sql/client_connection 140707865187120 18 59 127.0.0.1 59298 IDLE or ACTIVE
--echo # Check content for client connection 1 (tcpip)
@@ -296,7 +296,7 @@ eval set @port = $con1_port;
eval set @thread_id = $con1_thread_id;
--enable_query_log
-eval SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+eval SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = '127.0.0.1'
AND PORT = @port
AS 'Expect 1'
@@ -315,7 +315,7 @@ WHERE THREAD_ID = @thread_id;
#
# EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE
-# wait/io/socket/com/client_connection 140707865187120 18 59 127.0.0.1 59298 IDLE or ACTIVE
+# wait/io/socket/sql/client_connection 140707865187120 18 59 127.0.0.1 59298 IDLE or ACTIVE
--echo # Check content for client connection 2 (tcpip)
@@ -324,7 +324,7 @@ eval set @port = $con2_port;
eval set @thread_id = $con2_thread_id;
--enable_query_log
-eval SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+eval SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = '127.0.0.1'
AND PORT = @port
AS 'Expect 1'
@@ -343,7 +343,7 @@ WHERE THREAD_ID = @thread_id;
#
# EVENT_NAME OBJECT_INSTANCE_BEGIN THREAD_ID SOCKET_ID IP PORT STATE
-# wait/io/socket/com/client_connection 139799531958280 16 37 0 IDLE or ACTIVE
+# wait/io/socket/sql/client_connection 139799531958280 16 37 0 IDLE or ACTIVE
--echo # Check the content for client connection 3 (unix domain).
@@ -351,7 +351,7 @@ WHERE THREAD_ID = @thread_id;
eval set @thread_id = $con3_thread_id;
--enable_query_log
-eval SELECT EVENT_NAME = 'wait/io/socket/com/client_connection'
+eval SELECT EVENT_NAME = 'wait/io/socket/sql/client_connection'
AND IP = ''
AND PORT = 0
AS 'Expect 1'
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2011-07-20 23:11:24 +0000
+++ b/storage/perfschema/pfs.cc 2011-07-21 00:12:39 +0000
@@ -4700,11 +4700,10 @@ static void end_socket_wait_v1(PSI_socke
static void set_socket_state_v1(PSI_socket *socket, PSI_socket_state state)
{
- DBUG_ASSERT(socket);
DBUG_ASSERT((state == PSI_SOCKET_STATE_IDLE) || (state == PSI_SOCKET_STATE_ACTIVE));
- PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
- if (unlikely(pfs == NULL))
+ if (unlikely(socket == NULL))
return;
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
pfs->m_idle= (state == PSI_SOCKET_STATE_IDLE);
}
@@ -4716,12 +4715,11 @@ static void set_socket_info_v1(PSI_socke
const struct sockaddr *addr,
socklen_t addr_len)
{
- DBUG_ASSERT(socket);
- PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
-
- if (unlikely(pfs == NULL))
+ if (unlikely(socket == NULL))
return;
+ PFS_socket *pfs= reinterpret_cast<PFS_socket*>(socket);
+
/** Set socket descriptor */
if (fd != NULL)
pfs->m_fd= *fd;
@@ -4745,13 +4743,10 @@ static void set_socket_info_v1(PSI_socke
*/
static void set_socket_thread_owner_v1(PSI_socket *socket)
{
- if (likely(socket != NULL))
- {
- PFS_socket *pfs_socket= reinterpret_cast<PFS_socket*>(socket);
- if (unlikely(pfs_socket == NULL))
- return;
- pfs_socket->m_thread_owner= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
- }
+ if (unlikely(socket == NULL))
+ return;
+ PFS_socket *pfs_socket= reinterpret_cast<PFS_socket*>(socket);
+ pfs_socket->m_thread_owner= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
}
/**
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk branch (chris.powers:3325 to 3326) WL#4896 | Christopher Powers | 21 Jul |