List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:July 19 2011 4:41pm
Subject:bzr push into mysql-trunk branch (chris.powers:3320 to 3322) WL#4896
View as plain text  
 3322 Christopher Powers	2011-07-19
      WL#4896 "Performance Schema Net IO"
      
      - Restored check for null pointer in mysql_socket_socket() and mysql_socket_accept()

    modified:
      include/mysql/psi/mysql_socket.h
      sql/mysqld.cc
 3321 Christopher Powers	2011-07-19
      WL#4896 "Performance Schema Net IO"
      
      Improved stat collection for socket accept() by attributing
      wait time and op count to listener socket instead of new socket.

    modified:
      include/mysql/psi/mysql_socket.h
 3320 Christopher Powers	2011-07-18
      WL#4896 "Performance Schema Net IO"
      
      - Fix to recent performance improvements

    modified:
      storage/perfschema/pfs_instr.cc
=== modified file 'include/mysql/psi/mysql_socket.h'
--- a/include/mysql/psi/mysql_socket.h	2011-07-17 03:30:21 +0000
+++ b/include/mysql/psi/mysql_socket.h	2011-07-19 07:17:11 +0000
@@ -464,7 +464,7 @@ inline_mysql_end_socket_wait(struct PSI_
 */
 #ifdef HAVE_PSI_SOCKET_INTERFACE
   #define mysql_socket_accept(K, FD, AP, LP) \
-    inline_mysql_socket_accept(K, /*__FILE__, __LINE__,*/ FD, AP, LP)
+    inline_mysql_socket_accept(__FILE__, __LINE__, K, FD, AP, LP)
 #else
   #define mysql_socket_accept(FD, AP, LP) \
     inline_mysql_socket_accept(FD, AP, LP)
@@ -531,8 +531,9 @@ inline_mysql_socket_socket
   mysql_socket.fd= socket(domain, type, protocol);
 
 #ifdef HAVE_PSI_SOCKET_INTERFACE
-  mysql_socket.m_psi = PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd);
-  if (likely(mysql_socket.fd != INVALID_SOCKET))
+  mysql_socket.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&mysql_socket.fd);
+  
+  if (likely(mysql_socket.fd != INVALID_SOCKET && mysql_socket.m_psi != NULL))
     PSI_CALL(set_socket_info)(mysql_socket.m_psi, &mysql_socket.fd, NULL, 0);
 #endif
   return mysql_socket;
@@ -863,23 +864,32 @@ static inline MYSQL_SOCKET
 inline_mysql_socket_accept
 (
 #ifdef HAVE_PSI_SOCKET_INTERFACE
-  PSI_socket_key key, //const char *src_file, uint src_line,
+  const char *src_file, uint src_line, PSI_socket_key key,
 #endif
   MYSQL_SOCKET socket_listen, struct sockaddr *addr, socklen_t *addr_len)
 {
   MYSQL_SOCKET socket_accept= MYSQL_INVALID_SOCKET;
+#ifdef HAVE_PSI_SOCKET_INTERFACE
   socklen_t addr_length= (addr_len != NULL) ? *addr_len : 0;
+  struct PSI_socket_locker *locker;
+  PSI_socket_locker_state state;
+  locker= PSI_CALL(get_thread_socket_locker)(&state, socket_listen.m_psi,
+                                             PSI_SOCKET_CONNECT);
+  if (likely(locker != NULL))
+  {
+    PSI_CALL(start_socket_wait)(locker, (size_t)0, src_file, src_line);
+    socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
+    PSI_CALL(end_socket_wait)(locker, (size_t)0);
 
-  socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
-
-  /** Initialize the instrument with the new socket descriptor and address */
-  #ifdef HAVE_PSI_SOCKET_INTERFACE
-  socket_accept.m_psi= PSI_CALL(init_socket)(key, (const my_socket*)&socket_accept.fd);
-
-  if (likely(socket_accept.fd != INVALID_SOCKET))
-    PSI_CALL(set_socket_info)(socket_accept.m_psi, &socket_accept.fd,
-                             addr, addr_length);
-  return socket_accept;
+    /** Initialize the instrument with the new socket descriptor and address */
+    socket_accept.m_psi=
+	           PSI_CALL(init_socket)(key, (const my_socket*)&socket_accept.fd);
+
+    if (likely(socket_accept.fd != INVALID_SOCKET) && socket_accept.m_psi != NULL)
+      PSI_CALL(set_socket_info)(socket_accept.m_psi, &socket_accept.fd,
+                                addr, addr_length);
+    return socket_accept;
+  }
 #endif
   socket_accept.fd= accept(socket_listen.fd, addr, addr_len);
   return socket_accept;

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-07-08 21:31:33 +0000
+++ b/sql/mysqld.cc	2011-07-19 07:17:11 +0000
@@ -8664,6 +8664,9 @@ void init_server_psi_keys(void)
   count= array_elements(all_server_stages);
   mysql_stage_register(category, all_server_stages, count);
 
+  count= array_elements(all_server_sockets);
+  mysql_socket_register(category, all_server_sockets, count);
+
 #ifdef HAVE_PSI_STATEMENT_INTERFACE
   init_sql_statement_info();
   count= array_elements(sql_statement_info);
@@ -8674,9 +8677,6 @@ void init_server_psi_keys(void)
   count= array_elements(com_statement_info);
   mysql_statement_register(category, com_statement_info, count);
 #endif
-
-  count= array_elements(all_server_sockets);
-  mysql_socket_register(category, all_server_sockets, count);
 }
 
 #endif /* HAVE_PSI_INTERFACE */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (chris.powers:3320 to 3322) WL#4896Christopher Powers20 Jul