← Back to team overview

maria-discuss team mailing list archive

Re: Deadlock on update with same values.

 

I would suggest turning on the InnoDB lock monitor (or at least look at the
ratio of locks held vs redo entries in SHOW ENGINE INNODB STATUS) to see
what locks the UPDATE is holding.

--Justin


On Thu, Dec 19, 2013 at 8:07 AM, Benoit Panizzon <benoit.panizzon@xxxxxx>wrote:

> Hello
>
> For those with the same problem, I found a completely stupid solution,
> which
> works!
>
> update user set lastlogin = IF(lastlogin != NOW(),NOW(),NOW()) where
> concat(userid,'@',domain)='$USER'
>
> For those now knowing what IF does...
>
> If lastlogin is not NOW() update it and set it to NOW() else set it to
> NOW()
>
> Well actualy this does exactly the same as
> update user set lastlogin = NOW()
> but surprisingly does not lead to the deadlock error, if lastlogin is
> already
> NOW().
>
> Mit freundlichen Grüssen
>
> Benoit Panizzon
> --
> I m p r o W a r e   A G    -
> ______________________________________________________
>
> Zurlindenstrasse 29             Tel  +41 61 826 93 07
> CH-4133 Pratteln                Fax  +41 61 826 93 02
> Schweiz                         Web  http://www.imp.ch
> ______________________________________________________
>
> _______________________________________________
> Mailing list: https://launchpad.net/~maria-discuss
> Post to     : maria-discuss@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maria-discuss
> More help   : https://help.launchpad.net/ListHelp
>

References