summaryrefslogtreecommitdiff
path: root/sql/mysqld.cc
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2021-03-24 10:55:27 +0100
committerJan Lindström <jan.lindstrom@mariadb.com>2021-04-05 09:10:23 +0300
commit915983e1cc3a0a356a0adfef38fc7ad87264bd9f (patch)
tree8453158b6726c2082eddf9d08245df41e8852718 /sql/mysqld.cc
parent880baedcf6f2c1c342dc59e8a0e813c0ea728264 (diff)
downloadmariadb-git-915983e1cc3a0a356a0adfef38fc7ad87264bd9f.tar.gz
MDEV-25226 Assertion when wsrep_on set OFF with SR transaction
This patch makes the following changes around variable wsrep_on: 1) Variable wsrep_on can no longer be updated from a session that has an active transaction running. The original behavior allowed cases like this: BEGIN; INSERT INTO t1 VALUES (1); SET SESSION wsrep_on = OFF; INSERT INTO t1 VALUES (2); COMMIT; With regular transactions this would result in no replication events (not even value 1). With streaming replication it would be unnecessarily complex to achieve the same behavior. In the above example, it would be possible for value 1 to be already replicated if it happened to fill a separate fragment, while value 2 wouldn't. 2) Global variable wsrep_on no longer affects current sessions, only subsequent ones. This is to avoid a similar case to the above, just using just by using global wsrep_on instead session wsrep_on: --connection conn_1 BEGIN; INSERT INTO t1 VALUES(1); --connection conn_2 SET GLOBAL wsrep_on = OFF; --connection conn_1 INSERT INTO t1 VALUES(2); COMMIT; The above example results in the transaction to be replicated, as global wsrep_on will only affect the session wsrep_on of new connections. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
Diffstat (limited to 'sql/mysqld.cc')
-rw-r--r--sql/mysqld.cc13
1 files changed, 1 insertions, 12 deletions
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index d0081034c0c..c536cdef504 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1131,14 +1131,6 @@ PSI_file_key key_file_binlog_state;
PSI_statement_info stmt_info_new_packet;
#endif
-#ifdef WITH_WSREP
-/** Whether the Galera write-set replication is enabled. A cached copy of
-global_system_variables.wsrep_on && wsrep_provider &&
- strcmp(wsrep_provider, WSREP_NONE)
-*/
-bool WSREP_ON_;
-#endif /* WITH_WSREP */
-
#ifndef EMBEDDED_LIBRARY
void net_before_header_psi(struct st_net *net, void *thd, size_t /* unused: count */)
{
@@ -5710,10 +5702,7 @@ int mysqld_main(int argc, char **argv)
}
#ifdef WITH_WSREP
- WSREP_ON_= (global_system_variables.wsrep_on &&
- wsrep_provider &&
- strcmp(wsrep_provider, WSREP_NONE));
-
+ wsrep_set_wsrep_on();
if (WSREP_ON && wsrep_check_opts()) unireg_abort(1);
#endif