fkoyer opened a new pull request, #40:
URL: https://github.com/apache/spamassassin/pull/40

   bayes_token is InnoDB with PRIMARY KEY (id, token), so every token write 
takes a row lock on the clustered index. _put_tokens and tok_touch_all iterated 
tokens in Perl hash / caller order, which is randomized per process, so two 
concurrent scans that share tokens could lock the same rows in opposite orders 
and deadlock resulting in the following
   error:
   
   ```
   bayes: _put_tokens: SQL error: Deadlock found when trying to get lock; try 
restarting transaction
   ```
   
   Sorting the tokens gives every writer a single global lock order, so the 
circular wait cannot form. The token column is binary(5), so Perl's default 
string sort matches InnoDB's byte ordering on the clustered index.
   
   Also, replace `dbg` with `warn` so future MySQL errors are visible in the 
logs.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to