summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-05-19 20:15:00 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2021-12-23 11:51:31 +0200
commitca2ea4ff4178d097ac2d939b8fd88ea658ed64dc (patch)
treeba136aa5e1c2147f0bd868acc8ef141ebd63ee1a
parent4eec6b99e177a644650057f2c14d2f10ddd0ada4 (diff)
downloadmariadb-git-ca2ea4ff4178d097ac2d939b8fd88ea658ed64dc.tar.gz
Only apply wsrep_trx_fragment_size to InnoDB tables
MDEV-22617 Galera node crashes when trying to log to slow_log table in streaming replication mode Other things: - Changed name of wsrep_after_row(two arguments) to wsrep_after_row_internal(one argument) to not depended on the function signature with unused arguments. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com> Added test case
-rw-r--r--mysql-test/suite/galera_sr/r/galera_sr_slow.result13
-rw-r--r--mysql-test/suite/galera_sr/t/galera_sr_slow.test11
-rw-r--r--sql/handler.cc11
-rw-r--r--sql/wsrep_trans_observer.h2
4 files changed, 32 insertions, 5 deletions
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_slow.result b/mysql-test/suite/galera_sr/r/galera_sr_slow.result
new file mode 100644
index 00000000000..a03aac0d085
--- /dev/null
+++ b/mysql-test/suite/galera_sr/r/galera_sr_slow.result
@@ -0,0 +1,13 @@
+connection node_2;
+connection node_1;
+connection node_1;
+SET GLOBAL wsrep_trx_fragment_unit='bytes';
+SET GLOBAL wsrep_trx_fragment_size=10240000;
+SET GLOBAL slow_query_log=ON;
+SET GLOBAL log_output='TABLE';
+SELECT SLEEP(10);
+SLEEP(10)
+0
+SET GLOBAL wsrep_trx_fragment_unit=DEFAULT;
+SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
+SET GLOBAL log_output=DEFAULT;
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_slow.test b/mysql-test/suite/galera_sr/t/galera_sr_slow.test
new file mode 100644
index 00000000000..d98305102fc
--- /dev/null
+++ b/mysql-test/suite/galera_sr/t/galera_sr_slow.test
@@ -0,0 +1,11 @@
+--source include/galera_cluster.inc
+
+--connection node_1
+SET GLOBAL wsrep_trx_fragment_unit='bytes';
+SET GLOBAL wsrep_trx_fragment_size=10240000;
+SET GLOBAL slow_query_log=ON;
+SET GLOBAL log_output='TABLE';
+SELECT SLEEP(10);
+SET GLOBAL wsrep_trx_fragment_unit=DEFAULT;
+SET GLOBAL wsrep_trx_fragment_size=DEFAULT;
+SET GLOBAL log_output=DEFAULT;
diff --git a/sql/handler.cc b/sql/handler.cc
index 812de48fa68..82472bcadde 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -6579,7 +6579,7 @@ static int wsrep_after_row(THD *thd)
my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0));
DBUG_RETURN(ER_ERROR_DURING_COMMIT);
}
- else if (wsrep_after_row(thd, false))
+ else if (wsrep_after_row_internal(thd))
{
DBUG_RETURN(ER_LOCK_DEADLOCK);
}
@@ -6778,7 +6778,8 @@ int handler::ha_write_row(const uchar *buf)
error= binlog_log_row(table, 0, buf, log_func);
#ifdef WITH_WSREP
if (table_share->tmp_table == NO_TMP_TABLE &&
- WSREP(ha_thd()) && (error= wsrep_after_row(ha_thd())))
+ WSREP(ha_thd()) && ht->flags & HTON_WSREP_REPLICATION &&
+ !error && (error= wsrep_after_row(ha_thd())))
{
DBUG_RETURN(error);
}
@@ -6836,7 +6837,8 @@ int handler::ha_update_row(const uchar *old_data, const uchar *new_data)
}
}
if (table_share->tmp_table == NO_TMP_TABLE &&
- is_wsrep && (error= wsrep_after_row(thd)))
+ is_wsrep && ht->flags & HTON_WSREP_REPLICATION &&
+ !error && (error= wsrep_after_row(thd)))
{
return error;
}
@@ -6911,7 +6913,8 @@ int handler::ha_delete_row(const uchar *buf)
}
}
if (table_share->tmp_table == NO_TMP_TABLE &&
- is_wsrep && (error= wsrep_after_row(thd)))
+ is_wsrep && ht->flags & HTON_WSREP_REPLICATION &&
+ !error && (error= wsrep_after_row(thd)))
{
return error;
}
diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h
index 55beb6ebe7c..837bad4c50f 100644
--- a/sql/wsrep_trans_observer.h
+++ b/sql/wsrep_trans_observer.h
@@ -158,7 +158,7 @@ static inline int wsrep_start_trx_if_not_started(THD* thd)
Return zero on succes, non-zero on failure.
*/
-static inline int wsrep_after_row(THD* thd, bool)
+static inline int wsrep_after_row_internal(THD* thd)
{
if (thd->wsrep_cs().state() != wsrep::client_state::s_none &&
wsrep_thd_is_local(thd))