summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/m_string.h11
-rw-r--r--include/maria.h7
-rw-r--r--include/my_base.h2
-rw-r--r--include/my_global.h15
-rw-r--r--include/my_md5.h2
-rw-r--r--include/mysql/plugin.h4
-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.pp23
-rw-r--r--include/mysql/service_logger.h2
-rw-r--r--include/mysql/service_md5.h69
-rw-r--r--include/mysql/service_sha1.h14
-rw-r--r--include/mysql/service_wsrep.h205
-rw-r--r--include/mysql/services.h2
-rw-r--r--include/mysql_com.h6
-rw-r--r--include/mysqld_default_groups.h6
-rw-r--r--include/service_versions.h4
-rw-r--r--include/thr_lock.h13
-rw-r--r--include/thr_timer.h45
-rw-r--r--include/wsrep.h51
20 files changed, 497 insertions, 30 deletions
diff --git a/include/m_string.h b/include/m_string.h
index 395fd2ddda6..0a46805bfae 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -239,4 +239,15 @@ static inline void lex_string_set(LEX_STRING *lex_str, const char *c_str)
lex_str->length= strlen(c_str);
}
+#ifdef __cplusplus
+static inline char *safe_str(char *str)
+{ return str ? str : const_cast<char*>(""); }
+#endif
+
+static inline const char *safe_str(const char *str)
+{ return str ? str : ""; }
+
+static inline size_t safe_strlen(const char *str)
+{ return str ? strlen(str) : 0; }
+
#endif
diff --git a/include/maria.h b/include/maria.h
index 908825b9970..b35dc7dd3f0 100644
--- a/include/maria.h
+++ b/include/maria.h
@@ -19,9 +19,6 @@
#ifndef _maria_h
#define _maria_h
-#ifdef __cplusplus
-extern "C" {
-#endif
#include <my_base.h>
#include <my_sys.h>
#include <m_ctype.h>
@@ -30,6 +27,10 @@ extern "C" {
#include <myisamchk.h>
#include <mysql/plugin.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define MARIA_CANNOT_ROLLBACK
/*
diff --git a/include/my_base.h b/include/my_base.h
index cdf8e189031..a443b4d161c 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -159,8 +159,6 @@ enum ha_extra_function {
Ignore if the a tuple is not found, continue processing the
transaction and ignore that 'row'. Needed for idempotency
handling on the slave
-
- Currently only used by NDB storage engine. Partition handler ignores flag.
*/
HA_EXTRA_IGNORE_NO_KEY,
HA_EXTRA_NO_IGNORE_NO_KEY,
diff --git a/include/my_global.h b/include/my_global.h
index e9a472e686e..4a1cc8c5b75 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -480,16 +480,14 @@ extern "C" int madvise(void *addr, size_t len, int behav);
/*
Suppress uninitialized variable warning without generating code.
-
- The _cplusplus is a temporary workaround for C++ code pending a fix
- for a g++ bug (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34772).
*/
-#if defined(_lint) || defined(FORCE_INIT_OF_VARS) || \
- defined(__cplusplus) || !defined(__GNUC__)
-#define UNINIT_VAR(x) x= 0
-#else
+#if defined(__GNUC__)
/* GCC specific self-initialization which inhibits the warning. */
#define UNINIT_VAR(x) x= x
+#elif defined(_lint) || defined(FORCE_INIT_OF_VARS)
+#define UNINIT_VAR(x) x= 0
+#else
+#define UNINIT_VAR(x) x
#endif
#if !defined(HAVE_UINT)
@@ -1233,9 +1231,6 @@ static inline double rint(double x)
#undef HAVE_SMEM /* No shared memory */
#else
-#ifdef WITH_NDB_BINLOG
-#define HAVE_NDB_BINLOG 1
-#endif
#define HAVE_REPLICATION
#define HAVE_EXTERNAL_CLIENT
#endif /* EMBEDDED_LIBRARY */
diff --git a/include/my_md5.h b/include/my_md5.h
index 77557fb9346..141ea309cae 100644
--- a/include/my_md5.h
+++ b/include/my_md5.h
@@ -28,7 +28,7 @@
extern "C" {
#endif
-void compute_md5_hash(char *digest, const char *buf, int len);
+#define compute_md5_hash(A,B,C) my_md5(A,B,C)
/*
Convert an array of bytes to a hexadecimal representation.
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index ceb6ac93ff5..499f3589145 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID;
#define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104
/* MariaDB plugin interface version */
-#define MARIA_PLUGIN_INTERFACE_VERSION 0x0108
+#define MARIA_PLUGIN_INTERFACE_VERSION 0x010a
/*
The allowable types of plugins
@@ -186,7 +186,7 @@ struct st_mysql_show_var {
enum enum_mysql_show_type type;
};
-#define SHOW_VAR_FUNC_BUFF_SIZE 1024
+#define SHOW_VAR_FUNC_BUFF_SIZE (256 * sizeof(void*))
typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *);
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp
index 98fd089570d..ce456806fb8 100644
--- a/include/mysql/plugin_audit.h.pp
+++ b/include/mysql/plugin_audit.h.pp
@@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+#include <mysql/service_md5.h>
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp
index 6d52c5be7f0..fefbb06ab8c 100644
--- a/include/mysql/plugin_auth.h.pp
+++ b/include/mysql/plugin_auth.h.pp
@@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+#include <mysql/service_md5.h>
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp
index cb3e7cafc97..0d28f6a00ff 100644
--- a/include/mysql/plugin_ftparser.h.pp
+++ b/include/mysql/plugin_ftparser.h.pp
@@ -112,9 +112,32 @@ void thd_gmt_sec_to_TIME(void* thd, MYSQL_TIME *ltime, my_time_t t);
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
} *my_sha1_service;
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
+#include <mysql/service_md5.h>
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
#include <mysql/service_logger.h>
typedef struct logger_handle_st LOGGER_HANDLE;
extern struct logger_service_st {
diff --git a/include/mysql/service_logger.h b/include/mysql/service_logger.h
index 962ab2fbc0b..d14b28da712 100644
--- a/include/mysql/service_logger.h
+++ b/include/mysql/service_logger.h
@@ -71,7 +71,7 @@ extern struct logger_service_st {
int (*rotate)(LOGGER_HANDLE *log);
} *logger_service;
-#if MYSQL_DYNAMIC_PLUGIN
+#ifdef MYSQL_DYNAMIC_PLUGIN
#define logger_init_mutexes logger_service->logger_init_mutexes
#define logger_open(path, size_limit, rotations) \
diff --git a/include/mysql/service_md5.h b/include/mysql/service_md5.h
new file mode 100644
index 00000000000..5e589e57415
--- /dev/null
+++ b/include/mysql/service_md5.h
@@ -0,0 +1,69 @@
+#ifndef MYSQL_SERVICE_MD5_INCLUDED
+/* Copyright (c) 2014, 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 */
+
+/**
+ @file
+ my md5 service
+
+ Functions to calculate MD5 hash from a memory buffer
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef MYSQL_ABI_CHECK
+#include <stdlib.h>
+#endif
+
+#define MY_MD5_HASH_SIZE 16 /* Hash size in bytes */
+
+extern struct my_md5_service_st {
+ void (*my_md5_type)(unsigned char*, const char*, size_t);
+ void (*my_md5_multi_type)(unsigned char*, ...);
+ size_t (*my_md5_context_size_type)();
+ void (*my_md5_init_type)(void *);
+ void (*my_md5_input_type)(void *, const unsigned char *, size_t);
+ void (*my_md5_result_type)(void *, unsigned char *);
+} *my_md5_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+
+#define my_md5(A,B,C) my_md5_service->my_md5_type(A,B,C)
+#define my_md5_multi my_md5_service->my_md5_multi_type
+#define my_md5_context_size() my_md5_service->my_md5_context_size_type()
+#define my_md5_init(A) my_md5_service->my_md5_init_type(A)
+#define my_md5_input(A,B,C) my_md5_service->my_md5_input_type(A,B,C)
+#define my_md5_result(A,B) my_md5_service->my_md5_result_type(A,B)
+
+#else
+
+void my_md5(unsigned char*, const char*, size_t);
+void my_md5_multi(unsigned char*, ...);
+size_t my_md5_context_size();
+void my_md5_init(void *context);
+void my_md5_input(void *context, const unsigned char *buf, size_t len);
+void my_md5_result(void *context, unsigned char *digest);
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_MD5_INCLUDED
+#endif
+
diff --git a/include/mysql/service_sha1.h b/include/mysql/service_sha1.h
index 01f5ba81566..609e173e8ce 100644
--- a/include/mysql/service_sha1.h
+++ b/include/mysql/service_sha1.h
@@ -1,5 +1,5 @@
#ifndef MYSQL_SERVICE_SHA1_INCLUDED
-/* Copyright (c) 2013, Monty Program Ab
+/* Copyright (c) 2013, 2014, 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
@@ -34,17 +34,29 @@ extern "C" {
extern struct my_sha1_service_st {
void (*my_sha1_type)(unsigned char*, const char*, size_t);
void (*my_sha1_multi_type)(unsigned char*, ...);
+ size_t (*my_sha1_context_size_type)();
+ void (*my_sha1_init_type)(void *);
+ void (*my_sha1_input_type)(void *, const unsigned char *, size_t);
+ void (*my_sha1_result_type)(void *, unsigned char *);
} *my_sha1_service;
#ifdef MYSQL_DYNAMIC_PLUGIN
#define my_sha1(A,B,C) my_sha1_service->my_sha1_type(A,B,C)
#define my_sha1_multi my_sha1_service->my_sha1_multi_type
+#define my_sha1_context_size_type() my_sha1_service->my_sha1_context_size_type()
+#define my_sha1_init_type(A) my_sha1_service->my_sha1_init_type(A)
+#define my_sha1_input_type(A,B,C) my_sha1_service->my_sha1_input_type(A,B,C)
+#define my_sha1_result_type(A,B) my_sha1_service->my_sha1_result_type(A,B)
#else
void my_sha1(unsigned char*, const char*, size_t);
void my_sha1_multi(unsigned char*, ...);
+size_t my_sha1_context_size();
+void my_sha1_init(void *context);
+void my_sha1_input(void *context, const unsigned char *buf, size_t len);
+void my_sha1_result(void *context, unsigned char *digest);
#endif
diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
new file mode 100644
index 00000000000..11872469cc7
--- /dev/null
+++ b/include/mysql/service_wsrep.h
@@ -0,0 +1,205 @@
+#ifndef MYSQL_SERVICE_WSREP_INCLUDED
+/* 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 */
+
+/**
+ @file
+ wsrep service
+
+ Interface to WSREP functionality in the server.
+ For engines that want to support galera.
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum wsrep_conflict_state {
+ NO_CONFLICT,
+ MUST_ABORT,
+ ABORTING,
+ ABORTED,
+ MUST_REPLAY,
+ REPLAYING,
+ RETRY_AUTOCOMMIT,
+ CERT_FAILURE,
+};
+
+enum wsrep_exec_mode {
+ LOCAL_STATE,
+ REPL_RECV,
+ TOTAL_ORDER,
+ LOCAL_COMMIT
+};
+
+enum wsrep_query_state {
+ QUERY_IDLE,
+ QUERY_EXEC,
+ QUERY_COMMITTING,
+ QUERY_EXITING,
+ QUERY_ROLLINGBACK,
+};
+
+enum wsrep_trx_status {
+ WSREP_TRX_OK,
+ WSREP_TRX_CERT_FAIL, /* certification failure, must abort */
+ WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */
+ WSREP_TRX_ERROR, /* native mysql error */
+};
+
+struct xid_t;
+struct wsrep;
+struct wsrep_ws_handle;
+struct wsrep_buf;
+
+extern struct wsrep_service_st {
+ struct wsrep * (*get_wsrep_func)();
+ my_bool (*get_wsrep_certify_nonPK_func)();
+ my_bool (*get_wsrep_debug_func)();
+ my_bool (*get_wsrep_drupal_282555_workaround_func)();
+ my_bool (*get_wsrep_load_data_splitting_func)();
+ my_bool (*get_wsrep_log_conflicts_func)();
+ long (*get_wsrep_protocol_version_func)();
+ my_bool (*wsrep_aborting_thd_contains_func)(THD *thd);
+ void (*wsrep_aborting_thd_enqueue_func)(THD *thd);
+ bool (*wsrep_consistency_check_func)(THD *thd);
+ int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid);
+ void (*wsrep_lock_rollback_func)();
+ int (*wsrep_on_func)(MYSQL_THD);
+ void (*wsrep_post_commit_func)(THD* thd, bool all);
+ bool (*wsrep_prepare_key_func)(const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*);
+ enum wsrep_trx_status (*wsrep_run_wsrep_commit_func)(THD *thd, handlerton *hton, bool all);
+ void (*wsrep_thd_LOCK_func)(THD *thd);
+ void (*wsrep_thd_UNLOCK_func)(THD *thd);
+ void (*wsrep_thd_awake_func)(THD *thd, my_bool signal);
+ enum wsrep_conflict_state (*wsrep_thd_conflict_state_func)(MYSQL_THD, my_bool);
+ const char * (*wsrep_thd_conflict_state_str_func)(THD *thd);
+ enum wsrep_exec_mode (*wsrep_thd_exec_mode_func)(THD *thd);
+ const char * (*wsrep_thd_exec_mode_str_func)(THD *thd);
+ enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD);
+ my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool);
+ my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd);
+ char * (*wsrep_thd_query_func)(THD *thd);
+ enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd);
+ const char * (*wsrep_thd_query_state_str_func)(THD *thd);
+ int (*wsrep_thd_retry_counter_func)(THD *thd);
+ void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state);
+ long long (*wsrep_thd_trx_seqno_func)(THD *thd);
+ struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
+ int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
+ int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD);
+ void (*wsrep_unlock_rollback_func)();
+} *wsrep_service;
+
+#ifdef MYSQL_DYNAMIC_PLUGIN
+#define get_wsrep() wsrep_service->get_wsrep_func()
+#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func()
+#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func()
+#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func()
+#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func()
+#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func()
+#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func()
+#define wsrep_aborting_thd_contains(T) wsrep_service->wsrep_aborting_thd_contains_func(T)
+#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T)
+#define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T)
+#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X)
+#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func()
+#define wsrep_on(X) wsrep_service->wsrep_on_func(X)
+#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A)
+#define wsrep_prepare_key(A,B,C,D,E,F) wsrep_service->wsrep_prepare_key_func(A,B,C,D,E,F)
+#define wsrep_run_wsrep_commit(T,H,A) wsrep_service->wsrep_run_wsrep_commit_func(T,H,A)
+#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
+#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
+#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S)
+#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S)
+#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T)
+#define wsrep_thd_exec_mode(T) wsrep_service->wsrep_thd_exec_mode_func(T)
+#define wsrep_thd_exec_mode_str(T) wsrep_service->wsrep_thd_exec_mode_str_func(T)
+#define wsrep_thd_get_conflict_state(T) wsrep_service->wsrep_thd_get_conflict_state_func(T)
+#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S)
+#define wsrep_thd_is_wsrep(T) wsrep_service->wsrep_thd_is_wsrep_func(T)
+#define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T)
+#define wsrep_thd_query_state(T) wsrep_service->wsrep_thd_query_state_func(T)
+#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T)
+#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
+#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S)
+#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
+#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
+#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
+#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2)
+#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func()
+
+#define wsrep_debug get_wsrep_debug()
+#define wsrep_log_conflicts get_wsrep_log_conflicts()
+#define wsrep_certify_nonPK get_wsrep_certify_nonPK()
+#define wsrep_load_data_splitting get_wsrep_load_data_splitting()
+#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround()
+#define wsrep_protocol_version get_wsrep_protocol_version()
+
+#else
+
+extern my_bool wsrep_debug;
+extern my_bool wsrep_log_conflicts;
+extern my_bool wsrep_certify_nonPK;
+extern my_bool wsrep_load_data_splitting;
+extern my_bool wsrep_drupal_282555_workaround;
+extern long wsrep_protocol_version;
+
+bool wsrep_consistency_check(THD *thd);
+bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len);
+char *wsrep_thd_query(THD *thd);
+const char *wsrep_thd_conflict_state_str(THD *thd);
+const char *wsrep_thd_exec_mode_str(THD *thd);
+const char *wsrep_thd_query_state_str(THD *thd);
+enum wsrep_conflict_state wsrep_thd_conflict_state(MYSQL_THD thd, my_bool sync);
+enum wsrep_conflict_state wsrep_thd_get_conflict_state(MYSQL_THD thd);
+enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd);
+enum wsrep_query_state wsrep_thd_query_state(THD *thd);
+enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, handlerton *hton, bool all);
+int wsrep_is_wsrep_xid(const struct xid_t* xid);
+int wsrep_on(MYSQL_THD thd);
+int wsrep_thd_retry_counter(THD *thd);
+int wsrep_trx_is_aborting(MYSQL_THD thd);
+int wsrep_trx_order_before(MYSQL_THD thd1, MYSQL_THD thd2);
+long get_wsrep_protocol_version();
+long long wsrep_thd_trx_seqno(THD *thd);
+my_bool get_wsrep_certify_nonPK();
+my_bool get_wsrep_debug();
+my_bool get_wsrep_drupal_282555_workaround();
+my_bool get_wsrep_load_data_splitting();
+my_bool get_wsrep_log_conflicts();
+my_bool wsrep_aborting_thd_contains(THD *thd);
+my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync);
+my_bool wsrep_thd_is_wsrep(MYSQL_THD thd);
+struct wsrep *get_wsrep();
+struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd);
+void wsrep_aborting_thd_enqueue(THD *thd);
+void wsrep_lock_rollback();
+void wsrep_post_commit(THD* thd, bool all);
+void wsrep_thd_LOCK(THD *thd);
+void wsrep_thd_UNLOCK(THD *thd);
+void wsrep_thd_awake(THD *thd, my_bool signal);
+void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
+void wsrep_unlock_rollback();
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define MYSQL_SERVICE_WSREP_INCLUDED
+#endif
+
diff --git a/include/mysql/services.h b/include/mysql/services.h
index 62cac338703..4ff30fdd1bb 100644
--- a/include/mysql/services.h
+++ b/include/mysql/services.h
@@ -27,9 +27,11 @@ extern "C" {
#include <mysql/service_kill_statement.h>
#include <mysql/service_thd_timezone.h>
#include <mysql/service_sha1.h>
+#include <mysql/service_md5.h>
#include <mysql/service_logger.h>
#include <mysql/service_thd_autoinc.h>
#include <mysql/service_thd_error_context.h>
+/*#include <mysql/service_wsrep.h>*/
#ifdef __cplusplus
}
diff --git a/include/mysql_com.h b/include/mysql_com.h
index f1e32003791..3a794b36c1e 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -186,11 +186,7 @@ enum enum_server_command
#define REFRESH_USER_RESOURCES (1ULL << 19)
#define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */
-#define REFRESH_TABLE_STATS (1ULL << 27) /* Refresh table stats hash table */
-#define REFRESH_INDEX_STATS (1ULL << 28) /* Refresh index stats hash table */
-#define REFRESH_USER_STATS (1ULL << 29) /* Refresh user stats hash table */
-#define REFRESH_CLIENT_STATS (1ULL << 30) /* Refresh client stats hash table */
-
+#define REFRESH_GENERIC (1ULL << 30)
#define REFRESH_FAST (1ULL << 31) /* Intern flag */
#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
diff --git a/include/mysqld_default_groups.h b/include/mysqld_default_groups.h
index a2e94ddd854..3bc82359787 100644
--- a/include/mysqld_default_groups.h
+++ b/include/mysqld_default_groups.h
@@ -1,8 +1,8 @@
const char *load_default_groups[]= {
-#ifdef WITH_NDBCLUSTER_STORAGE_ENGINE
-"mysql_cluster",
-#endif
"mysqld", "server", MYSQL_BASE_VERSION,
"mariadb", MARIADB_BASE_VERSION,
"client-server",
+#ifdef WITH_WSREP
+"galera",
+#endif
0, 0};
diff --git a/include/service_versions.h b/include/service_versions.h
index cca190b811c..da3a7edc012 100644
--- a/include/service_versions.h
+++ b/include/service_versions.h
@@ -28,7 +28,9 @@
#define VERSION_thd_wait 0x0100
#define VERSION_progress_report 0x0100
#define VERSION_thd_timezone 0x0100
-#define VERSION_my_sha1 0x0100
+#define VERSION_my_sha1 0x0101
+#define VERSION_my_md5 0x0100
+#define VERSION_wsrep 0x0100
#define VERSION_logger 0x0100
#define VERSION_thd_autoinc 0x0100
#define VERSION_thd_error_context 0x0100
diff --git a/include/thr_lock.h b/include/thr_lock.h
index 3f7a5ca988f..2561709285f 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -20,7 +20,6 @@
#ifdef __cplusplus
extern "C" {
#endif
-
#include <my_pthread.h>
#include <my_list.h>
@@ -95,6 +94,7 @@ typedef struct st_thr_lock_info
{
pthread_t thread;
my_thread_id thread_id;
+ void *mysql_thd; // THD pointer
} THR_LOCK_INFO;
@@ -164,6 +164,17 @@ my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data,
ulong lock_wait_timeout);
void thr_set_lock_wait_callback(void (*before_wait)(void),
void (*after_wait)(void));
+
+#ifdef WITH_WSREP
+#include <my_sys.h>
+ typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool);
+ typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool);
+ typedef int (* wsrep_on_fun)(void *);
+ void wsrep_thr_lock_init(
+ wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun,
+ my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/include/thr_timer.h b/include/thr_timer.h
new file mode 100644
index 00000000000..724fdac41c8
--- /dev/null
+++ b/include/thr_timer.h
@@ -0,0 +1,45 @@
+/* Copyright (c) 2014 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 or later 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 */
+
+/* Prototypes when using thr_timer functions */
+
+#ifndef THR_TIMER_INCLUDED
+#define THR_TIMER_INCLUDED
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct st_timer {
+ struct timespec expire_time;
+ my_bool expired;
+ uint index_in_queue;
+ void (*func)(void*);
+ void *func_arg;
+} thr_timer_t;
+
+/* Main functions for library */
+my_bool init_thr_timer(uint init_size_for_timer_queue);
+void end_thr_timer();
+
+/* Functions for handling one timer */
+void thr_timer_init(thr_timer_t *timer_data, void(*function)(void*),
+ void *arg);
+my_bool thr_timer_settime(thr_timer_t *timer_data, ulonglong microseconds);
+void thr_timer_end(thr_timer_t *timer_data);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* THR_TIMER_INCLUDED */
diff --git a/include/wsrep.h b/include/wsrep.h
new file mode 100644
index 00000000000..a91f312d0a6
--- /dev/null
+++ b/include/wsrep.h
@@ -0,0 +1,51 @@
+/* Copyright 2014 Codership Oy <http://www.codership.com> & SkySQL 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 */
+
+#include <my_config.h>
+
+#ifndef WSREP_INCLUDED
+#define WSREP_INCLUDED
+
+#ifdef WITH_WSREP
+#define IF_WSREP(A,B) A
+#define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A)
+
+#define WSREP_MYSQL_DB (char *)"mysql"
+#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
+ if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
+ goto error;
+
+#define WSREP_TO_ISOLATION_END \
+ if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
+ wsrep_to_isolation_end(thd);
+
+#define WSREP_DEBUG(...) \
+ if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
+#define WSREP_INFO(...) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
+#define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__)
+#define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__)
+
+#else
+#define IF_WSREP(A,B) B
+#define DBUG_ASSERT_IF_WSREP(A)
+#define WSREP_DEBUG(...)
+#define WSREP_INFO(...)
+#define WSREP_WARN(...)
+#define WSREP_ERROR(...)
+#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_)
+#define WSREP_TO_ISOLATION_END
+#endif
+
+#endif /* WSERP_INCLUDED */