summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-21 11:37:10 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-21 11:37:10 +0200
commit5203bc10f1f545131d01c253163ba06b6218be2c (patch)
treebb28122ee8a279bd9ad9b0358ac131356a80a7e8 /sql
parent76cdc1d73ec0215c91725a8507da7bda416c52ec (diff)
parent9394cc89143e4fce3126a96ac1c8a91a66d71dea (diff)
downloadmariadb-git-5203bc10f1f545131d01c253163ba06b6218be2c.tar.gz
Merge 10.4 into 10.5
Diffstat (limited to 'sql')
-rw-r--r--sql/item_func.cc33
-rw-r--r--sql/log.cc31
-rw-r--r--sql/log.h1
-rw-r--r--sql/log_event_client.cc15
-rw-r--r--sql/mysqld.cc6
-rw-r--r--sql/rpl_gtid.cc4
-rw-r--r--sql/service_wsrep.cc1
-rw-r--r--sql/spatial.cc92
-rw-r--r--sql/spatial.h7
-rw-r--r--sql/sql_class.h6
-rw-r--r--sql/sql_type_geom.cc14
-rw-r--r--sql/sql_type_int.h20
-rw-r--r--sql/wsrep_binlog.cc36
-rw-r--r--sql/wsrep_binlog.h2
-rw-r--r--sql/wsrep_mysqld.h5
-rw-r--r--sql/wsrep_trans_observer.h23
16 files changed, 179 insertions, 117 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 57ef5d6adb9..b75bae596e8 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -1614,11 +1614,9 @@ longlong Item_func_int_div::val_int()
raise_integer_overflow();
return res;
}
-
- longlong val0=args[0]->val_int();
- longlong val1=args[1]->val_int();
- bool val0_negative, val1_negative, res_negative;
- ulonglong uval0, uval1, res;
+
+ Longlong_hybrid val0= args[0]->to_longlong_hybrid();
+ Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if ((null_value= (args[0]->null_value || args[1]->null_value)))
return 0;
if (val1 == 0)
@@ -1627,12 +1625,8 @@ longlong Item_func_int_div::val_int()
return 0;
}
- val0_negative= !args[0]->unsigned_flag && val0 < 0;
- val1_negative= !args[1]->unsigned_flag && val1 < 0;
- res_negative= val0_negative != val1_negative;
- uval0= (ulonglong) (val0_negative ? -val0 : val0);
- uval1= (ulonglong) (val1_negative ? -val1 : val1);
- res= uval0 / uval1;
+ bool res_negative= val0.neg() != val1.neg();
+ ulonglong res= val0.abs() / val1.abs();
if (res_negative)
{
if (res > (ulonglong) LONGLONG_MAX)
@@ -1657,11 +1651,8 @@ bool Item_func_int_div::fix_length_and_dec()
longlong Item_func_mod::int_op()
{
DBUG_ASSERT(fixed == 1);
- longlong val0= args[0]->val_int();
- longlong val1= args[1]->val_int();
- bool val0_negative, val1_negative;
- ulonglong uval0, uval1;
- ulonglong res;
+ Longlong_hybrid val0= args[0]->to_longlong_hybrid();
+ Longlong_hybrid val1= args[1]->to_longlong_hybrid();
if ((null_value= args[0]->null_value || args[1]->null_value))
return 0; /* purecov: inspected */
@@ -1676,13 +1667,9 @@ longlong Item_func_mod::int_op()
LONGLONG_MIN by -1 generates SIGFPE, we calculate using unsigned values and
then adjust the sign appropriately.
*/
- val0_negative= !args[0]->unsigned_flag && val0 < 0;
- val1_negative= !args[1]->unsigned_flag && val1 < 0;
- uval0= (ulonglong) (val0_negative ? -val0 : val0);
- uval1= (ulonglong) (val1_negative ? -val1 : val1);
- res= uval0 % uval1;
- return check_integer_overflow(val0_negative ? -(longlong) res : res,
- !val0_negative);
+ ulonglong res= val0.abs() % val1.abs();
+ return check_integer_overflow(val0.neg() ? -(longlong) res : res,
+ !val0.neg());
}
double Item_func_mod::real_op()
diff --git a/sql/log.cc b/sql/log.cc
index 3e7f3a043c3..647e5fbd60d 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -10815,7 +10815,6 @@ maria_declare_plugin(binlog)
maria_declare_plugin_end;
#ifdef WITH_WSREP
-#include "wsrep_trans_observer.h"
#include "wsrep_mysqld.h"
IO_CACHE *wsrep_get_trans_cache(THD * thd)
@@ -10838,33 +10837,33 @@ void wsrep_thd_binlog_trx_reset(THD * thd)
/*
todo: fix autocommit select to not call the caller
*/
- if (thd_get_ha_data(thd, binlog_hton) != NULL)
+ binlog_cache_mngr *const cache_mngr=
+ (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
+ if (cache_mngr)
{
- binlog_cache_mngr *const cache_mngr=
- (binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
- if (cache_mngr)
+ cache_mngr->reset(false, true);
+ if (!cache_mngr->stmt_cache.empty())
{
- cache_mngr->reset(false, true);
- if (!cache_mngr->stmt_cache.empty())
- {
- WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query());
- cache_mngr->stmt_cache.reset();
- }
+ WSREP_DEBUG("pending events in stmt cache, sql: %s", thd->query());
+ cache_mngr->stmt_cache.reset();
}
}
thd->clear_binlog_table_maps();
DBUG_VOID_RETURN;
}
-
-void thd_binlog_rollback_stmt(THD * thd)
+void wsrep_thd_binlog_stmt_rollback(THD * thd)
{
- WSREP_DEBUG("thd_binlog_rollback_stmt connection: %llu",
- thd->thread_id);
+ DBUG_ENTER("wsrep_thd_binlog_stmt_rollback");
+ WSREP_DEBUG("wsrep_thd_binlog_stmt_rollback");
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(thd, binlog_hton);
if (cache_mngr)
- cache_mngr->trx_cache.set_prev_position(MY_OFF_T_UNDEF);
+ {
+ thd->binlog_remove_pending_rows_event(TRUE, TRUE);
+ cache_mngr->stmt_cache.reset();
+ }
+ DBUG_VOID_RETURN;
}
bool wsrep_stmt_rollback_is_safe(THD* thd)
diff --git a/sql/log.h b/sql/log.h
index 41b25af0eaa..1071538fbfd 100644
--- a/sql/log.h
+++ b/sql/log.h
@@ -1223,6 +1223,7 @@ static inline TC_LOG *get_tc_log_implementation()
#ifdef WITH_WSREP
IO_CACHE* wsrep_get_trans_cache(THD *);
void wsrep_thd_binlog_trx_reset(THD * thd);
+void wsrep_thd_binlog_stmt_rollback(THD * thd);
#endif /* WITH_WSREP */
class Gtid_list_log_event;
diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc
index 7cb9c90eec6..faec2a29407 100644
--- a/sql/log_event_client.cc
+++ b/sql/log_event_client.cc
@@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
- Copyright (c) 2009, 2019, MariaDB
+ Copyright (c) 2009, 2020, MariaDB
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
@@ -1093,7 +1093,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
Table_map_log_event *map;
table_def *td;
DYNAMIC_ARRAY rows_arr;
- uchar *swap_buff1, *swap_buff2;
+ uchar *swap_buff1;
uchar *rows_pos= rows_buff + m_rows_before_size;
if (!(map= print_event_info->m_table_map.get_table(m_table_id)) ||
@@ -1142,7 +1142,7 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
}
value+= length2;
- swap_buff2= (uchar *) my_malloc(PSI_NOT_INSTRUMENTED, length2, MYF(0));
+ void *swap_buff2= my_malloc(PSI_NOT_INSTRUMENTED, length2, MYF(0));
if (!swap_buff2)
{
fprintf(stderr, "\nError: Out of memory. "
@@ -1150,21 +1150,14 @@ void Rows_log_event::change_to_flashback_event(PRINT_EVENT_INFO *print_event_inf
exit(1);
}
memcpy(swap_buff2, start_pos + length1, length2); // WHERE part
- }
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- {
/* Swap SET and WHERE part */
memcpy(start_pos, swap_buff2, length2);
memcpy(start_pos + length2, swap_buff1, length1);
+ my_free(swap_buff2);
}
- /* Free tmp buffers */
my_free(swap_buff1);
- if (ev_type == UPDATE_ROWS_EVENT ||
- ev_type == UPDATE_ROWS_EVENT_V1)
- my_free(swap_buff2);
/* Copying one row into a buff, and pushing into the array */
LEX_STRING one_row;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 8f1c11a6518..387482ef6f0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7515,9 +7515,9 @@ SHOW_VAR status_vars[]= {
{"Key", (char*) &show_default_keycache, SHOW_FUNC},
{"Last_query_cost", (char*) offsetof(STATUS_VAR, last_query_cost), SHOW_DOUBLE_STATUS},
{"Max_statement_time_exceeded", (char*) offsetof(STATUS_VAR, max_statement_time_exceeded), SHOW_LONG_STATUS},
- {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONGLONG_STATUS},
- {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONGLONG_STATUS},
- {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONGLONG_STATUS},
+ {"Master_gtid_wait_count", (char*) offsetof(STATUS_VAR, master_gtid_wait_count), SHOW_LONG_STATUS},
+ {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONG_STATUS},
+ {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONG_STATUS},
{"Max_used_connections", (char*) &max_used_connections, SHOW_LONG},
{"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC},
{"Memory_used_initial", (char*) &start_memory_used, SHOW_LONGLONG},
diff --git a/sql/rpl_gtid.cc b/sql/rpl_gtid.cc
index bc87441d183..e7ad4c02a19 100644
--- a/sql/rpl_gtid.cc
+++ b/sql/rpl_gtid.cc
@@ -1,4 +1,5 @@
/* Copyright (c) 2013, Kristian Nielsen and MariaDB Services Ab.
+ Copyright (c) 2020, MariaDB Corporation.
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
@@ -2565,7 +2566,8 @@ gtid_waiting::wait_for_pos(THD *thd, String *gtid_str, longlong timeout_us)
/* fall through */
case 0:
status_var_add(thd->status_var.master_gtid_wait_time,
- microsecond_interval_timer() - before);
+ static_cast<ulong>
+ (microsecond_interval_timer() - before));
}
my_free(wait_pos);
return err;
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
index 8a547710143..013ec65d3f5 100644
--- a/sql/service_wsrep.cc
+++ b/sql/service_wsrep.cc
@@ -167,6 +167,7 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
THD *victim_thd)
{
DBUG_ASSERT(victim_thd);
+ DBUG_ASSERT(wsrep_thd_is_SR(victim_thd));
if (!victim_thd || !wsrep_on(bf_thd)) return;
WSREP_DEBUG("handle rollback, for deadlock: thd %llu trx_id %" PRIu64 " frags %zu conf %s",
diff --git a/sql/spatial.cc b/sql/spatial.cc
index e3502dbac1a..301d50f5d1e 100644
--- a/sql/spatial.cc
+++ b/sql/spatial.cc
@@ -50,6 +50,98 @@ double my_double_round(double value, longlong dec, bool dec_unsigned,
#define MAX_DIGITS_IN_DOUBLE MY_GCVT_MAX_FIELD_WIDTH
+int MBR::within(const MBR *mbr)
+{
+ /*
+ We have to take into account the 'dimension' of
+ the MBR, where the dimension of a single point is 0,
+ the dimesion of an vertical or horizontal line is 1,
+ and finally the dimension of the solid rectangle is 2.
+ */
+
+ int dim1= dimension();
+ int dim2= mbr->dimension();
+
+ DBUG_ASSERT(dim1 >= 0 && dim1 <= 2 && dim2 >= 0 && dim2 <= 2);
+
+ /*
+ Either/both of the two operands can degrade to a point or a
+ horizontal/vertical line segment, and we have to treat such cases
+ separately.
+ */
+ switch (dim1)
+ {
+ case 0:
+ DBUG_ASSERT(xmin == xmax && ymin == ymax);
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return equals(mbr);
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin > mbr->xmin && xmin < mbr->xmax && ymin == mbr->ymin) ||
+ (ymin > mbr->ymin && ymin < mbr->ymax && xmin == mbr->xmin));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return (xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin > mbr->ymin && ymax < mbr->ymax);
+ break;
+ }
+ break;
+ case 1:
+ DBUG_ASSERT((xmin == xmax && ymin != ymax) ||
+ (ymin == ymax && xmin != xmax));
+ switch (dim2)
+ {
+ case 0:
+ DBUG_ASSERT(mbr->xmin == mbr->xmax && mbr->ymin == mbr->ymax);
+ return 0;
+ break;
+ case 1:
+ DBUG_ASSERT((mbr->xmin == mbr->xmax && mbr->ymin != mbr->ymax) ||
+ (mbr->ymin == mbr->ymax && mbr->xmin != mbr->xmax));
+ return ((xmin == xmax && mbr->xmin == mbr->xmax && mbr->xmin == xmin &&
+ mbr->ymin <= ymin && mbr->ymax >= ymax) ||
+ (ymin == ymax && mbr->ymin == mbr->ymax && mbr->ymin == ymin &&
+ mbr->xmin <= xmin && mbr->xmax >= xmax));
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((xmin == xmax && xmin > mbr->xmin && xmax < mbr->xmax &&
+ ymin >= mbr->ymin && ymax <= mbr->ymax) ||
+ (ymin == ymax && ymin > mbr->ymin && ymax < mbr->ymax &&
+ xmin >= mbr->xmin && xmax <= mbr->xmax));
+ break;
+ }
+ break;
+ case 2:
+ DBUG_ASSERT(xmin != xmax && ymin != ymax);
+ switch (dim2)
+ {
+ case 0:
+ case 1:
+ return 0;
+ break;
+ case 2:
+ DBUG_ASSERT(mbr->xmin != mbr->xmax && mbr->ymin != mbr->ymax);
+ return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
+ (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
+ break;
+
+ }
+ break;
+ }
+
+ // Never reached.
+ DBUG_ASSERT(false);
+ return 0;
+}
+
+
/***************************** Gis_class_info *******************************/
String Geometry::bad_geometry_data("Bad object", &my_charset_bin);
diff --git a/sql/spatial.h b/sql/spatial.h
index 7817fd041cd..0b998e2e55c 100644
--- a/sql/spatial.h
+++ b/sql/spatial.h
@@ -145,12 +145,7 @@ struct MBR
(mbr->xmax >= xmin && mbr->xmax <= xmax)));
}
- int within(const MBR *mbr)
- {
- /* The following should be safe, even if we compare doubles */
- return ((mbr->xmin <= xmin) && (mbr->ymin <= ymin) &&
- (mbr->xmax >= xmax) && (mbr->ymax >= ymax));
- }
+ int within(const MBR *mbr);
int contains(const MBR *mbr)
{
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 86e19b5029a..6d3a18259a0 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -913,9 +913,9 @@ typedef struct system_status_var
ulong feature_window_functions; /* +1 when window functions are used */
/* From MASTER_GTID_WAIT usage */
- ulonglong master_gtid_wait_timeouts; /* Number of timeouts */
- ulonglong master_gtid_wait_time; /* Time in microseconds */
- ulonglong master_gtid_wait_count;
+ ulong master_gtid_wait_timeouts; /* Number of timeouts */
+ ulong master_gtid_wait_time; /* Time in microseconds */
+ ulong master_gtid_wait_count;
ulong empty_queries;
ulong access_denied_errors;
diff --git a/sql/sql_type_geom.cc b/sql/sql_type_geom.cc
index 0dcde0009b0..c177eae2408 100644
--- a/sql/sql_type_geom.cc
+++ b/sql/sql_type_geom.cc
@@ -1,6 +1,5 @@
/*
- Copyright (c) 2015 MariaDB Foundation
- Copyright (c) 2019 MariaDB
+ Copyright (c) 2015, 2020, MariaDB
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
@@ -862,9 +861,18 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
if (!tab_name)
tab_name= "";
+ Geometry_buffer buffer;
+ Geometry *geom= NULL;
+ String wkt;
+ const char *dummy;
+ wkt.set_charset(&my_charset_latin1);
+ if (!(geom= Geometry::construct(&buffer, from, uint32(length))) ||
+ geom->as_wkt(&wkt, &dummy))
+ goto err;
+
my_error(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, MYF(0),
Geometry::ci_collection[m_type_handler->geometry_type()]->m_name.str,
- Geometry::ci_collection[wkb_type]->m_name.str,
+ wkt.c_ptr(),
db, tab_name, field_name.str,
(ulong) table->in_use->get_stmt_da()->
current_row_for_warning());
diff --git a/sql/sql_type_int.h b/sql/sql_type_int.h
index 054a861d190..d3e9d0318cf 100644
--- a/sql/sql_type_int.h
+++ b/sql/sql_type_int.h
@@ -109,6 +109,26 @@ public:
*/
return cmp_signed(other);
}
+ bool operator==(const Longlong_hybrid &nr) const
+ {
+ return cmp(nr) == 0;
+ }
+ bool operator==(ulonglong nr) const
+ {
+ return cmp(Longlong_hybrid((longlong) nr, true)) == 0;
+ }
+ bool operator==(uint nr) const
+ {
+ return cmp(Longlong_hybrid((longlong) nr, true)) == 0;
+ }
+ bool operator==(longlong nr) const
+ {
+ return cmp(Longlong_hybrid(nr, false)) == 0;
+ }
+ bool operator==(int nr) const
+ {
+ return cmp(Longlong_hybrid(nr, false)) == 0;
+ }
};
diff --git a/sql/wsrep_binlog.cc b/sql/wsrep_binlog.cc
index f555480d2e0..da899321ba8 100644
--- a/sql/wsrep_binlog.cc
+++ b/sql/wsrep_binlog.cc
@@ -228,40 +228,6 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len)
free(filename);
}
-/*
- wsrep exploits binlog's caches even if binlogging itself is not
- activated. In such case connection close needs calling
- actual binlog's method.
- Todo: split binlog hton from its caches to use ones by wsrep
- without referring to binlog's stuff.
-*/
-int wsrep_binlog_close_connection(THD* thd)
-{
- DBUG_ENTER("wsrep_binlog_close_connection");
- if (thd_get_ha_data(thd, binlog_hton) != NULL)
- binlog_hton->close_connection (binlog_hton, thd);
- DBUG_RETURN(0);
-}
-
-int wsrep_binlog_savepoint_set(THD *thd, void *sv)
-{
- if (!wsrep_emulate_bin_log) return 0;
- int rcode= binlog_hton->savepoint_set(binlog_hton, thd, sv);
- return rcode;
-}
-
-int wsrep_binlog_savepoint_rollback(THD *thd, void *sv)
-{
- if (!wsrep_emulate_bin_log) return 0;
- int rcode= binlog_hton->savepoint_rollback(binlog_hton, thd, sv);
- return rcode;
-}
-
-void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end)
-{
- thd->binlog_flush_pending_rows_event(stmt_end);
-}
-
/* Dump replication buffer along with header to a file. */
void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
size_t buf_len)
@@ -343,8 +309,6 @@ cleanup1:
DBUG_VOID_RETURN;
}
-#include "log_event.h"
-
int wsrep_write_skip_event(THD* thd)
{
DBUG_ENTER("wsrep_write_skip_event");
diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h
index 4e29b30baca..252fbe602d2 100644
--- a/sql/wsrep_binlog.h
+++ b/sql/wsrep_binlog.h
@@ -50,8 +50,6 @@ void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len);
void wsrep_dump_rbr_buf_with_header(THD *thd, const void *rbr_buf,
size_t buf_len);
-int wsrep_binlog_close_connection(THD* thd);
-
/**
Write a skip event into binlog.
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index b51dc308646..8ccab45700e 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -534,11 +534,6 @@ extern void
wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
MDL_ticket *ticket,
const MDL_key *key);
-IO_CACHE * get_trans_log(THD * thd);
-bool wsrep_trans_cache_is_empty(THD *thd);
-void thd_binlog_flush_pending_rows_event(THD *thd, bool stmt_end);
-void thd_binlog_rollback_stmt(THD * thd);
-void thd_binlog_trx_reset(THD * thd);
enum wsrep_thread_type {
WSREP_APPLIER_THREAD=1,
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index 5f68da684e5..cb58026207b 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -361,15 +361,22 @@ static inline int wsrep_before_rollback(THD* thd, bool all)
int ret= 0;
if (wsrep_is_active(thd))
{
- if (!all && thd->in_active_multi_stmt_transaction() &&
- thd->wsrep_trx().is_streaming() &&
- !wsrep_stmt_rollback_is_safe(thd))
+ if (!all && thd->in_active_multi_stmt_transaction())
{
- /* Non-safe statement rollback during SR multi statement
- transasction. Self abort the transaction, the actual rollback
- and error handling will be done in after statement phase. */
- wsrep_thd_self_abort(thd);
- ret= 0;
+ if (wsrep_emulate_bin_log)
+ {
+ wsrep_thd_binlog_stmt_rollback(thd);
+ }
+
+ if (thd->wsrep_trx().is_streaming() &&
+ !wsrep_stmt_rollback_is_safe(thd))
+ {
+ /* Non-safe statement rollback during SR multi statement
+ transasction. Self abort the transaction, the actual rollback
+ and error handling will be done in after statement phase. */
+ wsrep_thd_self_abort(thd);
+ ret= 0;
+ }
}
else if (wsrep_is_real(thd, all) &&
thd->wsrep_trx().state() != wsrep::transaction::s_aborted)