mirror of
https://github.com/MariaDB/server.git
synced 2025-02-04 21:02:17 +01:00
915983e1cc
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>
33 lines
887 B
Text
33 lines
887 B
Text
#
|
|
# MDEV-25226 - Test the case the where wsrep_on is set OFF
|
|
# on a transaction that has already replicated a fragment.
|
|
#
|
|
# This would cause: Assertion `transaction_.active() == false ||
|
|
# (transaction_.state() == wsrep::transaction::s_executing ||
|
|
# transaction_.state() == wsrep::transaction::s_prepared ||
|
|
# transaction_.state() == wsrep::transaction::s_aborted ||
|
|
# transaction_.state() == wsrep::transaction::s_must_abort)'
|
|
#
|
|
|
|
--source include/galera_cluster.inc
|
|
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
|
|
|
|
SET SESSION wsrep_trx_fragment_size=1;
|
|
START TRANSACTION;
|
|
INSERT INTO t1 VALUES(1);
|
|
--error ER_CANT_DO_THIS_DURING_AN_TRANSACTION
|
|
SET SESSION wsrep_on=OFF;
|
|
--error ER_CANT_DO_THIS_DURING_AN_TRANSACTION
|
|
SET GLOBAL wsrep_on=OFF;
|
|
INSERT INTO t1 VALUES(2);
|
|
COMMIT;
|
|
|
|
--connection node_1
|
|
SELECT * FROM t1;
|
|
|
|
--connection node_2
|
|
SELECT * FROM t1;
|
|
|
|
--connection node_1
|
|
DROP TABLE t1;
|