summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2015-03-05 14:14:00 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2015-03-05 14:14:00 -0500
commit9af42db6138a555454b7631761b81f8d259f014e (patch)
treeff1ff849521a70cd25251e661d1eb8ee960e587f /sql
parent73a143ab34be0007cc0fc17cf5fda00fef063c1c (diff)
downloadmariadb-git-9af42db6138a555454b7631761b81f8d259f014e.tar.gz
MDEV-7192: binlog_annotate_row_events not completely compatible with galera
Annotate_rows event needs to be preserved until the last Rows event has been applied because after it has been applied thd->query points to the query stored inside this event.
Diffstat (limited to 'sql')
-rw-r--r--sql/wsrep_applier.cc8
-rw-r--r--sql/wsrep_thd.cc11
2 files changed, 13 insertions, 6 deletions
diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc
index 03d356aa046..6f1ead89158 100644
--- a/sql/wsrep_applier.cc
+++ b/sql/wsrep_applier.cc
@@ -92,6 +92,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
char *buf= (char *)events_buf;
int rcode= 0;
int event= 1;
+ Log_event_type typ;
DBUG_ENTER("wsrep_apply_events");
@@ -126,7 +127,9 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
goto error;
}
- switch (ev->get_type_code()) {
+ typ= ev->get_type_code();
+
+ switch (typ) {
case FORMAT_DESCRIPTION_EVENT:
wsrep_set_apply_format(thd, (Format_description_log_event*)ev);
continue;
@@ -160,7 +163,6 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
}
ev->thd = thd;
- //exec_res = ev->apply_event(thd->wsrep_rli);
exec_res = ev->apply_event(thd->wsrep_rgi);
DBUG_PRINT("info", ("exec_event result: %d", exec_res));
@@ -192,7 +194,7 @@ static wsrep_cb_status_t wsrep_apply_events(THD* thd,
DBUG_RETURN(WSREP_CB_FAILURE);
}
- delete ev;
+ delete_or_keep_event_post_apply(thd->wsrep_rgi, typ, ev);
}
error:
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index b01737d1d5c..81999d11296 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -121,10 +121,13 @@ static rpl_group_info* wsrep_relay_group_init(const char* log_fname)
*/
rli->mi = new Master_info(&connection_name, false);
- rli->sql_driver_thd= current_thd;
-
struct rpl_group_info *rgi= new rpl_group_info(rli);
- rgi->thd= current_thd;
+ rgi->thd= rli->sql_driver_thd= current_thd;
+
+ if ((rgi->deferred_events_collecting= rli->mi->rpl_filter->is_on()))
+ {
+ rgi->deferred_events= new Deferred_log_events(rli);
+ }
return rgi;
}
@@ -172,6 +175,8 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
delete thd->system_thread_info.rpl_sql_info;
delete thd->wsrep_rgi->rli->mi;
delete thd->wsrep_rgi->rli;
+
+ thd->wsrep_rgi->cleanup_after_session();
delete thd->wsrep_rgi;
thd->wsrep_rgi = NULL;
}