Commit 0ea717f5 authored by Sergei Golubchik's avatar Sergei Golubchik

P_S 5.7.28

parent dfe6e914
/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2017, 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, version 2.0,
......@@ -48,6 +48,10 @@
#include "mysql/psi/psi.h"
#ifndef PSI_FILE_CALL
#define PSI_FILE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup File_instrumentation File Instrumentation
@ingroup Instrumentation_interface
......@@ -295,7 +299,7 @@
*/
#ifdef HAVE_PSI_FILE_INTERFACE
#define mysql_file_create_temp(K, T, D, P, M, F) \
inline_mysql_file_create_temp(K, T, D, P, M, F)
inline_mysql_file_create_temp(K, __FILE__, __LINE__, T, D, P, M, F)
#else
#define mysql_file_create_temp(K, T, D, P, M, F) \
inline_mysql_file_create_temp(T, D, P, M, F)
......@@ -828,7 +832,8 @@ inline_mysql_file_fopen(
const char *filename, int flags, myf myFlags)
{
MYSQL_FILE *that;
that= (MYSQL_FILE*) my_malloc(sizeof(MYSQL_FILE), MYF(MY_WME));
that= (MYSQL_FILE*) my_malloc(PSI_NOT_INSTRUMENTED,
sizeof(MYSQL_FILE), MYF(MY_WME));
if (likely(that != NULL))
{
#ifdef HAVE_PSI_FILE_INTERFACE
......@@ -1052,20 +1057,27 @@ inline_mysql_file_create(
static inline File
inline_mysql_file_create_temp(
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_file_key key,
PSI_file_key key, const char *src_file, uint src_line,
#endif
char *to, const char *dir, const char *pfx, int mode, myf myFlags)
{
File file;
/*
TODO: This event is instrumented, but not timed.
The problem is that the file name is now known
before the create_temp_file call.
*/
file= create_temp_file(to, dir, pfx, mode, myFlags);
#ifdef HAVE_PSI_FILE_INTERFACE
PSI_FILE_CALL(create_file)(key, to, file);
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_CREATE, NULL, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_open_wait)(locker, src_file, src_line);
/* The file name is generated by create_temp_file(). */
file= create_temp_file(to, dir, pfx, mode, myFlags);
PSI_FILE_CALL(end_temp_file_open_wait_and_bind_to_descriptor)(locker, file, (const char*)to);
return file;
}
#endif
file= create_temp_file(to, dir, pfx, mode, myFlags);
return file;
}
......@@ -1355,12 +1367,13 @@ inline_mysql_file_rename(
{
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME, to, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_RENAME, from, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename(from, to, flags);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
return result;
}
}
......@@ -1449,12 +1462,13 @@ inline_mysql_file_rename_with_symlink(
{
struct PSI_file_locker *locker;
PSI_file_locker_state state;
locker= PSI_FILE_CALL(get_thread_file_name_locker)(&state, key, PSI_FILE_RENAME, to, &locker);
locker= PSI_FILE_CALL(get_thread_file_name_locker)
(&state, key, PSI_FILE_RENAME, from, &locker);
if (likely(locker != NULL))
{
PSI_FILE_CALL(start_file_wait)(locker, (size_t) 0, src_file, src_line);
result= my_rename_with_symlink(from, to, flags);
PSI_FILE_CALL(end_file_wait)(locker, (size_t) 0);
PSI_FILE_CALL(end_file_rename_wait)(locker, from, to, result);
return result;
}
}
......
/* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
......@@ -31,6 +31,10 @@
#include "mysql/psi/psi.h"
#ifndef PSI_IDLE_CALL
#define PSI_IDLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Idle_instrumentation Idle Instrumentation
@ingroup Instrumentation_interface
......
/* Copyright (c) 2012, 2015, 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, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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 MYSQL_MDL_H
#define MYSQL_MDL_H
/**
@file mysql/psi/mysql_mdl.h
Instrumentation helpers for metadata locks.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_METADATA_CALL
#define PSI_METADATA_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Thread_instrumentation Metadata Instrumentation
@ingroup Instrumentation_interface
@{
*/
/**
@def mysql_mdl_create(K, M, A)
Instrumented metadata lock creation.
@param I Metadata lock identity
@param K Metadata key
@param T Metadata lock type
@param D Metadata lock duration
@param S Metadata lock status
@param F request source file
@param L request source line
*/
#ifdef HAVE_PSI_METADATA_INTERFACE
#define mysql_mdl_create(I, K, T, D, S, F, L) \
inline_mysql_mdl_create(I, K, T, D, S, F, L)
#else
#define mysql_mdl_create(I, K, T, D, S, F, L) NULL
#endif
#ifdef HAVE_PSI_METADATA_INTERFACE
#define mysql_mdl_set_status(L, S) \
inline_mysql_mdl_set_status(L, S)
#else
#define mysql_mdl_set_status(L, S) \
do {} while (0)
#endif
/**
@def mysql_mdl_destroy(M)
Instrumented metadata lock destruction.
@param M Metadata lock
*/
#ifdef HAVE_PSI_METADATA_INTERFACE
#define mysql_mdl_destroy(M) \
inline_mysql_mdl_destroy(M, __FILE__, __LINE__)
#else
#define mysql_mdl_destroy(M) \
do {} while (0)
#endif
#ifdef HAVE_PSI_METADATA_INTERFACE
static inline PSI_metadata_lock *
inline_mysql_mdl_create(void *identity,
const MDL_key *mdl_key,
enum_mdl_type mdl_type,
enum_mdl_duration mdl_duration,
MDL_ticket::enum_psi_status mdl_status,
const char *src_file, uint src_line)
{
PSI_metadata_lock *result;
/* static_cast: Fit a round C++ enum peg into a square C int hole ... */
result= PSI_METADATA_CALL(create_metadata_lock)
(identity,
mdl_key,
static_cast<opaque_mdl_type> (mdl_type),
static_cast<opaque_mdl_duration> (mdl_duration),
static_cast<opaque_mdl_status> (mdl_status),
src_file, src_line);
return result;
}
static inline void inline_mysql_mdl_set_status(
PSI_metadata_lock *psi,
MDL_ticket::enum_psi_status mdl_status)
{
if (psi != NULL)
PSI_METADATA_CALL(set_metadata_lock_status)(psi, mdl_status);
}
static inline void inline_mysql_mdl_destroy(
PSI_metadata_lock *psi,
const char *src_file, uint src_line)
{
if (psi != NULL)
PSI_METADATA_CALL(destroy_metadata_lock)(psi);
}
#endif /* HAVE_PSI_METADATA_INTERFACE */
/** @} (end of group Metadata_instrumentation) */
#endif
/* Copyright (c) 2012, 2016, 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, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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 MYSQL_MEMORY_H
#define MYSQL_MEMORY_H
/**
@file mysql/psi/mysql_memory.h
Instrumentation helpers for memory allocation.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_MEMORY_CALL
#define PSI_MEMORY_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Memory_instrumentation Memory Instrumentation
@ingroup Instrumentation_interface
@{
*/
/**
@def mysql_memory_register(P1, P2, P3)
Memory registration.
*/
#define mysql_memory_register(P1, P2, P3) \
inline_mysql_memory_register(P1, P2, P3)
static inline void inline_mysql_memory_register(
#ifdef HAVE_PSI_MEMORY_INTERFACE
const char *category,
PSI_memory_info *info,
int count)
#else
const char *category __attribute__((unused)),
void *info __attribute__((unused)),
int count __attribute__((unused)))
#endif
{
#ifdef HAVE_PSI_MEMORY_INTERFACE
PSI_MEMORY_CALL(register_memory)(category, info, count);
#endif
}
/** @} (end of group Memory_instrumentation) */
#endif
/* Copyright (c) 2014, 2017, 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, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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_PS_H
#define MYSQL_PS_H
/**
@file mysql/psi/mysql_ps.h
Instrumentation helpers for prepared statements.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_PS_CALL
#define PSI_PS_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifdef HAVE_PSI_PS_INTERFACE
#define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
inline_mysql_create_prepared_stmt(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH)
#define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
inline_mysql_execute_prepared_stmt(LOCKER, PREPARED_STMT)
#define MYSQL_DESTROY_PS(PREPARED_STMT) \
inline_mysql_destroy_prepared_stmt(PREPARED_STMT)
#define MYSQL_REPREPARE_PS(PREPARED_STMT) \
inline_mysql_reprepare_prepared_stmt(PREPARED_STMT)
#define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
inline_mysql_set_prepared_stmt_text(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH)
#else
#define MYSQL_CREATE_PS(IDENTITY, ID, LOCKER, NAME, NAME_LENGTH, SQLTEXT, SQLTEXT_LENGTH) \
NULL
#define MYSQL_EXECUTE_PS(LOCKER, PREPARED_STMT) \
do {} while (0)
#define MYSQL_DESTROY_PS(PREPARED_STMT) \
do {} while (0)
#define MYSQL_REPREPARE_PS(PREPARED_STMT) \
do {} while (0)
#define MYSQL_SET_PS_TEXT(PREPARED_STMT, SQLTEXT, SQLTEXT_LENGTH) \
do {} while (0)
#endif
#ifdef HAVE_PSI_PS_INTERFACE
static inline struct PSI_prepared_stmt*
inline_mysql_create_prepared_stmt(void *identity, uint stmt_id,
PSI_statement_locker *locker,
const char *stmt_name, size_t stmt_name_length,
const char *sqltext, size_t sqltext_length)
{
if (locker == NULL)
return NULL;
return PSI_PS_CALL(create_prepared_stmt)(identity, stmt_id,
locker,
stmt_name, stmt_name_length,
sqltext, sqltext_length);
}
static inline void
inline_mysql_execute_prepared_stmt(PSI_statement_locker *locker,
PSI_prepared_stmt* prepared_stmt)
{
if (prepared_stmt != NULL && locker != NULL)
PSI_PS_CALL(execute_prepared_stmt)(locker, prepared_stmt);
}
static inline void
inline_mysql_destroy_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
{
if (prepared_stmt != NULL)
PSI_PS_CALL(destroy_prepared_stmt)(prepared_stmt);
}
static inline void
inline_mysql_reprepare_prepared_stmt(PSI_prepared_stmt *prepared_stmt)
{
if (prepared_stmt != NULL)
PSI_PS_CALL(reprepare_prepared_stmt)(prepared_stmt);
}
static inline void
inline_mysql_set_prepared_stmt_text(PSI_prepared_stmt *prepared_stmt,
const char *text,
uint text_len)
{
if (prepared_stmt != NULL)
{
PSI_PS_CALL(set_prepared_stmt_text)(prepared_stmt, text, text_len);
}
}
#endif
#endif
......@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
/* For my_chsize */
#include <my_sys.h>
/* For socket api */
#ifdef __WIN__
#ifdef _WIN32
#include <ws2def.h>
#include <winsock2.h>
#include <MSWSock.h>
......@@ -47,6 +47,10 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
#include "mysql/psi/psi.h"
#ifndef PSI_SOCKET_CALL
#define PSI_SOCKET_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Socket_instrumentation Socket Instrumentation
@ingroup Instrumentation_interface
......@@ -65,6 +69,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
do {} while (0)
#endif
/** An instrumented socket. */
struct st_mysql_socket
{
/** The real socket descriptor. */
......@@ -107,9 +112,8 @@ mysql_socket_invalid()
/**
Set socket descriptor and address.
@param socket nstrumented socket
@param fd socket descriptor
@param addr unformatted socket address
@param adr_len length of socket address
@param addr_len length of socket address
*/
static inline void
......@@ -134,7 +138,6 @@ mysql_socket_set_address(
/**
Set socket descriptor and address.
@param socket instrumented socket
@param thread instrumented owning thread
*/
static inline void
mysql_socket_set_thread_owner(
......@@ -201,7 +204,6 @@ mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd)
@param STATE locker state
@param SOCKET instrumented socket
@param OP The socket operation to be performed
@param FLAGS per-socket operation flags.
@param COUNT bytes to be written/read
@sa MYSQL_END_SOCKET_WAIT.
*/
......@@ -230,6 +232,13 @@ mysql_socket_setfd(MYSQL_SOCKET *mysql_socket, my_socket fd)
do {} while (0)
#endif
/**
@def MYSQL_SOCKET_SET_STATE
Set the state (IDLE, ACTIVE) of an instrumented socket.
@param SOCKET the instrumented socket
@param STATE the new state
@sa PSI_socket_state
*/
#ifdef HAVE_PSI_SOCKET_INTERFACE
#define MYSQL_SOCKET_SET_STATE(SOCKET, STATE) \
inline_mysql_socket_set_state(SOCKET, STATE)
......@@ -325,8 +334,8 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
Return port number and IP address of the local host
@c mysql_socket_getsockname is a replacement for @c getsockname.
@param FD Instrumented socket descriptor returned by socket()
@param A Pointer to returned address of local host in sockaddr structure
@param L Pointer to length of sockaddr structure
@param AP Pointer to returned address of local host in @c sockaddr structure
@param LP Pointer to length of @c sockaddr structure
*/
#ifdef HAVE_PSI_SOCKET_INTERFACE
#define mysql_socket_getsockname(FD, AP, LP) \
......@@ -430,7 +439,7 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
@param N Maximum bytes to receive
@param FL Control flags
@param AP Pointer to source address in sockaddr_storage structure
@param L Size of sockaddr_storage structure
@param LP Size of sockaddr_storage structure
*/
#ifdef HAVE_PSI_SOCKET_INTERFACE
#define mysql_socket_recvfrom(FD, B, N, FL, AP, LP) \
......@@ -476,6 +485,19 @@ inline_mysql_socket_set_state(MYSQL_SOCKET socket, enum PSI_socket_state state)
inline_mysql_socket_setsockopt(FD, LV, ON, OP, OL)
#endif
/**
@def mysql_sock_set_nonblocking
Set socket to non-blocking.
@param FD instrumented socket descriptor
*/
#ifdef HAVE_PSI_SOCKET_INTERFACE
#define mysql_sock_set_nonblocking(FD) \
inline_mysql_sock_set_nonblocking(__FILE__, __LINE__, FD)
#else
#define mysql_sock_set_nonblocking(FD) \
inline_mysql_sock_set_nonblocking(FD)
#endif
/**
@def mysql_socket_listen(FD, N)
Set socket state to listen for an incoming connection.
......@@ -972,6 +994,78 @@ inline_mysql_socket_setsockopt
return result;
}
/** set_socket_nonblock */
static inline int
set_socket_nonblock(my_socket fd)
{
int ret= 0;
#ifdef _WIN32
{
u_long nonblocking= 1;
ret= ioctlsocket(fd, FIONBIO, &nonblocking);
}
#else
{
int fd_flags;
fd_flags= fcntl(fd, F_GETFL, 0);
if (fd_flags < 0)
return errno;
#if defined(O_NONBLOCK)
fd_flags |= O_NONBLOCK;
#elif defined(O_NDELAY)
fd_flags |= O_NDELAY;
#elif defined(O_FNDELAY)
fd_flags |= O_FNDELAY;
#else
#error "No definition of non-blocking flag found."
#endif /* O_NONBLOCK */
if (fcntl(fd, F_SETFL, fd_flags) == -1)
ret= errno;
}
#endif /* _WIN32 */
return ret;
}
/** mysql_socket_set_nonblocking */
static inline int
inline_mysql_sock_set_nonblocking
(
#ifdef HAVE_PSI_SOCKET_INTERFACE
const char *src_file, uint src_line,
#endif
MYSQL_SOCKET mysql_socket
)
{
int result= 0;
#ifdef HAVE_PSI_SOCKET_INTERFACE
if (mysql_socket.m_psi)
{
/* Instrumentation start */
PSI_socket_locker *locker;
PSI_socket_locker_state state;
locker= PSI_SOCKET_CALL(start_socket_wait)
(&state, mysql_socket.m_psi, PSI_SOCKET_OPT,
(size_t)0, src_file, src_line);
/* Instrumented code */
result= set_socket_nonblock(mysql_socket.fd);
/* Instrumentation end */
if (locker != NULL)
PSI_SOCKET_CALL(end_socket_wait)(locker, (size_t)0);
return result;
}
#endif
/* Non instrumented code */
result= set_socket_nonblock(mysql_socket.fd);
return result;
}
/** mysql_socket_listen */
static inline int
......@@ -1136,7 +1230,7 @@ inline_mysql_socket_shutdown
{
int result;
#ifdef __WIN__
#ifdef _WIN32
static LPFN_DISCONNECTEX DisconnectEx = NULL;
if (DisconnectEx == NULL)
{
......@@ -1159,7 +1253,7 @@ inline_mysql_socket_shutdown
(&state, mysql_socket.m_psi, PSI_SOCKET_SHUTDOWN, (size_t)0, src_file, src_line);
/* Instrumented code */
#ifdef __WIN__
#ifdef _WIN32
if (DisconnectEx)
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
......@@ -1176,7 +1270,7 @@ inline_mysql_socket_shutdown
#endif
/* Non instrumented code */
#ifdef __WIN__
#ifdef _WIN32
if (DisconnectEx)
result= (DisconnectEx(mysql_socket.fd, (LPOVERLAPPED) NULL,
(DWORD) 0, (DWORD) 0) == TRUE) ? 0 : -1;
......
/* Copyright (c) 2013, 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, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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_SP_H
#define MYSQL_SP_H
/**
@file mysql/psi/mysql_sp.h
Instrumentation helpers for stored programs.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_SP_CALL
#define PSI_SP_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifdef HAVE_PSI_SP_INTERFACE
#define MYSQL_START_SP(STATE, SP_SHARE) \
inline_mysql_start_sp(STATE, SP_SHARE)
#else
#define MYSQL_START_SP(STATE, SP_SHARE) \
NULL
#endif
#ifdef HAVE_PSI_SP_INTERFACE
#define MYSQL_END_SP(LOCKER) \
inline_mysql_end_sp(LOCKER)
#else
#define MYSQL_END_SP(LOCKER) \
do {} while (0)
#endif
#ifdef HAVE_PSI_SP_INTERFACE
#define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
inline_mysql_drop_sp(OT, SN, SNL, ON, ONL)
#else
#define MYSQL_DROP_SP(OT, SN, SNL, ON, ONL) \
do {} while (0)
#endif
#ifdef HAVE_PSI_SP_INTERFACE
#define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
inline_mysql_get_sp_share(OT, SN, SNL, ON, ONL)
#else
#define MYSQL_GET_SP_SHARE(OT, SN, SNL, ON, ONL) \
NULL
#endif
#ifdef HAVE_PSI_SP_INTERFACE
static inline struct PSI_sp_locker*
inline_mysql_start_sp(PSI_sp_locker_state *state, PSI_sp_share *sp_share)
{
return PSI_SP_CALL(start_sp)(state, sp_share);
}
static inline void inline_mysql_end_sp(PSI_sp_locker *locker)
{
if (likely(locker != NULL))
PSI_SP_CALL(end_sp)(locker);
}
static inline void
inline_mysql_drop_sp(uint sp_type,
const char* schema_name, uint shcema_name_length,
const char* object_name, uint object_name_length)
{
PSI_SP_CALL(drop_sp)(sp_type,
schema_name, shcema_name_length,
object_name, object_name_length);
}
static inline PSI_sp_share*
inline_mysql_get_sp_share(uint sp_type,
const char* schema_name, uint shcema_name_length,
const char* object_name, uint object_name_length)
{
return PSI_SP_CALL(get_sp_share)(sp_type,
schema_name, shcema_name_length,
object_name, object_name_length);
}
#endif
#endif
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2010, 2014, 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, version 2.0,
......@@ -30,6 +30,10 @@
#include "mysql/psi/psi.h"
#ifndef PSI_STAGE_CALL
#define PSI_STAGE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Stage_instrumentation Stage Instrumentation
@ingroup Instrumentation_interface
......@@ -48,12 +52,48 @@
do {} while (0)
#endif
/**
@def MYSQL_SET_STAGE
Set the current stage.
Use this API when the file and line
is passed from the caller.
@param K the stage key
@param F the source file name
@param L the source file line
@return the current stage progress
*/
#ifdef HAVE_PSI_STAGE_INTERFACE
#define MYSQL_SET_STAGE(K, F, L) \
inline_mysql_set_stage(K, F, L)
#else
#define MYSQL_SET_STAGE(K, F, L) \
do {} while (0)
NULL
#endif
/**
@def mysql_set_stage
Set the current stage.
@param K the stage key
@return the current stage progress
*/
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_set_stage(K) \
inline_mysql_set_stage(K, __FILE__, __LINE__)
#else
#define mysql_set_stage(K) \
NULL
#endif
/**
@def mysql_end_stage
End the last stage
*/
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_end_stage \
inline_mysql_end_stage
#else
#define mysql_end_stage \
do {} while (0)
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
......@@ -65,11 +105,97 @@ static inline void inline_mysql_stage_register(
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
static inline PSI_stage_progress*
inline_mysql_set_stage(PSI_stage_key key,
const char *src_file, int src_line)
{
PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
return PSI_STAGE_CALL(start_stage)(key, src_file, src_line);
}
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_end_stage()
{
PSI_STAGE_CALL(end_stage)();
}
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_stage_set_work_completed(P1, P2) \
inline_mysql_stage_set_work_completed(P1, P2)
#define mysql_stage_get_work_completed(P1) \
inline_mysql_stage_get_work_completed(P1)
#else
#define mysql_stage_set_work_completed(P1, P2) \
do {} while (0)
#define mysql_stage_get_work_completed(P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_stage_inc_work_completed(P1, P2) \
inline_mysql_stage_inc_work_completed(P1, P2)
#else
#define mysql_stage_inc_work_completed(P1, P2) \
do {} while (0)
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
#define mysql_stage_set_work_estimated(P1, P2) \
inline_mysql_stage_set_work_estimated(P1, P2)
#define mysql_stage_get_work_estimated(P1) \
inline_mysql_stage_get_work_estimated(P1)
#else
#define mysql_stage_set_work_estimated(P1, P2) \
do {} while (0)
#define mysql_stage_get_work_estimated(P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_stage_set_work_completed(PSI_stage_progress *progress,
ulonglong val)
{
if (progress != NULL)
progress->m_work_completed= val;
}
static inline ulonglong
inline_mysql_stage_get_work_completed(PSI_stage_progress *progress)
{
return progress->m_work_completed;
}
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_stage_inc_work_completed(PSI_stage_progress *progress,
ulonglong val)
{
if (progress != NULL)
progress->m_work_completed+= val;
}
#endif
#ifdef HAVE_PSI_STAGE_INTERFACE
static inline void
inline_mysql_stage_set_work_estimated(PSI_stage_progress *progress,
ulonglong val)
{
if (progress != NULL)
progress->m_work_estimated= val;
}
static inline ulonglong
inline_mysql_stage_get_work_estimated(PSI_stage_progress *progress)
{
return progress->m_work_estimated;
}
#endif
......
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
......@@ -31,6 +31,17 @@
#include "mysql/psi/psi.h"
class Diagnostics_area;
typedef const struct charset_info_st CHARSET_INFO;
#ifndef PSI_STATEMENT_CALL
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_DIGEST_CALL
#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Statement_instrumentation Statement Instrumentation
@ingroup Instrumentation_interface
......@@ -66,10 +77,10 @@
#endif
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, __FILE__, __LINE__)
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, __LINE__)
#else
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
NULL
#endif
......@@ -153,11 +164,13 @@ static inline struct PSI_statement_locker *
inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
const char *db, size_t db_len,
const CHARSET_INFO *charset,
CHARSET_INFO *charset,
PSI_sp_share *sp_share,
const char *src_file, uint src_line)
{
PSI_statement_locker *locker;
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset,
sp_share);
if (psi_likely(locker != NULL))
PSI_STATEMENT_CALL(start_statement)(locker, db, (uint)db_len, src_file, src_line);
return locker;
......
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, MariaDB Corporation.
/* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2.0,
......@@ -31,6 +31,10 @@
#include "mysql/psi/psi.h"
#ifndef PSI_TABLE_CALL
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Table_instrumentation Table Instrumentation
@ingroup Instrumentation_interface
......@@ -54,7 +58,7 @@
#define PSI_CALL_unbind_table(A1) do { } while(0)
#define PSI_CALL_rebind_table(A1,A2,A3) NULL
#define PSI_CALL_close_table(A1) do { } while(0)
#define PSI_CALL_close_table(A1,A2) do { } while(0)
#define PSI_CALL_open_table(A1,A2) NULL
#define PSI_CALL_get_table_share(A1,A2) NULL
#define PSI_CALL_release_table_share(A1) do { } while(0)
......@@ -81,72 +85,6 @@
#define MYSQL_TABLE_WAIT_VARIABLES(LOCKER, STATE)
#endif
/**
@def MYSQL_TABLE_IO_WAIT
Instrumentation helper for table io_waits.
This instrumentation marks the start of a wait event.
@param PSI the instrumented table
@param OP the table operation to be performed
@param INDEX the table index used if any, or MAY_KEY.
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
{ \
if (psi_likely(PSI != NULL)) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_TABLE_CALL(start_table_io_wait) \
(& state, PSI, OP, INDEX, __FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_TABLE_CALL(end_table_io_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
}
#else
#define MYSQL_TABLE_IO_WAIT(PSI, OP, INDEX, FLAGS, PAYLOAD) \
PAYLOAD
#endif
/**
@def MYSQL_TABLE_LOCK_WAIT
Instrumentation helper for table io_waits.
This instrumentation marks the start of a wait event.
@param PSI the instrumented table
@param OP the table operation to be performed
@param INDEX the table index used if any, or MAY_KEY.
@param FLAGS per table operation flags.
@sa MYSQL_END_TABLE_WAIT.
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
{ \
if (psi_likely(PSI != NULL)) \
{ \
PSI_table_locker *locker; \
PSI_table_locker_state state; \
locker= PSI_TABLE_CALL(start_table_lock_wait) \
(& state, PSI, OP, FLAGS, __FILE__, __LINE__); \
PAYLOAD \
if (locker != NULL) \
PSI_TABLE_CALL(end_table_lock_wait)(locker); \
} \
else \
{ \
PAYLOAD \
} \
}
#else
#define MYSQL_TABLE_LOCK_WAIT(PSI, OP, FLAGS, PAYLOAD) \
PAYLOAD
#endif
/**
@def MYSQL_START_TABLE_LOCK_WAIT
Instrumentation helper for table lock waits.
......@@ -182,6 +120,14 @@
do {} while (0)
#endif
#ifdef HAVE_PSI_TABLE_INTERFACE
#define MYSQL_UNLOCK_TABLE(T) \
inline_mysql_unlock_table(T)
#else
#define MYSQL_UNLOCK_TABLE(T) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TABLE_INTERFACE
/**
Instrumentation calls for MYSQL_START_TABLE_LOCK_WAIT.
......@@ -213,6 +159,13 @@ inline_mysql_end_table_lock_wait(struct PSI_table_locker *locker)
if (psi_likely(locker != NULL))
PSI_TABLE_CALL(end_table_lock_wait)(locker);
}
static inline void
inline_mysql_unlock_table(struct PSI_table *table)
{
if (table != NULL)
PSI_TABLE_CALL(unlock_table)(table);
}
#endif
/** @} (end of group Table_instrumentation) */
......
......@@ -62,6 +62,27 @@
*/
#include "mysql/psi/psi.h"
#ifdef MYSQL_SERVER
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "pfs_thread_provider.h"
#endif
#endif
#ifndef PSI_MUTEX_CALL
#define PSI_MUTEX_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_RWLOCK_CALL
#define PSI_RWLOCK_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_COND_CALL
#define PSI_COND_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
#ifndef PSI_THREAD_CALL
#define PSI_THREAD_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Thread_instrumentation Thread Instrumentation
......@@ -80,7 +101,7 @@
#define PSI_CALL_set_thread_id PSI_THREAD_CALL(set_thread_id)
#define PSI_CALL_set_thread_info PSI_THREAD_CALL(set_thread_info)
#define PSI_CALL_set_thread_start_time PSI_THREAD_CALL(set_thread_start_time)
#define PSI_CALL_set_thread_user_host PSI_THREAD_CALL(set_thread_user_host)
#define PSI_CALL_set_thread_account PSI_THREAD_CALL(set_thread_account)
#define PSI_CALL_spawn_thread PSI_THREAD_CALL(spawn_thread)
#else
#define PSI_CALL_delete_current_thread() do { } while(0)
......@@ -93,7 +114,7 @@
#define PSI_CALL_set_thread_id(A1,A2) do { } while(0)
#define PSI_CALL_set_thread_info(A1, A2) do { } while(0)
#define PSI_CALL_set_thread_start_time(A1) do { } while(0)
#define PSI_CALL_set_thread_user_host(A1, A2, A3, A4) do { } while(0)
#define PSI_CALL_set_thread_account(A1, A2, A3, A4) do { } while(0)
#define PSI_CALL_spawn_thread(A1, A2, A3, A4, A5) 0
#endif
......@@ -256,11 +277,19 @@ typedef struct st_mysql_cond mysql_cond_t;
#define mysql_mutex_setflags(M, F) \
safe_mutex_setflags(&(M)->m_mutex, (F))
/** Wrappers for instrumented prlock objects. */
/**
@def mysql_prlock_assert_write_owner(M)
Drop-in replacement
for @c rw_pr_lock_assert_write_owner.
*/
#define mysql_prlock_assert_write_owner(M) \
rw_pr_lock_assert_write_owner(&(M)->m_prlock)
/**
@def mysql_prlock_assert_not_write_owner(M)
Drop-in replacement
for @c rw_pr_lock_assert_not_write_owner.
*/
#define mysql_prlock_assert_not_write_owner(M) \
rw_pr_lock_assert_not_write_owner(&(M)->m_prlock)
......@@ -538,7 +567,7 @@ typedef struct st_mysql_cond mysql_cond_t;
Instrumented cond_wait.
@c mysql_cond_wait is a drop-in replacement for @c pthread_cond_wait.
*/
#ifdef HAVE_PSI_COND_INTERFACE
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
#define mysql_cond_wait(C, M) \
inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
#else
......@@ -552,7 +581,7 @@ typedef struct st_mysql_cond mysql_cond_t;
@c mysql_cond_timedwait is a drop-in replacement
for @c pthread_cond_timedwait.
*/
#ifdef HAVE_PSI_COND_INTERFACE
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
#define mysql_cond_timedwait(C, M, W) \
inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
#else
......@@ -618,6 +647,17 @@ typedef struct st_mysql_cond mysql_cond_t;
#define mysql_thread_set_psi_id(I) do {} while (0)
#endif
/**
@def mysql_thread_set_psi_THD(T)
Set the thread sql session for the instrumentation.
@param I The thread identifier
*/
#ifdef HAVE_PSI_THREAD_INTERFACE
#define mysql_thread_set_psi_THD(T) inline_mysql_thread_set_psi_THD(T)
#else
#define mysql_thread_set_psi_THD(T) do {} while (0)
#endif
static inline void inline_mysql_mutex_register(
#ifdef HAVE_PSI_MUTEX_INTERFACE
const char *category,
......@@ -1154,7 +1194,7 @@ static inline int inline_mysql_cond_destroy(
static inline int inline_mysql_cond_wait(
mysql_cond_t *that,
mysql_mutex_t *mutex
#ifdef HAVE_PSI_COND_INTERFACE
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
, const char *src_file, uint src_line
#endif
)
......@@ -1191,7 +1231,7 @@ static inline int inline_mysql_cond_timedwait(
mysql_cond_t *that,
mysql_mutex_t *mutex,
const struct timespec *abstime
#ifdef HAVE_PSI_COND_INTERFACE
#if defined(SAFE_MUTEX) || defined(HAVE_PSI_COND_INTERFACE)
, const char *src_file, uint src_line
#endif
)
......@@ -1281,6 +1321,16 @@ static inline void inline_mysql_thread_set_psi_id(my_thread_id id)
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
PSI_THREAD_CALL(set_thread_id)(psi, id);
}
#ifdef __cplusplus
class THD;
static inline void inline_mysql_thread_set_psi_THD(THD *thd)
{
struct PSI_thread *psi= PSI_THREAD_CALL(get_thread)();
PSI_THREAD_CALL(set_thread_THD)(psi, thd);
}
#endif /* __cplusplus */
#endif
#endif /* DISABLE_MYSQL_THREAD_H */
......
/* Copyright (c) 2013, 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, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
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, version 2.0, 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_TRANSACTION_H
#define MYSQL_TRANSACTION_H
/**
@file mysql/psi/mysql_transaction.h
Instrumentation helpers for transactions.
*/
#include "mysql/psi/psi.h"
#ifndef PSI_TRANSACTION_CALL
#define PSI_TRANSACTION_CALL(M) PSI_DYNAMIC_CALL(M)
#endif
/**
@defgroup Transaction_instrumentation Transaction Instrumentation
@ingroup Instrumentation_interface
@{
*/
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \
inline_mysql_start_transaction(STATE, XID, TRXID, ISO, RO, AC, __FILE__, __LINE__)
#else
#define MYSQL_START_TRANSACTION(STATE, XID, TRXID, ISO, RO, AC) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \
inline_mysql_set_transaction_gtid(LOCKER, P1, P2)
#else
#define MYSQL_SET_TRANSACTION_GTID(LOCKER, P1, P2) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \
inline_mysql_set_transaction_xid(LOCKER, P1, P2)
#else
#define MYSQL_SET_TRANSACTION_XID(LOCKER, P1, P2) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \
inline_mysql_set_transaction_xa_state(LOCKER, P1)
#else
#define MYSQL_SET_TRANSACTION_XA_STATE(LOCKER, P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \
inline_mysql_set_transaction_trxid(LOCKER, P1)
#else
#define MYSQL_SET_TRANSACTION_TRXID(LOCKER, P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \
inline_mysql_inc_transaction_savepoints(LOCKER, P1)
#else
#define MYSQL_INC_TRANSACTION_SAVEPOINTS(LOCKER, P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \
inline_mysql_inc_transaction_rollback_to_savepoint(LOCKER, P1)
#else
#define MYSQL_INC_TRANSACTION_ROLLBACK_TO_SAVEPOINT(LOCKER, P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \
inline_mysql_inc_transaction_release_savepoint(LOCKER, P1)
#else
#define MYSQL_INC_TRANSACTION_RELEASE_SAVEPOINT(LOCKER, P1) \
do {} while (0)
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \
inline_mysql_rollback_transaction(LOCKER)
#else
#define MYSQL_ROLLBACK_TRANSACTION(LOCKER) \
NULL
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
inline_mysql_commit_transaction(LOCKER)
#else
#define MYSQL_COMMIT_TRANSACTION(LOCKER) \
NULL
#endif
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
static inline struct PSI_transaction_locker *
inline_mysql_start_transaction(PSI_transaction_locker_state *state,
const void *xid,
const ulonglong *trxid,
int isolation_level,
my_bool read_only,
my_bool autocommit,
const char *src_file, int src_line)
{
PSI_transaction_locker *locker;
locker= PSI_TRANSACTION_CALL(get_thread_transaction_locker)(state,
xid, trxid,
isolation_level,
read_only,
autocommit);
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(start_transaction)(locker, src_file, src_line);
return locker;
}
static inline void
inline_mysql_set_transaction_gtid(PSI_transaction_locker *locker,
const void *sid,
const void *gtid_spec)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(set_transaction_gtid)(locker, sid, gtid_spec);
}
static inline void
inline_mysql_set_transaction_xid(PSI_transaction_locker *locker,
const void *xid,
int xa_state)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(set_transaction_xid)(locker, xid, xa_state);
}
static inline void
inline_mysql_set_transaction_xa_state(PSI_transaction_locker *locker,
int xa_state)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(set_transaction_xa_state)(locker, xa_state);
}
static inline void
inline_mysql_set_transaction_trxid(PSI_transaction_locker *locker,
const ulonglong *trxid)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(set_transaction_trxid)(locker, trxid);
}
static inline void
inline_mysql_inc_transaction_savepoints(PSI_transaction_locker *locker,
ulong count)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(inc_transaction_savepoints)(locker, count);
}
static inline void
inline_mysql_inc_transaction_rollback_to_savepoint(PSI_transaction_locker *locker,
ulong count)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(inc_transaction_rollback_to_savepoint)(locker, count);
}
static inline void
inline_mysql_inc_transaction_release_savepoint(PSI_transaction_locker *locker,
ulong count)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(inc_transaction_release_savepoint)(locker, count);
}
static inline void
inline_mysql_rollback_transaction(struct PSI_transaction_locker *locker)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(end_transaction)(locker, false);
}
static inline void
inline_mysql_commit_transaction(struct PSI_transaction_locker *locker)
{
if (likely(locker != NULL))
PSI_TRANSACTION_CALL(end_transaction)(locker, true);
}
#endif
/** @} (end of group Transaction_instrumentation) */
#endif
This diff is collapsed.
/* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2011, 2013, 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, version 2.0,
......
#include "mysql/psi/psi.h"
#include "psi_base.h"
#include "psi_memory.h"
#include "psi_base.h"
struct PSI_thread;
typedef unsigned int PSI_memory_key;
C_MODE_START
struct MDL_key;
typedef struct MDL_key MDL_key;
typedef int opaque_mdl_type;
typedef int opaque_mdl_duration;
typedef int opaque_mdl_status;
typedef int opaque_vio_type;
struct TABLE_SHARE;
struct sql_digest_storage;
struct opaque_THD
{
int dummy;
};
typedef struct opaque_THD THD;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
......@@ -18,14 +34,51 @@ struct PSI_file;
typedef struct PSI_file PSI_file;
struct PSI_socket;
typedef struct PSI_socket PSI_socket;
struct PSI_prepared_stmt;
typedef struct PSI_prepared_stmt PSI_prepared_stmt;
struct PSI_table_locker;
typedef struct PSI_table_locker PSI_table_locker;
struct PSI_statement_locker;
typedef struct PSI_statement_locker PSI_statement_locker;
struct PSI_transaction_locker;
typedef struct PSI_transaction_locker PSI_transaction_locker;
struct PSI_idle_locker;
typedef struct PSI_idle_locker PSI_idle_locker;
struct PSI_digest_locker;
typedef struct PSI_digest_locker PSI_digest_locker;
struct PSI_sp_share;
typedef struct PSI_sp_share PSI_sp_share;
struct PSI_sp_locker;
typedef struct PSI_sp_locker PSI_sp_locker;
struct PSI_metadata_lock;
typedef struct PSI_metadata_lock PSI_metadata_lock;
struct PSI_stage_progress
{
ulonglong m_work_completed;
ulonglong m_work_estimated;
};
typedef struct PSI_stage_progress PSI_stage_progress;
enum PSI_table_io_operation
{
PSI_TABLE_FETCH_ROW= 0,
PSI_TABLE_WRITE_ROW= 1,
PSI_TABLE_UPDATE_ROW= 2,
PSI_TABLE_DELETE_ROW= 3
};
typedef enum PSI_table_io_operation PSI_table_io_operation;
struct PSI_table_locker_state
{
uint m_flags;
enum PSI_table_io_operation m_io_operation;
struct PSI_table *m_table;
struct PSI_table_share *m_table_share;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
void *m_wait;
uint m_index;
};
typedef struct PSI_table_locker_state PSI_table_locker_state;
struct PSI_bootstrap
{
void* (*get_interface)(int version);
......
This diff is collapsed.
/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2013, 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, version 2.0,
......
extern "C" {
}
extern "C" {
struct PSI_thread;
typedef unsigned int PSI_memory_key;
struct PSI_memory_info_v2
{
int placeholder;
};
typedef struct PSI_memory_info_v2 PSI_memory_info;
}
C_MODE_START
struct MDL_key;
typedef struct MDL_key MDL_key;
typedef int opaque_mdl_type;
typedef int opaque_mdl_duration;
typedef int opaque_mdl_status;
typedef int opaque_vio_type;
struct TABLE_SHARE;
struct sql_digest_storage;
class THD;
struct PSI_mutex;
typedef struct PSI_mutex PSI_mutex;
struct PSI_rwlock;
......@@ -17,14 +35,51 @@ struct PSI_file;
typedef struct PSI_file PSI_file;
struct PSI_socket;
typedef struct PSI_socket PSI_socket;
struct PSI_prepared_stmt;
typedef struct PSI_prepared_stmt PSI_prepared_stmt;
struct PSI_table_locker;
typedef struct PSI_table_locker PSI_table_locker;
struct PSI_statement_locker;
typedef struct PSI_statement_locker PSI_statement_locker;
struct PSI_transaction_locker;
typedef struct PSI_transaction_locker PSI_transaction_locker;
struct PSI_idle_locker;
typedef struct PSI_idle_locker PSI_idle_locker;
struct PSI_digest_locker;
typedef struct PSI_digest_locker PSI_digest_locker;
struct PSI_sp_share;
typedef struct PSI_sp_share PSI_sp_share;
struct PSI_sp_locker;
typedef struct PSI_sp_locker PSI_sp_locker;
struct PSI_metadata_lock;
typedef struct PSI_metadata_lock PSI_metadata_lock;
struct PSI_stage_progress
{
ulonglong m_work_completed;
ulonglong m_work_estimated;
};
typedef struct PSI_stage_progress PSI_stage_progress;
enum PSI_table_io_operation
{
PSI_TABLE_FETCH_ROW= 0,
PSI_TABLE_WRITE_ROW= 1,
PSI_TABLE_UPDATE_ROW= 2,
PSI_TABLE_DELETE_ROW= 3
};
typedef enum PSI_table_io_operation PSI_table_io_operation;
struct PSI_table_locker_state
{
uint m_flags;
enum PSI_table_io_operation m_io_operation;
struct PSI_table *m_table;
struct PSI_table_share *m_table_share;
struct PSI_thread *m_thread;
ulonglong m_timer_start;
ulonglong (*m_timer)(void);
void *m_wait;
uint m_index;
};
typedef struct PSI_table_locker_state PSI_table_locker_state;
struct PSI_bootstrap
{
void* (*get_interface)(int version);
......@@ -40,6 +95,8 @@ struct PSI_file_locker;
typedef struct PSI_file_locker PSI_file_locker;
struct PSI_socket_locker;
typedef struct PSI_socket_locker PSI_socket_locker;
struct PSI_metadata_locker;
typedef struct PSI_metadata_locker PSI_metadata_locker;
enum PSI_mutex_operation
{
PSI_MUTEX_LOCK= 0,
......@@ -51,7 +108,13 @@ enum PSI_rwlock_operation
PSI_RWLOCK_READLOCK= 0,
PSI_RWLOCK_WRITELOCK= 1,
PSI_RWLOCK_TRYREADLOCK= 2,
PSI_RWLOCK_TRYWRITELOCK= 3
PSI_RWLOCK_TRYWRITELOCK= 3,
PSI_RWLOCK_SHAREDLOCK= 4,
PSI_RWLOCK_SHAREDEXCLUSIVELOCK= 5,
PSI_RWLOCK_EXCLUSIVELOCK= 6,
PSI_RWLOCK_TRYSHAREDLOCK= 7,
PSI_RWLOCK_TRYSHAREDEXCLUSIVELOCK= 8,
PSI_RWLOCK_TRYEXCLUSIVELOCK= 9
};
typedef enum PSI_rwlock_operation PSI_rwlock_operation;
enum PSI_cond_operation
......@@ -81,14 +144,6 @@ enum PSI_file_operation
PSI_FILE_SYNC= 16
};
typedef enum PSI_file_operation PSI_file_operation;
enum PSI_table_io_operation
{
PSI_TABLE_FETCH_ROW= 0,
PSI_TABLE_WRITE_ROW= 1,
PSI_TABLE_UPDATE_ROW= 2,
PSI_TABLE_DELETE_ROW= 3
};
typedef enum PSI_table_io_operation PSI_table_io_operation;
enum PSI_table_lock_operation
{
PSI_TABLE_LOCK= 0,
......@@ -160,6 +215,10 @@ struct PSI_statement_info_v2
{
int placeholder;
};
struct PSI_transaction_info_v2
{
int placeholder;
};
struct PSI_idle_locker_state_v2
{
int placeholder;
......@@ -180,11 +239,11 @@ struct PSI_file_locker_state_v2
{
int placeholder;
};
struct PSI_table_locker_state_v2
struct PSI_statement_locker_state_v2
{
int placeholder;
};
struct PSI_statement_locker_state_v2
struct PSI_transaction_locker_state_v2
{
int placeholder;
};
......@@ -192,6 +251,10 @@ struct PSI_socket_locker_state_v2
{
int placeholder;
};
struct PSI_metadata_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;
......@@ -200,15 +263,18 @@ typedef struct PSI_thread_info_v2 PSI_thread_info;
typedef struct PSI_file_info_v2 PSI_file_info;
typedef struct PSI_stage_info_v2 PSI_stage_info;
typedef struct PSI_statement_info_v2 PSI_statement_info;
typedef struct PSI_transaction_info_v2 PSI_transaction_info;
typedef struct PSI_socket_info_v2 PSI_socket_info;
typedef struct PSI_idle_locker_state_v2 PSI_idle_locker_state;
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_statement_locker_state_v2 PSI_statement_locker_state;
typedef struct PSI_transaction_locker_state_v2 PSI_transaction_locker_state;
typedef struct PSI_socket_locker_state_v2 PSI_socket_locker_state;
typedef struct PSI_sp_locker_state_v2 PSI_sp_locker_state;
typedef struct PSI_metadata_locker_state_v2 PSI_metadata_locker_state;
extern MYSQL_PLUGIN_IMPORT my_bool pfs_enabled;
extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
C_MODE_END
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
/* Copyright (c) 2008, 2016, 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.
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
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.
GNU General Public License, version 2.0, 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,
......@@ -30,6 +42,7 @@ extern "C" {
*/
#define PSI_INSTRUMENT_ME 0
#define PSI_INSTRUMENT_MEM ((PSI_memory_key)0)
#define PSI_NOT_INSTRUMENTED 0
......@@ -69,6 +82,14 @@ extern "C" {
*/
#define PSI_FLAG_TRANSFER (1 << 5)
/**
Volatility flag.
This flag indicate that an instrumented object
has a volatility (life cycle) comparable
to the volatility of a session.
*/
#define PSI_FLAG_VOLATILITY_SESSION (1 << 6)
#ifdef HAVE_PSI_INTERFACE
/**
......
/* Copyright (c) 2013, 2015, 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.
it under the terms of the GNU General Public License, version 2.0,
as published by the Free Software Foundation.
This program is also distributed with certain software (including
but not limited to OpenSSL) that is licensed under separate terms,
as designated in a particular file or component or in included license
documentation. The authors of MySQL hereby grant you an additional
permission to link the program and your derivative works with the
separately licensed software that they have included with MySQL.
Without limiting anything contained in the foregoing, this file,
which is part of C Driver for MySQL (Connector/C), is also subject to the
Universal FOSS Exception, version 1.0, a copy of which can be found at
http://oss.oracle.com/licenses/universal-foss-exception.
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.
GNU General Public License, version 2.0, 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,
......
/* Copyright (c) 2012, 2015, 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_FILE_PROVIDER_H
#define PFS_FILE_PROVIDER_H
/**
@file include/pfs_file_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_FILE_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_FILE_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_file_v1(const char *category,
PSI_file_info_v1 *info,
int count);
void pfs_create_file_v1(PSI_file_key key, const char *name, File file);
PSI_file_locker*
pfs_get_thread_file_name_locker_v1(PSI_file_locker_state *state,
PSI_file_key key,
PSI_file_operation op,
const char *name, const void *identity);
PSI_file_locker*
pfs_get_thread_file_stream_locker_v1(PSI_file_locker_state *state,
PSI_file *file, PSI_file_operation op);
PSI_file_locker*
pfs_get_thread_file_descriptor_locker_v1(PSI_file_locker_state *state,
File file, PSI_file_operation op);
void pfs_start_file_open_wait_v1(PSI_file_locker *locker,
const char *src_file,
uint src_line);
PSI_file* pfs_end_file_open_wait_v1(PSI_file_locker *locker, void *result);
void pfs_end_file_open_wait_and_bind_to_descriptor_v1
(PSI_file_locker *locker, File file);
void pfs_end_temp_file_open_wait_and_bind_to_descriptor_v1
(PSI_file_locker *locker, File file, const char *filename);
void pfs_start_file_wait_v1(PSI_file_locker *locker,
size_t count,
const char *src_file,
uint src_line);
void pfs_end_file_wait_v1(PSI_file_locker *locker,
size_t byte_count);
void pfs_start_file_close_wait_v1(PSI_file_locker *locker,
const char *src_file,
uint src_line);
void pfs_end_file_close_wait_v1(PSI_file_locker *locker, int rc);
C_MODE_END
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_FILE_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_IDLE_PROVIDER_H
#define PFS_IDLE_PROVIDER_H
/**
@file include/pfs_idle_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_IDLE_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_IDLE_CALL(M) pfs_ ## M ## _v1
C_MODE_START
PSI_idle_locker*
pfs_start_idle_wait_v1(PSI_idle_locker_state* state, const char *src_file, uint src_line);
void pfs_end_idle_wait_v1(PSI_idle_locker* locker);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_IDLE_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_MEMORY_PROVIDER_H
#define PFS_MEMORY_PROVIDER_H
/**
@file include/pfs_memory_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_MEMORY_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_MEMORY_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_memory_v1
(const char *category, struct PSI_memory_info_v1 *info, int count);
PSI_memory_key
pfs_memory_alloc_v1
(PSI_memory_key key, size_t size, PSI_thread **owner);
PSI_memory_key
pfs_memory_realloc_v1
(PSI_memory_key key, size_t old_size, size_t new_size, PSI_thread **owner);
void pfs_memory_free_v1
(PSI_memory_key key, size_t size, PSI_thread *owner);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_MEMORY_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_METADATA_PROVIDER_H
#define PFS_METADATA_PROVIDER_H
/**
@file include/pfs_metadata_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_METADATA_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_METADATA_CALL(M) pfs_ ## M ## _v1
C_MODE_START
PSI_metadata_lock* pfs_create_metadata_lock_v1
(void *identity,
const MDL_key *key,
opaque_mdl_type mdl_type,
opaque_mdl_duration mdl_duration,
opaque_mdl_status mdl_status,
const char *src_file,
uint src_line);
void pfs_set_metadata_lock_status_v1
(PSI_metadata_lock *lock,
opaque_mdl_status mdl_status);
void pfs_destroy_metadata_lock_v1(PSI_metadata_lock *lock);
struct PSI_metadata_locker*
pfs_start_metadata_wait_v1
(struct PSI_metadata_locker_state_v1 *state,
struct PSI_metadata_lock *mdl,
const char *src_file, uint src_line);
void pfs_end_metadata_wait_v1
(struct PSI_metadata_locker *locker, int rc);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_METADATA_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_SOCKET_PROVIDER_H
#define PFS_SOCKET_PROVIDER_H
/**
@file include/pfs_socket_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_SOCKET_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_SOCKET_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_socket_v1(const char *category,
PSI_socket_info_v1 *info,
int count);
PSI_socket*
pfs_init_socket_v1(PSI_socket_key key, const my_socket *fd,
const struct sockaddr *addr, socklen_t addr_len);
void pfs_destroy_socket_v1(PSI_socket *socket);
PSI_socket_locker*
pfs_start_socket_wait_v1(PSI_socket_locker_state *state,
PSI_socket *socket,
PSI_socket_operation op,
size_t count,
const char *src_file, uint src_line);
void pfs_end_socket_wait_v1(PSI_socket_locker *locker, size_t byte_count);
void pfs_set_socket_state_v1(PSI_socket *socket, PSI_socket_state state);
void pfs_set_socket_info_v1(PSI_socket *socket,
const my_socket *fd,
const struct sockaddr *addr,
socklen_t addr_len);
void pfs_set_socket_thread_owner_v1(PSI_socket *socket);
C_MODE_END
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_SOCKET_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_STAGE_PROVIDER_H
#define PFS_STAGE_PROVIDER_H
/**
@file include/pfs_stage_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_STAGE_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_STAGE_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_stage_v1(const char *category,
PSI_stage_info_v1 **info_array,
int count);
PSI_stage_progress* pfs_start_stage_v1(PSI_stage_key key, const char *src_file, int src_line);
PSI_stage_progress* pfs_get_current_stage_progress_v1();
void pfs_end_stage_v1();
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_STAGE_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_STATEMENT_PROVIDER_H
#define PFS_STATEMENT_PROVIDER_H
/**
@file include/pfs_statement_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_STATEMENT_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_STATEMENT_CALL(M) pfs_ ## M ## _v1
#define PSI_DIGEST_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_statement_v1(const char *category,
PSI_statement_info_v1 *info,
int count);
PSI_statement_locker*
pfs_get_thread_statement_locker_v1(PSI_statement_locker_state *state,
PSI_statement_key key,
const void *charset,
PSI_sp_share *sp_share);
PSI_statement_locker*
pfs_refine_statement_v1(PSI_statement_locker *locker,
PSI_statement_key key);
void pfs_start_statement_v1(PSI_statement_locker *locker,
const char *db, uint db_len,
const char *src_file, uint src_line);
void pfs_set_statement_text_v1(PSI_statement_locker *locker,
const char *text, uint text_len);
void pfs_set_statement_lock_time_v1(PSI_statement_locker *locker,
ulonglong count);
void pfs_set_statement_rows_sent_v1(PSI_statement_locker *locker,
ulonglong count);
void pfs_set_statement_rows_examined_v1(PSI_statement_locker *locker,
ulonglong count);
void pfs_inc_statement_created_tmp_disk_tables_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_created_tmp_tables_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_select_full_join_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_select_full_range_join_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_select_range_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_select_range_check_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_select_scan_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_sort_merge_passes_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_sort_range_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_sort_rows_v1(PSI_statement_locker *locker,
ulong count);
void pfs_inc_statement_sort_scan_v1(PSI_statement_locker *locker,
ulong count);
void pfs_set_statement_no_index_used_v1(PSI_statement_locker *locker);
void pfs_set_statement_no_good_index_used_v1(PSI_statement_locker *locker);
void pfs_end_statement_v1(PSI_statement_locker *locker, void *stmt_da);
PSI_digest_locker *pfs_digest_start_v1(PSI_statement_locker *locker);
void pfs_digest_end_v1(PSI_digest_locker *locker,
const sql_digest_storage *digest);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_STATEMENT_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_PROVIDER_H
#define PFS_TABLE_PROVIDER_H
/**
@file include/pfs_table_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_TABLE_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_TABLE_CALL(M) pfs_ ## M ## _v1
C_MODE_START
PSI_table_share*
pfs_get_table_share_v1(my_bool temporary, struct TABLE_SHARE *share);
void pfs_release_table_share_v1(PSI_table_share* share);
void
pfs_drop_table_share_v1(my_bool temporary,
const char *schema_name, int schema_name_length,
const char *table_name, int table_name_length);
PSI_table*
pfs_open_table_v1(PSI_table_share *share, const void *identity);
void pfs_unbind_table_v1(PSI_table *table);
PSI_table *
pfs_rebind_table_v1(PSI_table_share *share, const void *identity, PSI_table *table);
void pfs_close_table_v1(struct TABLE_SHARE *server_share, PSI_table *table);
PSI_table_locker*
pfs_start_table_io_wait_v1(PSI_table_locker_state *state,
PSI_table *table,
PSI_table_io_operation op,
uint index,
const char *src_file, uint src_line);
PSI_table_locker*
pfs_start_table_lock_wait_v1(PSI_table_locker_state *state,
PSI_table *table,
PSI_table_lock_operation op,
ulong op_flags,
const char *src_file, uint src_line);
void pfs_end_table_io_wait_v1(PSI_table_locker* locker, ulonglong numrows);
void pfs_end_table_lock_wait_v1(PSI_table_locker* locker);
void pfs_unlock_table_v1(PSI_table *table);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_TABLE_INTERFACE */
#endif
/* Copyright (c) 2012, 2015, 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_THREAD_PROVIDER_H
#define PFS_THREAD_PROVIDER_H
/**
@file include/pfs_thread_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_THREAD_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_MUTEX_CALL(M) pfs_ ## M ## _v1
#define PSI_RWLOCK_CALL(M) pfs_ ## M ## _v1
#define PSI_COND_CALL(M) pfs_ ## M ## _v1
#define PSI_THREAD_CALL(M) pfs_ ## M ## _v1
C_MODE_START
void pfs_register_mutex_v1(const char *category,
PSI_mutex_info_v1 *info,
int count);
void pfs_register_rwlock_v1(const char *category,
PSI_rwlock_info_v1 *info,
int count);
void pfs_register_cond_v1(const char *category,
PSI_cond_info_v1 *info,
int count);
void pfs_register_thread_v1(const char *category,
PSI_thread_info_v1 *info,
int count);
PSI_mutex*
pfs_init_mutex_v1(PSI_mutex_key key, const void *identity);
void pfs_destroy_mutex_v1(PSI_mutex* mutex);
PSI_rwlock*
pfs_init_rwlock_v1(PSI_rwlock_key key, const void *identity);
void pfs_destroy_rwlock_v1(PSI_rwlock* rwlock);
PSI_cond*
pfs_init_cond_v1(PSI_cond_key key, const void *identity);
void pfs_destroy_cond_v1(PSI_cond* cond);
int pfs_spawn_thread_v1(PSI_thread_key key,
pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void*), void *arg);
PSI_thread*
pfs_new_thread_v1(PSI_thread_key key, const void *identity, ulonglong processlist_id);
void pfs_set_thread_id_v1(PSI_thread *thread, ulonglong processlist_id);
void pfs_set_thread_THD_v1(PSI_thread *thread, THD *thd);
void pfs_set_thread_os_id_v1(PSI_thread *thread);
PSI_thread*
pfs_get_thread_v1(void);
void pfs_set_thread_user_v1(const char *user, int user_len);
void pfs_set_thread_account_v1(const char *user, int user_len,
const char *host, int host_len);
void pfs_set_thread_db_v1(const char* db, int db_len);
void pfs_set_thread_command_v1(int command);
void pfs_set_thread_start_time_v1(time_t start_time);
void pfs_set_thread_state_v1(const char* state);
void pfs_set_connection_type_v1(opaque_vio_type conn_type);
void pfs_set_thread_info_v1(const char* info, uint info_len);
void pfs_set_thread_v1(PSI_thread* thread);
void pfs_delete_current_thread_v1(void);
void pfs_delete_thread_v1(PSI_thread *thread);
PSI_mutex_locker*
pfs_start_mutex_wait_v1(PSI_mutex_locker_state *state,
PSI_mutex *mutex, PSI_mutex_operation op,
const char *src_file, uint src_line);
PSI_rwlock_locker*
pfs_start_rwlock_rdwait_v1(PSI_rwlock_locker_state *state,
PSI_rwlock *rwlock,
PSI_rwlock_operation op,
const char *src_file, uint src_line);
PSI_rwlock_locker*
pfs_start_rwlock_wrwait_v1(PSI_rwlock_locker_state *state,
PSI_rwlock *rwlock,
PSI_rwlock_operation op,
const char *src_file, uint src_line);
PSI_cond_locker*
pfs_start_cond_wait_v1(PSI_cond_locker_state *state,
PSI_cond *cond, PSI_mutex *mutex,
PSI_cond_operation op,
const char *src_file, uint src_line);
PSI_table_locker*
pfs_start_table_io_wait_v1(PSI_table_locker_state *state,
PSI_table *table,
PSI_table_io_operation op,
uint index,
const char *src_file, uint src_line);
PSI_table_locker*
pfs_start_table_lock_wait_v1(PSI_table_locker_state *state,
PSI_table *table,
PSI_table_lock_operation op,
ulong op_flags,
const char *src_file, uint src_line);
void pfs_unlock_mutex_v1(PSI_mutex *mutex);
void pfs_unlock_rwlock_v1(PSI_rwlock *rwlock);
void pfs_signal_cond_v1(PSI_cond* cond);
void pfs_broadcast_cond_v1(PSI_cond* cond);
void pfs_end_mutex_wait_v1(PSI_mutex_locker* locker, int rc);
void pfs_end_rwlock_rdwait_v1(PSI_rwlock_locker* locker, int rc);
void pfs_end_rwlock_wrwait_v1(PSI_rwlock_locker* locker, int rc);
void pfs_end_cond_wait_v1(PSI_cond_locker* locker, int rc);
int pfs_set_thread_connect_attrs_v1(const char *buffer, uint length,
const void *from_cs);
C_MODE_END
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_THREAD_INTERFACE */
#endif
/* Copyright (c) 2013, 2015, 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_TRANSACTION_PROVIDER_H
#define PFS_TRANSACTION_PROVIDER_H
/**
@file include/pfs_transaction_provider.h
Performance schema instrumentation (declarations).
*/
#ifdef HAVE_PSI_TRANSACTION_INTERFACE
#ifdef MYSQL_SERVER
#ifndef EMBEDDED_LIBRARY
#ifndef MYSQL_DYNAMIC_PLUGIN
#include "mysql/psi/psi.h"
#define PSI_TRANSACTION_CALL(M) pfs_ ## M ## _v1
C_MODE_START
PSI_transaction_locker*
pfs_get_thread_transaction_locker_v1(PSI_transaction_locker_state *state,
const void *xid,
const ulonglong *trxid,
int isolation_level,
my_bool read_only,
my_bool autocommit);
void pfs_start_transaction_v1(PSI_transaction_locker *locker,
const char *src_file, uint src_line);
void pfs_set_transaction_xid_v1(PSI_transaction_locker *locker,
const void *xid,
int xa_state);
void pfs_set_transaction_xa_state_v1(PSI_transaction_locker *locker,
int xa_state);
void pfs_set_transaction_gtid_v1(PSI_transaction_locker *locker,
const void *sid,
const void *gtid_spec);
void pfs_set_transaction_trxid_v1(PSI_transaction_locker *locker,
const ulonglong *trxid);
void pfs_inc_transaction_savepoints_v1(PSI_transaction_locker *locker,
ulong count);
void pfs_inc_transaction_rollback_to_savepoint_v1(PSI_transaction_locker *locker,
ulong count);
void pfs_inc_transaction_release_savepoint_v1(PSI_transaction_locker *locker,
ulong count);
void pfs_end_transaction_v1(PSI_transaction_locker *locker, my_bool commit);
C_MODE_END
#endif /* MYSQL_DYNAMIC_PLUGIN */
#endif /* EMBEDDED_LIBRARY */
#endif /* MYSQL_SERVER */
#endif /* HAVE_PSI_TRANSACTION_INTERFACE */
#endif
......@@ -148,7 +148,7 @@ drop table if exists marker_multi_delete;
use my_replicated_db;
insert into performance_schema.setup_actors
values ('FOO', 'FOO', 'FOO');
values ('FOO', 'FOO', 'FOO', 'YES', 'YES');
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
delete my_tx_table.*, performance_schema.setup_actors.*
......@@ -157,7 +157,7 @@ delete my_tx_table.*, performance_schema.setup_actors.*
or performance_schema.setup_actors.role='FOO';
insert into performance_schema.setup_actors
values ('BAR', 'BAR', 'BAR');
values ('BAR', 'BAR', 'BAR', 'YES', 'YES');
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
delete my_non_tx_table.*, performance_schema.setup_actors.*
......@@ -166,7 +166,7 @@ delete my_non_tx_table.*, performance_schema.setup_actors.*
or performance_schema.setup_actors.role='BAR';
insert into performance_schema.setup_actors
values ('BAZ', 'BAZ', 'BAZ');
values ('BAZ', 'BAZ', 'BAZ', 'YES', 'YES');
--error 0, ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES
delete my_bh_table.*, performance_schema.setup_actors.*
......@@ -184,5 +184,5 @@ drop database my_replicated_db;
# Restore performance_schema.setup_actors, damaged by this script
truncate table performance_schema.setup_actors;
insert into performance_schema.setup_actors values ('%', '%', '%');
insert into performance_schema.setup_actors values ('%', '%', '%', 'YES', 'YES');
......@@ -36,6 +36,12 @@ drop prepare dump_statements_host;
drop prepare dump_statements_history;
drop prepare dump_statements_global;
drop prepare dump_transactions_account;
drop prepare dump_transactions_user;
drop prepare dump_transactions_host;
drop prepare dump_transactions_history;
drop prepare dump_transactions_global;
drop prepare dump_users;
drop prepare dump_hosts;
drop prepare dump_accounts;
......@@ -49,6 +55,7 @@ insert into performance_schema.setup_actors
select * from test.setup_actors;
drop table test.setup_actors;
drop table test.t1;
drop function test.f;
update performance_schema.threads set instrumented='YES';
update performance_schema.setup_instruments set enabled='YES', timed='YES';
......
# Tests for the performance schema
# ===========================================
# HELPER include/memory_aggregate_cleanup.inc
# ===========================================
--disable_query_log
revoke all privileges, grant option from user1@localhost;
revoke all privileges, grant option from user2@localhost;
revoke all privileges, grant option from user3@localhost;
revoke all privileges, grant option from user4@localhost;
drop user user1@localhost;
drop user user2@localhost;
drop user user3@localhost;
drop user user4@localhost;
flush privileges;
drop procedure dump_thread;
drop procedure dump_one_thread;
drop prepare dump_memory_account;
drop prepare dump_memory_user;
drop prepare dump_memory_host;
drop prepare dump_memory_global;
drop prepare dump_users;
drop prepare dump_hosts;
drop prepare dump_accounts;
truncate table performance_schema.accounts;
truncate table performance_schema.users;
truncate table performance_schema.hosts;
truncate table performance_schema.setup_actors;
insert into performance_schema.setup_actors
select * from test.setup_actors;
drop table test.setup_actors;
set global query_cache_size=0;
update performance_schema.threads set instrumented='YES';
update performance_schema.setup_instruments set enabled='YES', timed='YES';
--enable_query_log
This diff is collapsed.
This diff is collapsed.
#
# Deallocates all the prepared statements
# created in prepares_stmts_setup.inc
#
DEALLOCATE PREPARE st1;
DEALLOCATE PREPARE st2;
DEALLOCATE PREPARE st3;
DEALLOCATE PREPARE st4;
DROP TABLE t1;
#
# Execution of all the prepared statements created in
# prepared_statements_setup.inc.
#
SET @a = 3;
SET @b = 4;
EXECUTE st1 USING @a, @b;
#SET @table = 't1';
EXECUTE st2;
SET @c=3;
EXECUTE st3 using @c;
EXECUTE st4;
#
# Creating various prepared statements.
# HELPER include/prepared_stmts_setup.inc
#
CREATE TABLE t1 (a INT NOT NULL);
INSERT INTO t1 VALUES (4), (8), (11), (32), (80);
# Prepared statments
PREPARE st1 FROM 'SELECT SQRT(POW(?,2) + POW(?,2)) AS hypotenuse';
SET @table = 't1';
SET @s = CONCAT('SELECT * FROM ', @table);
PREPARE st2 FROM @s;
PREPARE st3 FROM 'INSERT INTO t1 SELECT * FROM t1 WHERE a<=?';
PREPARE st4 FROM
'(SELECT a FROM t1) UNION (SELECT a+10 FROM t1) ORDER BY RAND()*0+a';
#
# clean up of set-up created in
# suite/perfschema/include/program_setup.inc
#
--disable_warnings
DROP PROCEDURE SampleProc1;
DROP PROCEDURE SampleProc2;
DROP PROCEDURE SampleProc3;
DROP PROCEDURE SampleProc4;
DROP FUNCTION wt_avg;
DROP FUNCTION fac;
DROP FUNCTION append;
DROP TRIGGER trg1;
DROP TRIGGER trg2;
DROP TRIGGER trg3;
DROP TRIGGER trg4;
DROP TRIGGER trg5;
DROP EVENT IF EXISTS e1;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
DROP TABLE table_t;
DROP DATABASE stored_programs;
--enable_warnings
#
# Execute the stored programs created in
# suite/perfschema/include/program_setup.inc
#
--echo #####################
--echo # Executing queries #
--echo #####################
INSERT INTO t1 VALUES (10,20);
CALL SampleProc1(30,40,50);
SET @a=1;
SELECT @a;
CALL SampleProc2("Jwalamukhi",34);
SELECT @a;
CALL SampleProc3();
CALL SampleProc4();
SET @change=1;
SELECT @change;
UPDATE t2 SET id=22 WHERE name="Jwalamukhi";
SELECT @change;
SET @del=1;
SELECT @del;
DELETE FROM t1 WHERE i=76;
SELECT @del;
SELECT wt_avg(1, 12, 1990, 1121990);
SELECT fac(5);
SELECT append("Bolly", "wood");
--echo # Event
SET GLOBAL event_scheduler=ON;
CREATE TABLE table_t(a INT);
DELIMITER |;
CREATE EVENT e1 ON SCHEDULE EVERY 2 SECOND DO
BEGIN
INSERT INTO table_t VALUES(1);
END|
DELIMITER ;|
# Let e1 insert 1 record into the table table_t
--let $wait_condition= select count(*) = 1 from table_t
--source include/wait_condition.inc
SELECT * FROM table_t;
# Wait till the above one execution of event is instrumented.
--let $wait_condition= select count(*) = 1 from performance_schema.events_statements_history_long where object_type='EVENT'
--source include/wait_condition.inc
SET GLOBAL event_scheduler=OFF;
--source include/no_running_event_scheduler.inc
#
# clean up if set-up created in
# suite/perfschema/include/program_nested_setup.inc
#
DROP PROCEDURE c4;
DROP PROCEDURE c3;
DROP PROCEDURE c2;
DROP PROCEDURE c1;
DROP PROCEDURE inc;
DROP PROCEDURE inc2;
DROP PROCEDURE iotest;
DROP FUNCTION mul;
DROP FUNCTION inc;
DROP FUNCTION fac;
DROP FUNCTION fun;
DROP PROCEDURE ifac;
DROP TRIGGER trg;
DROP TABLE t1,t2;
DROP DATABASE nested_sp;
#
# Execute the nested stored programs created in
# suite/include/perfschema/program_nested_setup.inc
#
--echo #####################
--echo # Executing queries #
--echo #####################
CALL c1(42);
SELECT * FROM t1;
DELETE FROM t1;
CALL iotest("io1", "io2", 1);
SELECT * FROM t1 ORDER BY data DESC;
DELETE FROM t1;
SELECT fun(6,10);
INSERT INTO t1 VALUES (20,13);
SELECT * FROM t2;
This diff is collapsed.
This diff is collapsed.
# ==== Purpose ====
#
# Auxiliary file used by transaction_gtid.test
#
# Invoked between transactions in order to reset the state:
# - set GTID_NEXT to AUTOMATIC since this is required after
# any transaction that has GTID_NEXT=UUID:NUMBER
# - RESET MASTER in order to clear @@global.gtid_executed, so
# that the same GTID can be executed again.
# - truncate the performance_schema.events_transaction_* tables
#
# All this is done on the connection 'server_1'.
--disable_query_log
--connection server_1
RESET MASTER;
TRUNCATE TABLE performance_schema.events_transactions_history;
TRUNCATE TABLE performance_schema.events_transactions_current;
--enable_query_log
--connection default
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -14,3 +14,4 @@
--remove_file $MYSQLTEST_VARDIR/tmp/err_file
--remove_file $MYSQLD_DATADIR/mysql_upgrade_info
--source include/mysql_upgrade_cleanup.inc
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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