summaryrefslogtreecommitdiff
path: root/sql/wsrep_applier.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-03-27 20:35:37 -0400
committerNirbhay Choubey <nirbhay@mariadb.com>2015-03-27 20:35:37 -0400
commitd7445ea6dfbd3be390792c636f755d3bb40d5fbf (patch)
tree7ed61ce2f39cac0f4de0fa63925c1e44d9073104 /sql/wsrep_applier.cc
parent6a204546ef91aa90dedb6b47353bbb568f0531b0 (diff)
downloadmariadb-git-d7445ea6dfbd3be390792c636f755d3bb40d5fbf.tar.gz
MDEV-7194: galera fails to replicate DDL queries when using binlog_checksum
Restore fix for MDEV-4328 (revno: 3391) that got accidentally overwritten while merging : http://bazaar.launchpad.net/~codership/codership-mysql/5.5-23/revision/3900 Added a test case.
Diffstat (limited to 'sql/wsrep_applier.cc')
-rw-r--r--sql/wsrep_applier.cc28
1 files changed, 25 insertions, 3 deletions
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 03f544a4444..3736431cd30 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -17,7 +17,6 @@
#include "wsrep_binlog.h" // wsrep_dump_rbr_buf()
#include "log_event.h" // EVENT_LEN_OFFSET, etc.
-
#include "wsrep_applier.h"
/*
@@ -64,7 +63,25 @@ err:
#include "rpl_rli.h" // class Relay_log_info;
#include "sql_base.h" // close_temporary_table()
-extern const Format_description_log_event *wsrep_format_desc;
+static inline void
+wsrep_set_apply_format(THD* thd, Format_description_log_event* ev)
+{
+ if (thd->wsrep_apply_format)
+ {
+ delete (Format_description_log_event*)thd->wsrep_apply_format;
+ }
+ thd->wsrep_apply_format= ev;
+}
+
+static inline Format_description_log_event*
+wsrep_get_apply_format(THD* thd)
+{
+ if (thd->wsrep_apply_format)
+ {
+ return (Format_description_log_event*) thd->wsrep_apply_format;
+ }
+ return thd->wsrep_rli->relay_log.description_event_for_exec;
+}
static wsrep_cb_status_t wsrep_apply_events(THD* thd,
const void* events_buf,
@@ -98,7 +115,8 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
{
int exec_res;
int error = 0;
- Log_event* ev= wsrep_read_log_event(&buf, &buf_len, wsrep_format_desc);
+ Log_event* ev= wsrep_read_log_event(&buf, &buf_len,
+ wsrep_get_apply_format(thd));
if (!ev)
{
@@ -111,6 +129,9 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
typ= ev->get_type_code();
switch (typ) {
+ case FORMAT_DESCRIPTION_EVENT:
+ wsrep_set_apply_format(thd, (Format_description_log_event*)ev);
+ continue;
case WRITE_ROWS_EVENT:
case UPDATE_ROWS_EVENT:
case DELETE_ROWS_EVENT:
@@ -339,6 +360,7 @@ wsrep_cb_status_t wsrep_commit_cb(void* const ctx,
else
rcode = wsrep_rollback(thd, meta->gtid.seqno);
+ wsrep_set_apply_format(thd, NULL);
thd->mdl_context.release_transactional_locks();
free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC));
thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;