#At file:///home/cpowers/work/dev/dev-wl4896/mysql/ based on revid:chris.powers@stripped
3160 Christopher Powers 2010-08-04
Merged with next-mr
Integrated WL 4895 "Performance Schema Table IO"
Integrated bug 55087, "Performance schema: optimization of the instrumentation interface"
removed:
include/mysql/psi/mysql_network.h
added:
storage/perfschema/table_helper.h.moved
modified:
include/mysql/psi/mysql_socket.h
include/mysql/psi/psi_abi_v1.h.pp
include/mysql/psi/psi_abi_v2.h.pp
sql/mysqld.cc
storage/perfschema/pfs.cc
storage/perfschema/table_events_waits.cc
storage/perfschema/table_helper.h
=== removed file 'include/mysql/psi/mysql_network.h'
--- a/include/mysql/psi/mysql_network.h 2010-05-10 19:16:42 +0000
+++ b/include/mysql/psi/mysql_network.h 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License as
-published by the Free Software Foundation; version 2 of the
-License.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-02110-1301 USA
-*/
-
-#ifndef MYSQL_NETWORK_H
-#define MYSQL_NETWORK_H
-
-/* For strlen() */
-#include <string.h>
-/* For MY_STAT */
-#include <my_dir.h>
-/* For my_chsize */
-#include <my_sys.h>
-
-/**
- @file mysql/psi/mysql_network.h
-[...]
-*/
-
-#include "mysql/psi/psi.h"
-
-/**
- @defgroup Network_instrumentation Network Instrumentation
- @ingroup Instrumentation_interface
- @{
-*/
-
-
-/** @} (end of group Network_instrumentation) */
-
-#endif
-
=== modified file 'include/mysql/psi/mysql_socket.h'
--- a/include/mysql/psi/mysql_socket.h 2010-07-29 19:56:17 +0000
+++ b/include/mysql/psi/mysql_socket.h 2010-08-04 15:47:50 +0000
@@ -42,6 +42,24 @@ Foundation, Inc., 51 Franklin St, Fifth
*/
/**
+ @def MYSQL_SOCKET_WAIT_VARIABLES
+ Instrumentation helper for socket waits.
+ This instrumentation declares local variables.
+ Do not use a ';' after this macro
+ @param LOCKER the locker
+ @param STATE the locker state
+ @sa MYSQL_START_SOCKET_WAIT.
+ @sa MYSQL_END_SOCKET_WAIT.
+*/
+#ifdef HAVE_PSI_INTERFACE
+ #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE) \
+ PSI_socket_locker* LOCKER; \
+ PSI_socket_locker_state STATE;
+#else
+ #define MYSQL_SOCKET_WAIT_VARIABLES(LOCKER, STATE)
+#endif
+
+/**
@def MYSQL_START_SOCKET_WAIT
Instrumentation helper for socket waits.
This instrumentation marks the start of a wait event.
@@ -56,7 +74,7 @@ Foundation, Inc., 51 Franklin St, Fifth
inline_mysql_start_socket_wait(PSI, OP, INDEX, FLAGS, __FILE__, __LINE__)
#else
#define MYSQL_START_SOCKET_WAIT(PSI, OP, INDEX, FLAGS) \
- NULL
+ do {} while (0)
#endif
/**
@@ -74,20 +92,23 @@ Foundation, Inc., 51 Franklin St, Fifth
#endif
+
#ifdef HAVE_PSI_INTERFACE
/**
Instrumentation calls for MYSQL_START_SOCKET_WAIT.
@sa MYSQL_START_SOCKET_WAIT.
*/
-static inline struct PSI_socket_locker *
-inline_mysql_start_socket_wait(struct PSI_socket *psi, enum PSI_socket_operation op,
+static inline PSI_socket_locker *
+inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
+ PSI_socket *psi, enum PSI_socket_operation op,
uint index, ulong flags,
const char *src_file, int src_line)
{
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+
if (likely(PSI_server && psi))
{
- locker= PSI_server->get_thread_socket_locker(psi, op);
+ locker= PSI_server->get_thread_socket_locker(state, psi, op);
if (likely(locker != NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -99,7 +120,7 @@ inline_mysql_start_socket_wait(struct PS
@sa MYSQL_END_SOCKET_WAIT.
*/
static inline void
-inline_mysql_end_socket_wait(struct PSI_socket_locker *locker)
+inline_mysql_end_socket_wait(PSI_socket_locker *locker)
{
if (likely(locker != NULL))
PSI_server->end_socket_wait(locker);
@@ -290,7 +311,7 @@ struct st_mysql_socket
for binary compatibility of the @c MYSQL_FILE interface.
*/
- struct PSI_socket *m_psi;
+ PSI_socket *m_psi;
};
/**
@@ -340,10 +361,12 @@ inline_mysql_socket_socketpair
int result = 0;
#if 0 //TBD
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_CREATE);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CREATE);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -369,10 +392,12 @@ inline_mysql_socket_bind
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_BIND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -400,10 +425,12 @@ inline_mysql_socket_getsockname
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_BIND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -428,10 +455,12 @@ inline_mysql_socket_connect
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_CONNECT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -456,10 +485,12 @@ inline_mysql_socket_getpeername
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_BIND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_BIND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -484,10 +515,12 @@ inline_mysql_socket_send
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_SEND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -512,10 +545,12 @@ inline_mysql_socket_recv
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_RECV);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -540,10 +575,12 @@ inline_mysql_socket_sendto
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_SEND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -568,10 +605,12 @@ inline_mysql_socket_recvfrom
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_RECV);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -596,10 +635,12 @@ inline_mysql_socket_sendmsg
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_SEND);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SEND);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -624,10 +665,12 @@ inline_mysql_socket_recvmsg
{
ssize_t result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_RECV);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_RECV);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -652,10 +695,12 @@ inline_mysql_socket_getsockopt
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_OPT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_OPT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -680,10 +725,12 @@ inline_mysql_socket_setsockopt
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_OPT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_OPT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -708,10 +755,12 @@ inline_mysql_socket_listen
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_CONNECT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CONNECT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -736,12 +785,14 @@ inline_mysql_socket_accept
{
MYSQL_SOCKET socket_accept = {0, NULL};
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
: NULL;
if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(socket_accept.m_psi, PSI_SOCKET_CONNECT);
+ locker= PSI_server->get_thread_socket_locker(&state, socket_accept.m_psi, PSI_SOCKET_CONNECT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -772,7 +823,9 @@ inline_mysql_socket_accept4
{
MYSQL_SOCKET socket_accept = {0, NULL};
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
socket_accept.m_psi = PSI_server ? PSI_server->init_socket(key, &socket_accept.fd)
: NULL;
if (likely(PSI_server != NULL && socket_accept.m_psi != NULL))
@@ -806,10 +859,12 @@ inline_mysql_socket_close
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_CLOSE);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_CLOSE);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -834,10 +889,12 @@ inline_mysql_socket_shutdown
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -862,10 +919,12 @@ inline_mysql_socket_sockatmark
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_STAT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_STAT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
@@ -890,10 +949,12 @@ inline_mysql_socket_isfdtype
{
int result;
#ifdef HAVE_PSI_INTERFACE
- struct PSI_socket_locker *locker= NULL;
+ PSI_socket_locker *locker= NULL;
+ PSI_socket_locker_state state;
+
if (likely(PSI_server != NULL && mysql_socket.m_psi != NULL))
{
- locker= PSI_server->get_thread_socket_locker(mysql_socket.m_psi, PSI_SOCKET_STAT);
+ locker= PSI_server->get_thread_socket_locker(&state, mysql_socket.m_psi, PSI_SOCKET_STAT);
if (likely(locker !=NULL))
PSI_server->start_socket_wait(locker, src_file, src_line);
}
=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp 2010-08-04 03:19:48 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp 2010-08-04 15:47:50 +0000
@@ -8,6 +8,7 @@ struct PSI_table_share;
struct PSI_table;
struct PSI_thread;
struct PSI_file;
+struct PSI_socket;
struct PSI_table_locker;
struct PSI_bootstrap
{
@@ -63,11 +64,25 @@ enum PSI_table_operation
PSI_TABLE_UPDATE_ROW= 4,
PSI_TABLE_DELETE_ROW= 5
};
+enum PSI_socket_operation
+{
+ PSI_SOCKET_CREATE= 0,
+ PSI_SOCKET_CONNECT= 1,
+ PSI_SOCKET_BIND= 2,
+ PSI_SOCKET_CLOSE= 3,
+ PSI_SOCKET_SEND= 4,
+ PSI_SOCKET_RECV= 5,
+ PSI_SOCKET_SEEK= 6,
+ PSI_SOCKET_OPT= 7,
+ PSI_SOCKET_STAT= 8,
+ PSI_SOCKET_SHUTDOWN= 9
+};
typedef unsigned int PSI_mutex_key;
typedef unsigned int PSI_rwlock_key;
typedef unsigned int PSI_cond_key;
typedef unsigned int PSI_thread_key;
typedef unsigned int PSI_file_key;
+typedef unsigned int PSI_socket_key;
struct PSI_mutex_info_v1
{
PSI_mutex_key *m_key;
@@ -98,6 +113,12 @@ struct PSI_file_info_v1
const char *m_name;
int m_flags;
};
+struct PSI_socket_info_v1
+{
+ PSI_socket_key *m_key;
+ const char *m_name;
+ int m_flags;
+};
struct PSI_mutex_locker_state_v1
{
uint m_flags;
@@ -164,6 +185,19 @@ struct PSI_table_locker_state_v1
int m_src_line;
void *m_wait;
};
+struct PSI_socket_locker_state_v1
+{
+ uint m_flags;
+ struct PSI_socket *m_socket;
+ struct PSI_thread *m_thread;
+ size_t m_number_of_bytes;
+ ulonglong m_timer_start;
+ ulonglong (*m_timer)(void);
+ enum PSI_socket_operation m_operation;
+ const char* m_src_file;
+ int m_src_line;
+ void *m_wait;
+};
typedef void (*register_mutex_v1_t)
(const char *category, struct PSI_mutex_info_v1 *info, int count);
typedef void (*register_rwlock_v1_t)
@@ -174,6 +208,8 @@ typedef void (*register_thread_v1_t)
(const char *category, struct PSI_thread_info_v1 *info, int count);
typedef void (*register_file_v1_t)
(const char *category, struct PSI_file_info_v1 *info, int count);
+typedef void (*register_socket_v1_t)
+ (const char *category, struct PSI_socket_info_v1 *info, int count);
typedef struct PSI_mutex* (*init_mutex_v1_t)
(PSI_mutex_key key, const void *identity);
typedef void (*destroy_mutex_v1_t)(struct PSI_mutex *mutex);
@@ -183,6 +219,9 @@ typedef void (*destroy_rwlock_v1_t)(stru
typedef struct PSI_cond* (*init_cond_v1_t)
(PSI_cond_key key, const void *identity);
typedef void (*destroy_cond_v1_t)(struct PSI_cond *cond);
+typedef struct PSI_socket* (*init_socket_v1_t)
+ (PSI_socket_key key, const void *identity);
+typedef void (*destroy_socket_v1_t)(struct PSI_socket *socket);
typedef struct PSI_table_share* (*get_table_share_v1_t)
(my_bool temporary, struct TABLE_SHARE *share);
typedef void (*release_table_share_v1_t)(struct PSI_table_share *share);
@@ -231,6 +270,9 @@ typedef struct PSI_file_locker* (*get_th
typedef struct PSI_file_locker* (*get_thread_file_descriptor_locker_v1_t)
(struct PSI_file_locker_state_v1 *state,
File file, enum PSI_file_operation op);
+typedef struct PSI_socket_locker* (*get_thread_socket_locker_v1_t)
+ (struct PSI_socket_locker_state_v1 *state,
+ struct PSI_socket *socket, enum PSI_socket_operation op);
typedef void (*unlock_mutex_v1_t)
(struct PSI_mutex *mutex);
typedef void (*unlock_rwlock_v1_t)
@@ -268,6 +310,18 @@ typedef void (*start_file_wait_v1_t)
const char *src_file, uint src_line);
typedef void (*end_file_wait_v1_t)
(struct PSI_file_locker *locker, size_t count);
+typedef void (*start_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker,
+ const char *src_file, uint src_line);
+typedef void (*end_socket_wait_v1_t)
+ (struct PSI_socket_locker *locker);
+typedef void (*set_socket_descriptor_v1_t)(struct PSI_socket *socket,
+ uint fd);
+typedef void (*set_socket_address_v1_t)(struct PSI_socket *socket,
+ const struct sockaddr * addr);
+typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
+ uint fd,
+ const struct sockaddr * addr);
struct PSI_v1
{
register_mutex_v1_t register_mutex;
@@ -275,12 +329,15 @@ struct PSI_v1
register_cond_v1_t register_cond;
register_thread_v1_t register_thread;
register_file_v1_t register_file;
+ register_socket_v1_t register_socket;
init_mutex_v1_t init_mutex;
destroy_mutex_v1_t destroy_mutex;
init_rwlock_v1_t init_rwlock;
destroy_rwlock_v1_t destroy_rwlock;
init_cond_v1_t init_cond;
destroy_cond_v1_t destroy_cond;
+ init_socket_v1_t init_socket;
+ destroy_socket_v1_t destroy_socket;
get_table_share_v1_t get_table_share;
release_table_share_v1_t release_table_share;
drop_table_share_v1_t drop_table_share;
@@ -301,6 +358,7 @@ struct PSI_v1
get_thread_file_name_locker_v1_t get_thread_file_name_locker;
get_thread_file_stream_locker_v1_t get_thread_file_stream_locker;
get_thread_file_descriptor_locker_v1_t get_thread_file_descriptor_locker;
+ get_thread_socket_locker_v1_t get_thread_socket_locker;
unlock_mutex_v1_t unlock_mutex;
unlock_rwlock_v1_t unlock_rwlock;
signal_cond_v1_t signal_cond;
@@ -321,6 +379,11 @@ struct PSI_v1
end_file_open_wait_and_bind_to_descriptor;
start_file_wait_v1_t start_file_wait;
end_file_wait_v1_t end_file_wait;
+ start_socket_wait_v1_t start_socket_wait;
+ end_socket_wait_v1_t end_socket_wait;
+ set_socket_descriptor_v1_t set_socket_descriptor;
+ set_socket_address_v1_t set_socket_address;
+ set_socket_info_v1_t set_socket_info;
};
typedef struct PSI_v1 PSI;
typedef struct PSI_mutex_info_v1 PSI_mutex_info;
@@ -328,10 +391,12 @@ typedef struct PSI_rwlock_info_v1 PSI_rw
typedef struct PSI_cond_info_v1 PSI_cond_info;
typedef struct PSI_thread_info_v1 PSI_thread_info;
typedef struct PSI_file_info_v1 PSI_file_info;
+typedef struct PSI_socket_info_v1 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v1 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v1 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v1 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v1 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v1 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v1 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
=== modified file 'include/mysql/psi/psi_abi_v2.h.pp'
--- a/include/mysql/psi/psi_abi_v2.h.pp 2010-08-04 03:19:48 +0000
+++ b/include/mysql/psi/psi_abi_v2.h.pp 2010-08-04 15:47:50 +0000
@@ -8,6 +8,7 @@ struct PSI_table_share;
struct PSI_table;
struct PSI_thread;
struct PSI_file;
+struct PSI_socket;
struct PSI_table_locker;
struct PSI_bootstrap
{
@@ -63,11 +64,25 @@ enum PSI_table_operation
PSI_TABLE_UPDATE_ROW= 4,
PSI_TABLE_DELETE_ROW= 5
};
+enum PSI_socket_operation
+{
+ PSI_SOCKET_CREATE= 0,
+ PSI_SOCKET_CONNECT= 1,
+ PSI_SOCKET_BIND= 2,
+ PSI_SOCKET_CLOSE= 3,
+ PSI_SOCKET_SEND= 4,
+ PSI_SOCKET_RECV= 5,
+ PSI_SOCKET_SEEK= 6,
+ PSI_SOCKET_OPT= 7,
+ PSI_SOCKET_STAT= 8,
+ PSI_SOCKET_SHUTDOWN= 9
+};
typedef unsigned int PSI_mutex_key;
typedef unsigned int PSI_rwlock_key;
typedef unsigned int PSI_cond_key;
typedef unsigned int PSI_thread_key;
typedef unsigned int PSI_file_key;
+typedef unsigned int PSI_socket_key;
struct PSI_v2
{
int placeholder;
@@ -112,16 +127,22 @@ struct PSI_table_locker_state_v2
{
int placeholder;
};
+struct PSI_socket_locker_state_v2
+{
+ int placeholder;
+};
typedef struct PSI_v2 PSI;
typedef struct PSI_mutex_info_v2 PSI_mutex_info;
typedef struct PSI_rwlock_info_v2 PSI_rwlock_info;
typedef struct PSI_cond_info_v2 PSI_cond_info;
typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
+typedef struct PSI_socket_info_v2 PSI_socket_info;
typedef struct PSI_mutex_locker_state_v2 PSI_mutex_locker_state;
typedef struct PSI_rwlock_locker_state_v2 PSI_rwlock_locker_state;
typedef struct PSI_cond_locker_state_v2 PSI_cond_locker_state;
typedef struct PSI_file_locker_state_v2 PSI_file_locker_state;
typedef struct PSI_table_locker_state_v2 PSI_table_locker_state;
+typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-08-04 03:19:48 +0000
+++ b/sql/mysqld.cc 2010-08-04 15:47:50 +0000
@@ -5308,8 +5308,8 @@ void handle_connections_sockets()
{
if (socket_errno != SOCKET_EINTR)
{
- if (!select_errors++ && !abort_loop) /* purecov: inspected */
- sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
+ if (!select_errors++ && !abort_loop) /* purecov: inspected */
+ sql_print_error("mysqld: Got error %d from select",socket_errno); /* purecov: inspected */
}
MAYBE_BROKEN_SYSCALL
continue;
@@ -5364,18 +5364,17 @@ void handle_connections_sockets()
for (uint retry=0; retry < MAX_ACCEPT_RETRY; retry++)
{
size_socket length= sizeof(struct sockaddr_storage);
- new_sock= mysql_socket_accept(key_socket_handle_connection, sock, (struct sockaddr *)(&cAddr), &length);
- &length);
- if (new_sock != INVALID_SOCKET ||
+ new_sock= mysql_socket_accept(key_socket_handle_connection, sock,
+ (struct sockaddr *)(&cAddr), &length);
if (mysql_socket_getfd(new_sock) != INVALID_SOCKET ||
- (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
- break;
+ (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN))
+ break;
MAYBE_BROKEN_SYSCALL;
#if !defined(NO_FCNTL_NONBLOCK)
if (!(test_flags & TEST_BLOCKING))
{
- if (retry == MAX_ACCEPT_RETRY - 1)
- fcntl(mysql_socket_getfd(sock), F_SETFL, flags); // Try without O_NONBLOCK
+ if (retry == MAX_ACCEPT_RETRY - 1)
+ fcntl(mysql_socket_getfd(sock), F_SETFL, flags); // Try without O_NONBLOCK
}
#endif
}
@@ -5386,10 +5385,10 @@ void handle_connections_sockets()
if (mysql_socket_getfd(new_sock) == INVALID_SOCKET)
{
if ((error_count++ & 255) == 0) // This can happen often
- sql_perror("Error in accept");
+ sql_perror("Error in accept");
MAYBE_BROKEN_SYSCALL;
if (socket_errno == SOCKET_ENFILE || socket_errno == SOCKET_EMFILE)
- sleep(1); // Give other threads some time
+ sleep(1); // Give other threads some time
continue;
}
@@ -5397,33 +5396,34 @@ void handle_connections_sockets()
{
if (mysql_socket_getfd(sock) == mysql_socket_getfd(ip_sock))
{
- struct request_info req;
- signal(SIGCHLD, SIG_DFL);
- request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, mysql_socket_getfd(new_sock), NULL); //TBD cwp
- my_fromhost(&req);
- if (!my_hosts_access(&req))
- {
- /*
- This may be stupid but refuse() includes an exit(0)
- which we surely don't want...
- clean_exit() - same stupid thing ...
- */
- syslog(deny_severity, "refused connect from %s",
- my_eval_client(&req));
-
- /*
- C++ sucks (the gibberish in front just translates the supplied
- sink function pointer in the req structure from a void (*sink)();
- to a void(*sink)(int) if you omit the cast, the C++ compiler
- will cry...
- */
- if (req.sink)
- ((void (*)(int))req.sink)(req.fd);
-
- (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
- (void) mysql_socket_ closesocket(new_sock);
- continue;
- }
+ struct request_info req;
+ signal(SIGCHLD, SIG_DFL);
+ request_init(&req, RQ_DAEMON, libwrapName, RQ_FILE, mysql_socket_getfd(new_sock), NULL); //TBD cwp
+ my_fromhost(&req);
+
+ if (!my_hosts_access(&req))
+ {
+ /*
+ This may be stupid but refuse() includes an exit(0)
+ which we surely don't want...
+ clean_exit() - same stupid thing ...
+ */
+ syslog(deny_severity, "refused connect from %s",
+ my_eval_client(&req));
+
+ /*
+ C++ sucks (the gibberish in front just translates the supplied
+ sink function pointer in the req structure from a void (*sink)();
+ to a void(*sink)(int) if you omit the cast, the C++ compiler
+ will cry...
+ */
+ if (req.sink)
+ ((void (*)(int))req.sink)(req.fd);
+
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_ closesocket(new_sock);
+ continue;
+ }
}
}
#endif /* HAVE_LIBWRAP */
@@ -5435,10 +5435,10 @@ void handle_connections_sockets()
if ( mysql_socket_getsockname(new_sock, (struct sockaddr *)&dummy,
(SOCKET_SIZE_TYPE *)&dummyLen) < 0 )
{
- sql_perror("Error on new connection socket");
- (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
- (void) mysql_socket_close(new_sock);
- continue;
+ sql_perror("Error on new connection socket");
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
+ continue;
}
}
@@ -5453,10 +5453,10 @@ void handle_connections_sockets()
continue;
}
if (!(vio_tmp=vio_new(mysql_socket_getfd(new_sock), //TBD cwp
- mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_TYPE_SOCKET :
- VIO_TYPE_TCPIP,
- mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_LOCALHOST: 0)) ||
- my_net_init(&thd->net,vio_tmp))
+ mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_TYPE_SOCKET :
+ VIO_TYPE_TCPIP,
+ mysql_socket_getfd(sock) == mysql_socket_getfd(unix_sock) ? VIO_LOCALHOST: 0)) ||
+ my_net_init(&thd->net,vio_tmp))
{
/*
Only delete the temporary vio if we didn't already attach it to the
@@ -5467,8 +5467,8 @@ void handle_connections_sockets()
vio_delete(vio_tmp);
else
{
- (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
- (void) mysql_socket_close(new_sock);
+ (void) mysql_socket_shutdown(new_sock, SHUT_RDWR);
+ (void) mysql_socket_close(new_sock);
}
delete thd;
continue;
=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc 2010-08-04 03:19:48 +0000
+++ b/storage/perfschema/pfs.cc 2010-08-04 15:47:50 +0000
@@ -1702,6 +1702,7 @@ get_thread_socket_locker_v1(PSI_socket_l
return reinterpret_cast<PSI_socket_locker*> (pfs_locker);
}
+static void unlock_mutex_v1(PSI_mutex *mutex)
{
PFS_mutex *pfs_mutex= reinterpret_cast<PFS_mutex*> (mutex);
DBUG_ASSERT(pfs_mutex != NULL);
=== modified file 'storage/perfschema/table_events_waits.cc'
--- a/storage/perfschema/table_events_waits.cc 2010-08-04 03:19:48 +0000
+++ b/storage/perfschema/table_events_waits.cc 2010-08-04 15:47:50 +0000
@@ -378,7 +378,19 @@ static const LEX_STRING operation_names_
{ C_STRING_WITH_LEN("fetch") },
{ C_STRING_WITH_LEN("insert") }, /* write row */
{ C_STRING_WITH_LEN("update") }, /* update row */
- { C_STRING_WITH_LEN("delete") } /* delete row */
+ { C_STRING_WITH_LEN("delete") }, /* delete row */
+
+ /* Socket operations */
+ { C_STRING_WITH_LEN("create") },
+ { C_STRING_WITH_LEN("connect") },
+ { C_STRING_WITH_LEN("bind") },
+ { C_STRING_WITH_LEN("close") },
+ { C_STRING_WITH_LEN("send") },
+ { C_STRING_WITH_LEN("receive") },
+ { C_STRING_WITH_LEN("seek") },
+ { C_STRING_WITH_LEN("opt") },
+ { C_STRING_WITH_LEN("stat") },
+ { C_STRING_WITH_LEN("shutdown") }
};
@@ -390,8 +402,8 @@ int table_events_waits_common::read_row_
Field *f;
const LEX_STRING *operation;
- compile_time_assert(COUNT_OPERATION_TYPE ==
- array_elements(operation_names_map));
+// compile_time_assert(COUNT_OPERATION_TYPE ==
+// array_elements(operation_names_map));
if (unlikely(! m_row_exists))
return HA_ERR_RECORD_DELETED;
=== modified file 'storage/perfschema/table_helper.h'
--- a/storage/perfschema/table_helper.h 2010-07-02 17:25:26 +0000
+++ b/storage/perfschema/table_helper.h 2010-08-04 15:47:50 +0000
@@ -34,7 +34,8 @@ struct PFS_instrument_view_constants
static const uint VIEW_COND= 3;
static const uint VIEW_FILE= 4;
static const uint VIEW_TABLE= 5;
- static const uint LAST_VIEW= 5;
+ static const uint VIEW_SOCKET= 6;
+ static const uint LAST_VIEW= 6;
};
struct PFS_object_view_constants
=== added file 'storage/perfschema/table_helper.h.moved'
--- a/storage/perfschema/table_helper.h.moved 1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_helper.h.moved 2010-08-04 15:47:50 +0000
@@ -0,0 +1,55 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; version 2 of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef PFS_TABLE_HELPER_H
+#define PFS_TABLE_HELPER_H
+
+/**
+ @file storage/perfschema/table_helper.h
+ Performance schema table helpers (declarations).
+*/
+
+/**
+ @addtogroup Performance_schema_tables
+ @{
+*/
+
+struct PFS_instrument_view_constants
+{
+ static const uint FIRST_VIEW= 1;
+ static const uint VIEW_MUTEX= 1;
+ static const uint VIEW_RWLOCK= 2;
+ static const uint VIEW_COND= 3;
+ static const uint VIEW_FILE= 4;
+ static const uint VIEW_TABLE= 5;
+ static const uint LAST_VIEW= 5;
+};
+
+struct PFS_object_view_constants
+{
+ static const uint FIRST_VIEW= 1;
+ static const uint VIEW_TABLE= 1;
+ static const uint LAST_VIEW= 1;
+
+ /* Future use */
+ static const uint VIEW_EVENT= 2;
+ static const uint VIEW_PROCEDURE= 3;
+ static const uint VIEW_FUNCTION= 4;
+};
+
+/** @} */
+
+#endif
+
Attachment: [text/bzr-bundle] bzr/chris.powers@oracle.com-20100804154750-qx0wf5c5shvyowdc.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-wl4896 branch (chris.powers:3160) | Christopher Powers | 4 Aug |