I can trigger a deadlock on our (test) Galera cluster when updating a row with the same data.
INSERT INTO test (id, val) VALUES (1, 42), (2, 47);
-- Query OK, 2 rows affected (0.01 sec)
-- Records: 2 Duplicates: 0 Warnings: 0
Updating a value to a different value, doesn't result in an error:
UPDATE test SET val=43 WHERE id=1;
-- Query OK, 1 row affected (0.00 sec)
-- Rows matched: 1 Changed: 1 Warnings: 0
And when you set it to the same value:
UPDATE test SET val=47 WHERE id=2;
-- ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction
It appears to be a sort of warning that is incorrectly relayed (from /var/log/mysql
):
140106 13:52:04 [Warning] WSREP: SQL statement was ineffective, THD: 12, buf: 103
QUERY: UPDATE test SET val=47 WHERE id=2
=> Skipping replication
140106 13:52:04 [Warning] WSREP: SQL statement was ineffective, THD: 12, buf: 103
QUERY: UPDATE test SET val=47 WHERE id=2
=> Skipping replication
Note: the table is created like
CREATE TABLE IF NOT EXISTS `test` (
`id` int(3) NOT NULL PRIMARY KEY,
`val` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf-8;