summaryrefslogtreecommitdiff
path: root/include/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'include/mysql')
-rw-r--r--include/mysql/plugin.h7
-rw-r--r--include/mysql/plugin_audit.h.pp23
-rw-r--r--include/mysql/plugin_auth.h.pp23
-rw-r--r--include/mysql/plugin_ftparser.h.pp25
-rw-r--r--include/mysql/service_progress_report.h82
-rw-r--r--include/mysql/services.h1
-rw-r--r--include/mysql/thread_pool_priv.h1
7 files changed, 149 insertions, 13 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index f77dfbcc8d5..32228b63428 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -1,4 +1,5 @@
/* Copyright (C) 2005 MySQL AB, 2009 Sun Microsystems, Inc.
+ Copyright (C) 2009-2011 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
@@ -75,7 +76,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0102
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x0100
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x0101
/*
The allowable types of plugins
@@ -590,10 +591,6 @@ char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
/* Increments the row counter, see THD::row_count */
void thd_inc_row_count(MYSQL_THD thd);
-#define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
-const char *set_thd_proc_info(void *, const char * info, const char *func,
- const char *file, const unsigned int line);
-
/**
Create a temporary file.
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 42d44b9dae0..a435c7c64b2 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -59,6 +59,27 @@ extern struct my_thread_scheduler_service {
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
+#include <mysql/service_progress_report.h>
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -200,8 +221,6 @@ int thd_tx_isolation(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, const unsigned int line);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 9bf16181273..7a40ee5b9f7 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -59,6 +59,27 @@ extern struct my_thread_scheduler_service {
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
+#include <mysql/service_progress_report.h>
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -200,8 +221,6 @@ int thd_tx_isolation(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
-const char *set_thd_proc_info(void *, const char * info, const char *func,
- const char *file, const unsigned int line);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index 0067732d4fc..527be747cb4 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -43,7 +43,7 @@ typedef enum _thd_wait_type_e {
THD_WAIT_BINLOG= 8,
THD_WAIT_GROUP_COMMIT= 9,
THD_WAIT_SYNC= 10,
- THD_WAIT_LAST= 11
+ THD_WAIT_LAST= 11
} thd_wait_type;
extern struct thd_wait_service_st {
void (*thd_wait_begin_func)(void*, int);
@@ -59,6 +59,27 @@ extern struct my_thread_scheduler_service {
} *my_thread_scheduler_service;
int my_thread_scheduler_set(struct scheduler_functions *scheduler);
int my_thread_scheduler_reset();
+#include <mysql/service_progress_report.h>
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(void* thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(void* thd);
+ void (*thd_progress_end_func)(void* thd);
+ const char *(*set_thd_proc_info_func)(void*, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+void thd_progress_init(void* thd, unsigned int max_stage);
+void thd_progress_report(void* thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(void* thd);
+void thd_progress_end(void* thd);
+const char *set_thd_proc_info(void*, const char * info, const char *func,
+ const char *file, unsigned int line);
struct st_mysql_xid {
long formatID;
long gtrid_length;
@@ -153,8 +174,6 @@ int thd_tx_isolation(const void* thd);
char *thd_security_context(void* thd, char *buffer, unsigned int length,
unsigned int max_query_len);
void thd_inc_row_count(void* thd);
-const char *set_thd_proc_info(void*, const char * info, const char *func,
- const char *file, const unsigned int line);
int mysql_tmpfile(const char *prefix);
int thd_killed(const void* thd);
unsigned long thd_get_thread_id(const void* thd);
diff --git a/include/mysql/service_progress_report.h b/include/mysql/service_progress_report.h
new file mode 100644
index 00000000000..670b1c37630
--- /dev/null
+++ b/include/mysql/service_progress_report.h
@@ -0,0 +1,82 @@
+#ifndef MYSQL_SERVICE_PROGRESS_REPORT_INCLUDED
+/* Copyright (C) 2011 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/**
+ @file
+ This service allows plugins to report progress of long running operations
+ to the server. The progress report is visible in SHOW PROCESSLIST,
+ INFORMATION_SCHEMA.PROCESSLIST, and is sent to the client
+ if requested.
+
+ The functions are documented at
+ http://kb.askmonty.org/en/progress-reporting#how-to-add-support-for-progress-reporting-to-a-storage-engine
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define thd_proc_info(thd, msg) set_thd_proc_info(thd, msg, \
+ __func__, __FILE__, __LINE__)
+
+extern struct progress_report_service_st {
+ void (*thd_progress_init_func)(MYSQL_THD thd, unsigned int max_stage);
+ void (*thd_progress_report_func)(MYSQL_THD thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+ void (*thd_progress_next_stage_func)(MYSQL_THD thd);
+ void (*thd_progress_end_func)(MYSQL_THD thd);
+ const char *(*set_thd_proc_info_func)(MYSQL_THD, const char *info,
+ const char *func,
+ const char *file,
+ unsigned int line);
+} *progress_report_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define thd_progress_init(thd,max_stage) (progress_report_service->thd_progress_init_func((thd),(max_stage)))
+#define thd_progress_report(thd, progress, max_progress) (progress_report_service->thd_progress_report_func((thd), (progress), (max_progress)))
+#define thd_progress_next_stage(thd) (progress_report_service->thd_progress_next_stage_func(thd))
+#define thd_progress_end(thd) (progress_report_service->thd_progress_end_func(thd))
+#define set_thd_proc_info(thd,info,func,file,line) (progress_report_service->set_thd_proc_info_func((thd),(info),(func),(file),(line)))
+
+#else
+
+/**
+ Report progress for long running operations
+
+ @param thd User thread connection handle
+ @param progress Where we are now
+ @param max_progress Progress will continue up to this
+*/
+void thd_progress_init(MYSQL_THD thd, unsigned int max_stage);
+void thd_progress_report(MYSQL_THD thd,
+ unsigned long long progress,
+ unsigned long long max_progress);
+void thd_progress_next_stage(MYSQL_THD thd);
+void thd_progress_end(MYSQL_THD thd);
+const char *set_thd_proc_info(MYSQL_THD, const char * info, const char *func,
+ const char *file, unsigned int line);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_PROGRESS_REPORT_INCLUDED
+#endif
+
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 6c67a582fb8..bd029e55b78 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -22,6 +22,7 @@ extern "C" {
#include <mysql/service_thd_alloc.h>
#include <mysql/service_thd_wait.h>
#include <mysql/service_thread_scheduler.h>
+#include <mysql/service_progress_report.h>
#ifdef __cplusplus
}
diff --git a/include/mysql/thread_pool_priv.h b/include/mysql/thread_pool_priv.h
index 97d0cbfab6a..f56242fd74f 100644
--- a/include/mysql/thread_pool_priv.h
+++ b/include/mysql/thread_pool_priv.h
@@ -51,7 +51,6 @@ void thd_lock_thread_count(THD *thd);
void thd_unlock_thread_count(THD *thd);
void thd_close_connection(THD *thd);
THD *thd_get_current_thd();
-void thd_new_connection_setup(THD *thd, char *stack_start);
void thd_lock_data(THD *thd);
void thd_unlock_data(THD *thd);
bool thd_is_transaction_active(THD *thd);