mirror of
https://github.com/MariaDB/server.git
synced 2025-07-02 14:22:51 +03:00
5.5 merge
This commit is contained in:
@ -72,7 +72,7 @@ typedef struct st_mysql_xid MYSQL_XID;
|
||||
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0103
|
||||
|
||||
/* MariaDB plugin interface version */
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0103
|
||||
#define MARIA_PLUGIN_INTERFACE_VERSION 0x0104
|
||||
|
||||
/*
|
||||
The allowable types of plugins
|
||||
@ -625,23 +625,6 @@ void thd_inc_row_count(MYSQL_THD thd);
|
||||
*/
|
||||
int mysql_tmpfile(const char *prefix);
|
||||
|
||||
/**
|
||||
Check the killed state of a connection
|
||||
|
||||
@details
|
||||
In MySQL support for the KILL statement is cooperative. The KILL
|
||||
statement only sets a "killed" flag. This function returns the value
|
||||
of that flag. A thread should check it often, especially inside
|
||||
time-consuming loops, and gracefully abort the operation if it is
|
||||
non-zero.
|
||||
|
||||
@param thd user thread connection handle
|
||||
@retval 0 the connection is active
|
||||
@retval 1 the connection has been killed
|
||||
*/
|
||||
int thd_killed(const MYSQL_THD thd);
|
||||
|
||||
|
||||
/**
|
||||
Return the thread id of a user thread
|
||||
|
||||
|
@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
|
||||
const char *file, unsigned int line);
|
||||
#include <mysql/service_debug_sync.h>
|
||||
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
|
||||
#include <mysql/service_kill_statement.h>
|
||||
enum thd_kill_levels {
|
||||
THD_IS_NOT_KILLED=0,
|
||||
THD_ABORT_SOFTLY=50,
|
||||
THD_ABORT_ASAP=100,
|
||||
};
|
||||
extern struct kill_statement_service_st {
|
||||
enum thd_kill_levels (*thd_kill_level_func)(const void*);
|
||||
} *thd_kill_statement_service;
|
||||
enum thd_kill_levels thd_kill_level(const void*);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
|
||||
unsigned int max_query_len);
|
||||
void thd_inc_row_count(void* thd);
|
||||
int mysql_tmpfile(const char *prefix);
|
||||
int thd_killed(const void* thd);
|
||||
unsigned long thd_get_thread_id(const void* thd);
|
||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||
void mysql_query_cache_invalidate4(void* thd,
|
||||
|
@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
|
||||
const char *file, unsigned int line);
|
||||
#include <mysql/service_debug_sync.h>
|
||||
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
|
||||
#include <mysql/service_kill_statement.h>
|
||||
enum thd_kill_levels {
|
||||
THD_IS_NOT_KILLED=0,
|
||||
THD_ABORT_SOFTLY=50,
|
||||
THD_ABORT_ASAP=100,
|
||||
};
|
||||
extern struct kill_statement_service_st {
|
||||
enum thd_kill_levels (*thd_kill_level_func)(const void*);
|
||||
} *thd_kill_statement_service;
|
||||
enum thd_kill_levels thd_kill_level(const void*);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
@ -226,7 +236,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
|
||||
unsigned int max_query_len);
|
||||
void thd_inc_row_count(void* thd);
|
||||
int mysql_tmpfile(const char *prefix);
|
||||
int thd_killed(const void* thd);
|
||||
unsigned long thd_get_thread_id(const void* thd);
|
||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||
void mysql_query_cache_invalidate4(void* thd,
|
||||
|
@ -82,6 +82,16 @@ const char *set_thd_proc_info(void*, const char * info, const char *func,
|
||||
const char *file, unsigned int line);
|
||||
#include <mysql/service_debug_sync.h>
|
||||
extern void (*debug_sync_C_callback_ptr)(void*, const char *, size_t);
|
||||
#include <mysql/service_kill_statement.h>
|
||||
enum thd_kill_levels {
|
||||
THD_IS_NOT_KILLED=0,
|
||||
THD_ABORT_SOFTLY=50,
|
||||
THD_ABORT_ASAP=100,
|
||||
};
|
||||
extern struct kill_statement_service_st {
|
||||
enum thd_kill_levels (*thd_kill_level_func)(const void*);
|
||||
} *thd_kill_statement_service;
|
||||
enum thd_kill_levels thd_kill_level(const void*);
|
||||
struct st_mysql_xid {
|
||||
long formatID;
|
||||
long gtrid_length;
|
||||
@ -179,7 +189,6 @@ char *thd_security_context(void* thd, char *buffer, unsigned int length,
|
||||
unsigned int max_query_len);
|
||||
void thd_inc_row_count(void* thd);
|
||||
int mysql_tmpfile(const char *prefix);
|
||||
int thd_killed(const void* thd);
|
||||
unsigned long thd_get_thread_id(const void* thd);
|
||||
void thd_get_xid(const void* thd, MYSQL_XID *xid);
|
||||
void mysql_query_cache_invalidate4(void* thd,
|
||||
|
@ -477,7 +477,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_INTERFACE
|
||||
#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
|
||||
#define mysql_cond_wait(C, M) \
|
||||
inline_mysql_cond_wait(C, M, __FILE__, __LINE__)
|
||||
#else
|
||||
@ -491,7 +491,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_INTERFACE
|
||||
#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
|
||||
#define mysql_cond_timedwait(C, M, W) \
|
||||
inline_mysql_cond_timedwait(C, M, W, __FILE__, __LINE__)
|
||||
#else
|
||||
@ -963,7 +963,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_INTERFACE
|
||||
#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
|
||||
, const char *src_file, uint src_line
|
||||
#endif
|
||||
)
|
||||
@ -980,7 +980,11 @@ static inline int inline_mysql_cond_wait(
|
||||
PSI_server->start_cond_wait(locker, src_file, src_line);
|
||||
}
|
||||
#endif
|
||||
#ifdef SAFE_MUTEX
|
||||
result= safe_cond_wait(&that->m_cond, &mutex->m_mutex, src_file, src_line);
|
||||
#else
|
||||
result= pthread_cond_wait(&that->m_cond, &mutex->m_mutex);
|
||||
#endif
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
if (likely(locker != NULL))
|
||||
PSI_server->end_cond_wait(locker, result);
|
||||
@ -992,7 +996,7 @@ static inline int inline_mysql_cond_timedwait(
|
||||
mysql_cond_t *that,
|
||||
mysql_mutex_t *mutex,
|
||||
struct timespec *abstime
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
#if defined(HAVE_PSI_INTERFACE) || defined(SAFE_MUTEX)
|
||||
, const char *src_file, uint src_line
|
||||
#endif
|
||||
)
|
||||
@ -1009,7 +1013,12 @@ static inline int inline_mysql_cond_timedwait(
|
||||
PSI_server->start_cond_wait(locker, src_file, src_line);
|
||||
}
|
||||
#endif
|
||||
#ifdef SAFE_MUTEX
|
||||
result= safe_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime,
|
||||
src_file, src_line);
|
||||
#else
|
||||
result= pthread_cond_timedwait(&that->m_cond, &mutex->m_mutex, abstime);
|
||||
#endif
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
if (likely(locker != NULL))
|
||||
PSI_server->end_cond_wait(locker, result);
|
||||
|
71
include/mysql/service_kill_statement.h
Normal file
71
include/mysql/service_kill_statement.h
Normal file
@ -0,0 +1,71 @@
|
||||
/* Copyright (c) 2013, Monty Program Ab.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
||||
|
||||
#ifndef MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
|
||||
#define MYSQL_SERVICE_KILL_STATEMENT_INCLUDED
|
||||
|
||||
/**
|
||||
@file
|
||||
This service provides functions that allow plugins to support
|
||||
the KILL statement.
|
||||
|
||||
In MySQL support for the KILL statement is cooperative. The KILL
|
||||
statement only sets a "killed" flag. This function returns the value
|
||||
of that flag. A thread should check it often, especially inside
|
||||
time-consuming loops, and gracefully abort the operation if it is
|
||||
non-zero.
|
||||
|
||||
thd_is_killed(thd)
|
||||
@return 0 - no KILL statement was issued, continue normally
|
||||
@return 1 - there was a KILL statement, abort the execution.
|
||||
|
||||
thd_kill_level(thd)
|
||||
@return thd_kill_levels_enum values
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum thd_kill_levels {
|
||||
THD_IS_NOT_KILLED=0,
|
||||
THD_ABORT_SOFTLY=50, /**< abort when possible, don't leave tables corrupted */
|
||||
THD_ABORT_ASAP=100, /**< abort asap */
|
||||
};
|
||||
|
||||
extern struct kill_statement_service_st {
|
||||
enum thd_kill_levels (*thd_kill_level_func)(const MYSQL_THD);
|
||||
} *thd_kill_statement_service;
|
||||
|
||||
/* backward compatibility helper */
|
||||
#define thd_killed(THD) (thd_kill_level(THD) == THD_ABORT_ASAP)
|
||||
|
||||
#ifdef MYSQL_DYNAMIC_PLUGIN
|
||||
|
||||
#define thd_kill_level(THD) \
|
||||
thd_kill_statement_service->thd_kill_level_func(THD)
|
||||
|
||||
#else
|
||||
|
||||
enum thd_kill_levels thd_kill_level(const MYSQL_THD);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -24,6 +24,7 @@ extern "C" {
|
||||
#include <mysql/service_thread_scheduler.h>
|
||||
#include <mysql/service_progress_report.h>
|
||||
#include <mysql/service_debug_sync.h>
|
||||
#include <mysql/service_kill_statement.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
Reference in New Issue
Block a user