← Back to team overview

maria-discuss team mailing list archive

Re: INSERT IGNORE (and other SQL commands) fail with: Deadlock found when trying to get lock;

 

Hi,

Remember that in Galera, replication beats write locks.  If you want to
avoid the deadlock ensure that updates to the table happen from only one
node, otherwise you simply have to retry the transaction.  this is the case
with Galera or regular innodb.  Your application must be able to handle
deadlocks.

You must make sure there is an index on (user_id,domain) or you will still
lock the table.

So either send all SQL that changes data through a single node (you can
still failover to another node for HA) or deal with deadlocks, though in
reality you have to deal with deadlocks in either case.

--Justin

References