-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-22021: Galera database could get inconsistent with rollback to s…
…avepoint When binlog is disabled, WSREP will not behave correctly when SAVEPOINT ROLLBACK is executed and we will not rollback transaction.
- Loading branch information
Showing
10 changed files
with
139 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
connection node_2; | ||
connection node_1; | ||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
START TRANSACTION; | ||
INSERT INTO t1 VALUES (1); | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (2); | ||
ROLLBACK TO SAVEPOINT sp1; | ||
COMMIT; | ||
SELECT COUNT(*) = 1 FROM t1; | ||
COUNT(*) = 1 | ||
1 | ||
connection node_2; | ||
SELECT COUNT(*) = 1 FROM t1; | ||
COUNT(*) = 1 | ||
1 | ||
connection node_1; | ||
DELETE FROM t1; | ||
START TRANSACTION; | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (1); | ||
SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (2); | ||
ROLLBACK TO SAVEPOINT sp2; | ||
ROLLBACK TO SAVEPOINT sp1; | ||
COMMIT; | ||
SELECT COUNT(*) = 0 FROM t1; | ||
COUNT(*) = 0 | ||
1 | ||
connection node_2; | ||
SELECT COUNT(*) = 0 FROM t1; | ||
COUNT(*) = 0 | ||
1 | ||
connection node_1; | ||
DELETE FROM t1; | ||
START TRANSACTION; | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (1); | ||
INSERT INTO t1 VALUES (2); | ||
INSERT INTO t1 VALUES (3); | ||
INSERT INTO t1 VALUES (4); | ||
SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (5); | ||
ROLLBACK TO SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (6); | ||
INSERT INTO t1 VALUES (7); | ||
ROLLBACK TO SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (8); | ||
COMMIT; | ||
SELECT COUNT(*) = 1 FROM t1; | ||
COUNT(*) = 1 | ||
1 | ||
connection node_2; | ||
SELECT COUNT(*) = 1 FROM t1; | ||
COUNT(*) = 1 | ||
1 | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[binlogoff] | ||
|
||
[binlogon] | ||
log-bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# | ||
# SAVEPOINT ROLLBACK can introduce inconsistency in cluster. | ||
# | ||
|
||
--source include/galera_cluster.inc | ||
|
||
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); | ||
|
||
START TRANSACTION; | ||
INSERT INTO t1 VALUES (1); | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (2); | ||
ROLLBACK TO SAVEPOINT sp1; | ||
COMMIT; | ||
|
||
SELECT COUNT(*) = 1 FROM t1; | ||
|
||
--connection node_2 | ||
SELECT COUNT(*) = 1 FROM t1; | ||
|
||
--connection node_1 | ||
DELETE FROM t1; | ||
|
||
START TRANSACTION; | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (1); | ||
SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (2); | ||
ROLLBACK TO SAVEPOINT sp2; | ||
ROLLBACK TO SAVEPOINT sp1; | ||
COMMIT; | ||
|
||
SELECT COUNT(*) = 0 FROM t1; | ||
--connection node_2 | ||
SELECT COUNT(*) = 0 FROM t1; | ||
|
||
--connection node_1 | ||
DELETE FROM t1; | ||
|
||
START TRANSACTION; | ||
SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (1); | ||
INSERT INTO t1 VALUES (2); | ||
INSERT INTO t1 VALUES (3); | ||
INSERT INTO t1 VALUES (4); | ||
SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (5); | ||
ROLLBACK TO SAVEPOINT sp2; | ||
INSERT INTO t1 VALUES (6); | ||
INSERT INTO t1 VALUES (7); | ||
ROLLBACK TO SAVEPOINT sp1; | ||
INSERT INTO t1 VALUES (8); | ||
COMMIT; | ||
|
||
SELECT COUNT(*) = 1 FROM t1; | ||
|
||
--connection node_2 | ||
SELECT COUNT(*) = 1 FROM t1; | ||
|
||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,5 @@ COMMIT; | |
connection node_2; | ||
SELECT COUNT(*) = 2 FROM t1; | ||
COUNT(*) = 2 | ||
0 | ||
1 | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,5 @@ COUNT(*) = 6 | |
connection node_2; | ||
SELECT COUNT(*) = 6 FROM t1; | ||
COUNT(*) = 6 | ||
0 | ||
1 | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters