0

I have MariaDB 10.6.5 server with several databases. I added a line innodb_print_all_deadlocks = 1 to config file. Now all deadlocks are logged to one file /var/log/mysql/mariadb.err Is there any way to split deadlocks to separate files for each database? I need to split the log file to make a report for programer on which DB was deadlock and which tables.

Maybe there is a tool that could help me generate a report on which database occur dedadlock and which tables

2
  • 1
    Show us one of the deadlocks (SHOW ENGINE INNODB STATUS;) and we will help you get rid of that one. You may see a pattern that lets you fix most of the deadlocks.
    – Rick James
    Mar 25, 2022 at 15:48
  • There's no splitting of server log possible in server settings. Look at a logrotate or other server log processing framework for splitting the error messages.
    – danblack
    Apr 1, 2022 at 3:10

1 Answer 1

3

The fact that you want to log your Deadlocks separately by database suggests, to me, that you're seeing an awful lot of Deadlocks.

I would suggest that you'd be far better off finding out why the Deadlocks are happening in the first place and fix that cause, rather than just trying to keep on top of the mess that they're making of your logging system.

You should get very few, if any, Deadlocks in properly written Applications.

1
  • For now it refers to one database, but in future it could happen to the rest of databases. I need to split the log file to make a report for programer on which DB was deadlock and which tables.
    – Kamil Sz
    Mar 28, 2022 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.