mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
b1b2689f17
This patch changes statement rollback for streaming replication. Previously, a statement rollback was turned into full transaction rollback in the case where the transaction had already replicated a fragment. This was introduced in the initial implementation of streaming replication due to the fact that we do not have a mechanism to perform a statement rollback on the applying side. This policy is however overly pessimistic, causing full rollbacks even in cases where a local statement rollback, would not require a statement rollback on the applying side. This happens to be case when the statement itself has not replicated any fragments. So the patch changes the condition that determines if a statement rollback should be turned into a full rollback accordingly. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
59 lines
1.5 KiB
Text
59 lines
1.5 KiB
Text
connection node_2;
|
|
connection node_1;
|
|
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
|
|
connection node_1;
|
|
SET SESSION wsrep_trx_fragment_size = 1;
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY);
|
|
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY);
|
|
INSERT INTO t2 VALUES (1),(2),(3);
|
|
ALTER TABLE t2 DROP PRIMARY KEY;
|
|
INSERT INTO t2 VALUES (1);
|
|
SET SESSION wsrep_trx_fragment_size = 1;
|
|
START TRANSACTION;
|
|
INSERT INTO t1 SELECT * FROM t2;
|
|
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
|
SELECT * FROM t1;
|
|
f1
|
|
connection node_2;
|
|
SELECT * FROM t1;
|
|
f1
|
|
connection node_1;
|
|
DROP TABLE t1;
|
|
DROP TABLE t2;
|
|
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 CHAR(10)) ENGINE=InnoDB;
|
|
connection node_1;
|
|
SET SESSION wsrep_trx_fragment_size = 1;
|
|
START TRANSACTION;
|
|
INSERT INTO t1 VALUES (1, 'node1');
|
|
connection node_1a;
|
|
INSERT INTO t1 VALUES (5, 'node2');
|
|
connection node_1;
|
|
INSERT INTO t1 VALUES (5, 'node1');
|
|
ERROR 23000: Duplicate entry '5' for key 'PRIMARY'
|
|
SELECT * FROM t1;
|
|
f1 f2
|
|
1 node1
|
|
5 node2
|
|
SET SESSION wsrep_trx_fragment_size = 10000;
|
|
START TRANSACTION;
|
|
INSERT INTO t1 VALUE (10, 'node1');
|
|
SELECT * FROM mysql.wsrep_streaming_log;
|
|
node_uuid trx_id seqno flags frag
|
|
connection node_1a;
|
|
INSERT INTO t1 VALUES(15, 'node2');
|
|
connection node_1;
|
|
SELECT * FROM t1;
|
|
f1 f2
|
|
1 node1
|
|
5 node2
|
|
10 node1
|
|
INSERT INTO t1 VALUES(15, 'node1');
|
|
ERROR 23000: Duplicate entry '15' for key 'PRIMARY'
|
|
COMMIT;
|
|
SELECT * FROM t1;
|
|
f1 f2
|
|
1 node1
|
|
5 node2
|
|
10 node1
|
|
15 node2
|
|
DROP TABLE t1;
|