| 1 |
# |
| 2 |
# UPDATE LIMIT should not cause any issues with row-based Galera replication |
| 3 |
# regardless of the order in which the rows were updated |
| 4 |
# |
| 5 |
|
| 6 |
--source include/galera_cluster.inc |
| 7 |
|
| 8 |
# |
| 9 |
# With a PK |
| 10 |
# |
| 11 |
|
| 12 |
--connection node_1 |
| 13 |
CREATE TABLE ten (f1 INTEGER not null primary key) Engine=InnoDB; |
| 14 |
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); |
| 15 |
|
| 16 |
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) Engine=InnoDB; |
| 17 |
INSERT INTO t1 SELECT f1 FROM ten ORDER BY RAND(); |
| 18 |
|
| 19 |
--connection node_2 |
| 20 |
UPDATE IGNORE t1 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; |
| 21 |
|
| 22 |
# Check that the sum of all elements and the max element are identical across nodes |
| 23 |
# as this will indicate that the same UPDATE was applied to both nodes |
| 24 |
|
| 25 |
--let $sum_rows = `SELECT SUM(f1) FROM t1` |
| 26 |
--let $max_row = `SELECT MAX(f1) FROM t1` |
| 27 |
|
| 28 |
--connection node_1 |
| 29 |
--disable_query_log |
| 30 |
--eval SELECT (SELECT SUM(f1) FROM t1) = $sum_rows AS sum_matches; |
| 31 |
--eval SELECT f1 = $max_row AS max_matches FROM t1 WHERE f1 = $max_row; |
| 32 |
--enable_query_log |
| 33 |
|
| 34 |
DROP TABLE t1; |
| 35 |
|
| 36 |
# |
| 37 |
# Without a PK |
| 38 |
# |
| 39 |
|
| 40 |
CREATE TABLE t2 (f1 INTEGER) Engine=InnoDB; |
| 41 |
INSERT INTO t2 SELECT f1 FROM ten ORDER BY RAND(); |
| 42 |
|
| 43 |
--connection node_2 |
| 44 |
UPDATE IGNORE t2 SET f1 = FLOOR(1 + (RAND() * 10)) ORDER BY RAND() LIMIT 5; |
| 45 |
|
| 46 |
--let $sum_rows = `SELECT SUM(f1) FROM t2` |
| 47 |
|
| 48 |
--connection node_1 |
| 49 |
--disable_query_log |
| 50 |
--eval SELECT (SELECT SUM(f1) FROM t2) = $sum_rows AS sum_matches; |
| 51 |
--enable_query_log |
| 52 |
|
| 53 |
DROP TABLE t2; |
| 54 |
DROP TABLE ten; |