Commit d5a00697 authored by Sergei Golubchik's avatar Sergei Golubchik

perfschema socket instrumentation related changes

parent 00819d81
...@@ -39,7 +39,10 @@ enum enum_vio_type ...@@ -39,7 +39,10 @@ enum enum_vio_type
{ {
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE, VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
VIO_TYPE_SSL VIO_TYPE_SSL
/* see also vio_type_names[] */
}; };
#define FIRST_VIO_TYPE VIO_CLOSED
#define LAST_VIO_TYPE VIO_TYPE_SSL
/** /**
VIO I/O events. VIO I/O events.
...@@ -184,6 +187,8 @@ void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd); ...@@ -184,6 +187,8 @@ void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
void vio_end(void); void vio_end(void);
const char *vio_type_name(enum enum_vio_type vio_type, size_t *len);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
......
...@@ -70,7 +70,7 @@ const uint max_dbname_length= 64; ...@@ -70,7 +70,7 @@ const uint max_dbname_length= 64;
const char *safe_vio_type_name(Vio *vio) const char *safe_vio_type_name(Vio *vio)
{ {
int unused; size_t unused;
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
if (!vio) return "Internal"; if (!vio) return "Internal";
#endif #endif
...@@ -13978,6 +13978,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) ...@@ -13978,6 +13978,8 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
res= do_auth_once(thd, default_auth_plugin_name, &mpvio); res= do_auth_once(thd, default_auth_plugin_name, &mpvio);
} }
PSI_CALL_set_connection_type(vio_type(thd->net.vio));
Security_context * const sctx= thd->security_ctx; Security_context * const sctx= thd->security_ctx;
const ACL_USER * acl_user= mpvio.acl_user; const ACL_USER * acl_user= mpvio.acl_user;
if (!acl_user) if (!acl_user)
......
...@@ -215,7 +215,7 @@ int table_threads::read_row_values(TABLE *table, ...@@ -215,7 +215,7 @@ int table_threads::read_row_values(TABLE *table,
{ {
Field *f; Field *f;
const char *str= NULL; const char *str= NULL;
int len= 0; size_t len= 0;
if (unlikely(! m_row_exists)) if (unlikely(! m_row_exists))
return HA_ERR_RECORD_DELETED; return HA_ERR_RECORD_DELETED;
...@@ -326,7 +326,7 @@ int table_threads::read_row_values(TABLE *table, ...@@ -326,7 +326,7 @@ int table_threads::read_row_values(TABLE *table,
case 15: /* CONNECTION_TYPE */ case 15: /* CONNECTION_TYPE */
get_vio_type_name(m_row.m_connection_type, & str, & len); get_vio_type_name(m_row.m_connection_type, & str, & len);
if (len > 0) if (len > 0)
set_field_varchar_utf8(f, str, len); set_field_varchar_utf8(f, str, (uint)len);
else else
f->set_null(); f->set_null();
break; break;
......
...@@ -645,6 +645,26 @@ enum enum_vio_type vio_type(Vio* vio) ...@@ -645,6 +645,26 @@ enum enum_vio_type vio_type(Vio* vio)
return vio->type; return vio->type;
} }
static const LEX_CSTRING vio_type_names[] =
{
{ STRING_WITH_LEN("Error") }, // cannot happen
{ STRING_WITH_LEN("TCP/IP") },
{ STRING_WITH_LEN("Socket") },
{ STRING_WITH_LEN("Named Pipe") },
{ STRING_WITH_LEN("SSL/TLS") },
{ STRING_WITH_LEN("Shared Memory") }
};
const char *vio_type_name(enum enum_vio_type vio_type, size_t *len)
{
int index= vio_type >= FIRST_VIO_TYPE && vio_type <= LAST_VIO_TYPE
? vio_type : 0;
*len= vio_type_names[index].length;
return vio_type_names[index].str;
}
my_socket vio_fd(Vio* vio) my_socket vio_fd(Vio* vio)
{ {
return mysql_socket_getfd(vio->mysql_socket); return mysql_socket_getfd(vio->mysql_socket);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment