From: Christopher Powers Date: July 20 2011 6:47pm Subject: bzr push into mysql-trunk branch (chris.powers:3322 to 3324) WL#4896 List-Archive: http://lists.mysql.com/commits/140394 Message-Id: <201107201847.p6KIlcWD021375@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3324 Christopher Powers 2011-07-20 WL#4896 "Performance Schema Net IO" - Handle socket accept() more effectively for listener sockets modified: sql/mysqld.cc storage/perfschema/pfs.cc 3323 Christopher Powers 2011-07-19 WL#4896 "Performance Schema Net IO" Fix for socket accept() modified: include/mysql/psi/mysql_socket.h 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 === modified file 'include/mysql/psi/mysql_socket.h' --- a/include/mysql/psi/mysql_socket.h 2011-07-19 07:17:11 +0000 +++ b/include/mysql/psi/mysql_socket.h 2011-07-19 16:39:30 +0000 @@ -880,16 +880,20 @@ inline_mysql_socket_accept 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); + } + else + { + socket_accept.fd= accept(socket_listen.fd, addr, addr_len); + } - /** 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); + /** 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; - } + 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-19 07:17:11 +0000 +++ b/sql/mysqld.cc 2011-07-20 18:44:46 +0000 @@ -5502,6 +5502,7 @@ void handle_connections_sockets() #ifdef HAVE_POLL int socket_count= 0; struct pollfd fds[2]; // for ip_sock and unix_sock + MYSQL_SOCKET pfs_fds[2]; // for performance schema #else fd_set readFDs,clientFDs; uint max_used_connection= (uint)(max(mysql_socket_getfd(ip_sock), mysql_socket_getfd(unix_sock))+1); @@ -5522,6 +5523,7 @@ void handle_connections_sockets() #ifdef HAVE_POLL fds[socket_count].fd= mysql_socket_getfd(ip_sock); fds[socket_count].events= POLLIN; + pfs_fds[socket_count]= ip_sock; socket_count++; #else FD_SET(mysql_socket_getfd(ip_sock), &clientFDs); @@ -5535,6 +5537,7 @@ void handle_connections_sockets() #ifdef HAVE_POLL fds[socket_count].fd= mysql_socket_getfd(unix_sock); fds[socket_count].events= POLLIN; + pfs_fds[socket_count]= unix_sock; socket_count++; #else FD_SET(mysql_socket_getfd(unix_sock), &clientFDs); @@ -5579,7 +5582,7 @@ void handle_connections_sockets() { if (fds[i].revents & POLLIN) { - mysql_socket_setfd(&sock, fds[i].fd); + sock= pfs_fds[i]; #ifdef HAVE_FCNTL flags= fcntl(mysql_socket_getfd(sock), F_GETFL, 0); #else === modified file 'storage/perfschema/pfs.cc' --- a/storage/perfschema/pfs.cc 2011-07-17 03:30:21 +0000 +++ b/storage/perfschema/pfs.cc 2011-07-20 18:44:46 +0000 @@ -2761,8 +2761,10 @@ get_thread_socket_locker_v1(PSI_socket_l DBUG_ASSERT(static_cast (op) < array_elements(socket_operation_map)); DBUG_ASSERT(state != NULL); PFS_socket *pfs_socket= reinterpret_cast (socket); + if (unlikely(pfs_socket == NULL)) return NULL; + DBUG_ASSERT(pfs_socket->m_class != NULL); if (pfs_socket->m_idle || !pfs_socket->m_enabled) No bundle (reason: useless for push emails).