summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@mariadb.com>2017-02-22 18:25:17 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2017-02-23 11:57:27 +0530
commitba92f6ceb2eec0bd2952e7b65bae4a44bfa2745b (patch)
treeaa268897b0c1231d77022b07198954665031722b
parentec9a48112b3caac39fb133d524f499172942d43a (diff)
downloadmariadb-git-bb-5.5-mdev-12109.tar.gz
Mdev-12109 Merge 5.5.55 to 5.5-galerabb-5.5-mdev-12109
Merged https://github.com/codership/mysql-wsrep/tree/5.5 up to commit 03c22517c87.
-rw-r--r--cmake/wsrep.cmake4
-rw-r--r--sql/sql_class.cc4
-rw-r--r--sql/wsrep_mysqld.cc9
-rw-r--r--sql/wsrep_mysqld.h1
-rw-r--r--sql/wsrep_var.cc5
-rw-r--r--storage/innobase/handler/ha_innodb.h4
-rw-r--r--storage/innobase/include/trx0sys.h2
-rw-r--r--storage/innobase/trx/trx0sys.c2
-rw-r--r--storage/xtradb/handler/ha_innodb.h4
-rw-r--r--storage/xtradb/include/trx0sys.h2
-rw-r--r--storage/xtradb/trx/trx0sys.c2
-rw-r--r--wsrep/wsrep_dummy.c3
-rw-r--r--wsrep/wsrep_loader.c40
13 files changed, 54 insertions, 28 deletions
diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake
index 6d92537e40f..a16e1c5cfc5 100644
--- a/cmake/wsrep.cmake
+++ b/cmake/wsrep.cmake
@@ -18,12 +18,12 @@
# so WSREP_VERSION is produced regardless
# Set the patch version
-SET(WSREP_PATCH_VERSION "14")
+SET(WSREP_PATCH_VERSION "20")
# MariaDB addition: Revision number of the last revision merged from
# codership branch visible in @@visible_comment.
# Branch : https://github.com/codership/mysql-wsrep/tree/5.5
-SET(WSREP_PATCH_REVNO "9949137") # Should be updated on every merge.
+SET(WSREP_PATCH_REVNO "03c2251") # Should be updated on every merge.
# MariaDB: Obtain patch revision number:
# Update WSREP_PATCH_REVNO if WSREP_REV environment variable is set.
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 7905daa235d..fd2dec5a146 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -853,11 +853,11 @@ extern "C" wsrep_ws_handle_t* wsrep_thd_ws_handle(THD *thd)
return &thd->wsrep_ws_handle;
}
-extern "C"void wsrep_thd_LOCK(THD *thd)
+extern "C" void wsrep_thd_LOCK(THD *thd)
{
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
}
-extern "C"void wsrep_thd_UNLOCK(THD *thd)
+extern "C" void wsrep_thd_UNLOCK(THD *thd)
{
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 21c7e94096d..a045155a226 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -83,11 +83,7 @@ my_bool wsrep_creating_startup_threads = 0;
*/
my_bool wsrep_inited = 0; // initialized ?
-static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
-const wsrep_uuid_t* wsrep_cluster_uuid()
-{
- return &cluster_uuid;
-}
+static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED;
static char cluster_uuid_str[40]= { 0, };
static const char* cluster_status_str[WSREP_VIEW_MAX] =
{
@@ -249,8 +245,7 @@ wsrep_view_handler_cb (void* app_ctx,
if (memcmp(&cluster_uuid, &view->state_id.uuid, sizeof(wsrep_uuid_t)))
{
- memcpy((wsrep_uuid_t*)&cluster_uuid, &view->state_id.uuid,
- sizeof(cluster_uuid));
+ memcpy(&cluster_uuid, &view->state_id.uuid, sizeof(cluster_uuid));
wsrep_uuid_print (&cluster_uuid, cluster_uuid_str,
sizeof(cluster_uuid_str));
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index 85d4cea241f..bd45399a948 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -314,7 +314,6 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len);
int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len);
-const wsrep_uuid_t* wsrep_cluster_uuid();
struct xid_t;
void wsrep_set_SE_checkpoint(xid_t*);
void wsrep_get_SE_checkpoint(wsrep_uuid_t&, wsrep_seqno_t&);
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index 66b33e7697c..6385fa926a2 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -185,9 +185,8 @@ static bool refresh_provider_options()
char* opts= wsrep->options_get(wsrep);
if (opts)
{
- if (wsrep_provider_options) my_free((void *)wsrep_provider_options);
- wsrep_provider_options = (char*)my_memdup(opts, strlen(opts) + 1,
- MYF(MY_WME));
+ wsrep_provider_options_init(opts);
+ free(opts);
}
else
{
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index 8034f4dd535..f9b6d6ff582 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -319,8 +319,8 @@ extern "C" void wsrep_thd_set_conflict_state(
extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id);
-extern "C"void wsrep_thd_LOCK(THD *thd);
-extern "C"void wsrep_thd_UNLOCK(THD *thd);
+extern "C" void wsrep_thd_LOCK(THD *thd);
+extern "C" void wsrep_thd_UNLOCK(THD *thd);
extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd);
extern "C" time_t wsrep_thd_query_start(THD *thd);
extern "C" my_thread_id wsrep_thd_thread_id(THD *thd);
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index b8f1973d9c5..18863599329 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -322,12 +322,14 @@ trx_sys_print_mysql_binlog_offset(void);
/*===================================*/
#ifdef WITH_WSREP
/** Update WSREP checkpoint XID in sys header. */
+UNIV_INTERN
void
trx_sys_update_wsrep_checkpoint(
const XID* xid, /*!< in: WSREP XID */
trx_sysf_t* sys_header, /*!< in: sys_header */
mtr_t* mtr); /*!< in: mtr */
+UNIV_INTERN
void
/** Read WSREP checkpoint XID from sys header. */
trx_sys_read_wsrep_checkpoint(
diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c
index a0fcc2b2370..f4ed84db6ea 100644
--- a/storage/innobase/trx/trx0sys.c
+++ b/storage/innobase/trx/trx0sys.c
@@ -819,6 +819,7 @@ void read_wsrep_xid_uuid(const XID* xid, unsigned char* buf)
#endif /* UNIV_DEBUG */
+UNIV_INTERN
void
trx_sys_update_wsrep_checkpoint(
const XID* xid, /*!< in: transaction XID */
@@ -876,6 +877,7 @@ trx_sys_update_wsrep_checkpoint(
}
+UNIV_INTERN
void
trx_sys_read_wsrep_checkpoint(XID* xid)
/*===================================*/
diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h
index 521a9f2664c..69a28905f22 100644
--- a/storage/xtradb/handler/ha_innodb.h
+++ b/storage/xtradb/handler/ha_innodb.h
@@ -398,8 +398,8 @@ extern "C" void wsrep_thd_set_conflict_state(
extern "C" void wsrep_thd_set_trx_to_replay(THD *thd, uint64 trx_id);
-extern "C"void wsrep_thd_LOCK(THD *thd);
-extern "C"void wsrep_thd_UNLOCK(THD *thd);
+extern "C" void wsrep_thd_LOCK(THD *thd);
+extern "C" void wsrep_thd_UNLOCK(THD *thd);
extern "C" uint32 wsrep_thd_wsrep_rand(THD *thd);
extern "C" time_t wsrep_thd_query_start(THD *thd);
extern "C" my_thread_id wsrep_thd_thread_id(THD *thd);
diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h
index 69457a4c9b1..81a18972722 100644
--- a/storage/xtradb/include/trx0sys.h
+++ b/storage/xtradb/include/trx0sys.h
@@ -357,12 +357,14 @@ trx_sys_print_mysql_binlog_offset(void);
/*===================================*/
#ifdef WITH_WSREP
/** Update WSREP checkpoint XID in sys header. */
+UNIV_INTERN
void
trx_sys_update_wsrep_checkpoint(
const XID* xid, /*!< in: WSREP XID */
trx_sysf_t* sys_header, /*!< in: sys_header */
mtr_t* mtr); /*!< in: mtr */
+UNIV_INTERN
void
/** Read WSREP checkpoint XID from sys header. */
trx_sys_read_wsrep_checkpoint(
diff --git a/storage/xtradb/trx/trx0sys.c b/storage/xtradb/trx/trx0sys.c
index 7d9397b8e2c..66769ad56e1 100644
--- a/storage/xtradb/trx/trx0sys.c
+++ b/storage/xtradb/trx/trx0sys.c
@@ -984,6 +984,7 @@ void read_wsrep_xid_uuid(const XID* xid, unsigned char* buf)
#endif /* UNIV_DEBUG */
+UNIV_INTERN
void
trx_sys_update_wsrep_checkpoint(
const XID* xid, /*!< in: transaction XID */
@@ -1041,6 +1042,7 @@ trx_sys_update_wsrep_checkpoint(
}
+UNIV_INTERN
void
trx_sys_read_wsrep_checkpoint(XID* xid)
/*===================================*/
diff --git a/wsrep/wsrep_dummy.c b/wsrep/wsrep_dummy.c
index bab5329dc02..7c3e3d7f9e2 100644
--- a/wsrep/wsrep_dummy.c
+++ b/wsrep/wsrep_dummy.c
@@ -86,7 +86,8 @@ static wsrep_status_t dummy_options_set(
static char* dummy_options_get (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
- return WSREP_DUMMY(w)->options;
+ char * opt= WSREP_DUMMY(w)->options;
+ return opt ? strdup(opt) : NULL;
}
static wsrep_status_t dummy_connect(
diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c
index 0825d7e9ecf..96998a79091 100644
--- a/wsrep/wsrep_loader.c
+++ b/wsrep/wsrep_loader.c
@@ -37,6 +37,22 @@ static wsrep_log_cb_t logger = default_logger;
* Library loader
**************************************************************************/
+static int wsrep_check_iface_version(const char* found, const char* iface_ver)
+{
+ const size_t msg_len = 128;
+ char msg[128];
+
+ if (strcmp(found, iface_ver)) {
+ snprintf (msg, msg_len,
+ "provider interface version mismatch: need '%s', found '%s'",
+ iface_ver, found);
+ logger (WSREP_LOG_ERROR, msg);
+ return EINVAL;
+ }
+
+ return 0;
+}
+
static int verify(const wsrep_t *wh, const char *iface_ver)
{
char msg[128];
@@ -49,14 +65,8 @@ static int verify(const wsrep_t *wh, const char *iface_ver)
VERIFY(wh);
VERIFY(wh->version);
-
- if (strcmp(wh->version, iface_ver)) {
- snprintf (msg, sizeof(msg),
- "provider interface version mismatch: need '%s', found '%s'",
- iface_ver, wh->version);
- logger (WSREP_LOG_ERROR, msg);
- return EINVAL;
- }
+ if (wsrep_check_iface_version(wh->version, iface_ver))
+ return EINVAL;
VERIFY(wh->init);
VERIFY(wh->options_set);
@@ -107,6 +117,15 @@ static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym)
return alias.dlfun;
}
+static int wsrep_check_version_symbol(void *dlh)
+{
+ char** dlversion = NULL;
+ dlversion = (char**) dlsym(dlh, "wsrep_interface_version");
+ if (dlversion == NULL)
+ return 0;
+ return wsrep_check_iface_version(*dlversion, WSREP_INTERFACE_VERSION);
+}
+
extern int wsrep_dummy_loader(wsrep_t *w);
int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
@@ -151,6 +170,11 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
goto out;
}
+ if (wsrep_check_version_symbol(dlh) != 0) {
+ ret = EINVAL;
+ goto out;
+ }
+
if ((ret = (*dlfun)(*hptr)) != 0) {
snprintf(msg, sizeof(msg), "wsrep_load(): loader failed: %s",
strerror(ret));