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
{
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
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.
......@@ -184,6 +187,8 @@ void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
void vio_end(void);
const char *vio_type_name(enum enum_vio_type vio_type, size_t *len);
#ifdef __cplusplus
}
#endif
......
......@@ -70,7 +70,7 @@ const uint max_dbname_length= 64;
const char *safe_vio_type_name(Vio *vio)
{
int unused;
size_t unused;
#ifdef EMBEDDED_LIBRARY
if (!vio) return "Internal";
#endif
......@@ -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);
}
PSI_CALL_set_connection_type(vio_type(thd->net.vio));
Security_context * const sctx= thd->security_ctx;
const ACL_USER * acl_user= mpvio.acl_user;
if (!acl_user)
......
......@@ -215,7 +215,7 @@ int table_threads::read_row_values(TABLE *table,
{
Field *f;
const char *str= NULL;
int len= 0;
size_t len= 0;
if (unlikely(! m_row_exists))
return HA_ERR_RECORD_DELETED;
......@@ -326,7 +326,7 @@ int table_threads::read_row_values(TABLE *table,
case 15: /* CONNECTION_TYPE */
get_vio_type_name(m_row.m_connection_type, & str, & len);
if (len > 0)
set_field_varchar_utf8(f, str, len);
set_field_varchar_utf8(f, str, (uint)len);
else
f->set_null();
break;
......
......@@ -645,6 +645,26 @@ enum enum_vio_type vio_type(Vio* vio)
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)
{
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