[MDEV-32688] Sever status variable for foreign key errors is missing Created: 2023-11-06  Updated: 2023-11-07

Status: Open
Project: MariaDB Server
Component/s: Server
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Oli Sennhauser Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: beginner-friendly


 Description   

If a deadlock happens (SHOW ENGINE INNODB STATUS) the server status variable innodb_deadlocks will be increased.
If a foreign key error happens (SHOW ENGINE INNODB STATUS) there is NO server status variable exists indicating this even.

So it would be good to have a server status variable like innodb_foreign_key_errors which indicates the amount of FK errors we had since last database start.



 Comments   
Comment by Daniel Black [ 2023-11-07 ]

As FK errors, like deadlock errors are user errors, something like SQL_ERROR_LOG plugin, which is a simple AUDIT_PLUGIN that just counts, and then expose counts as either status variables or a information_schema table like locales .

Yes, this extends beyond FK, but just anticipating the next feature request

Comment by Ralf Gebhardt [ 2023-11-07 ]

Or to allow the SQL_ERROR_LOG plugin to write into a table, which allows easy aggregation

Comment by Daniel Black [ 2023-11-07 ]

Right, with the SQL service inside the server now that should be achievable.

Comment by Oli Sennhauser [ 2023-11-07 ]

The initial idea/requirement is/was a status counter for monitoring (and graphing)...
SHOW GLOBAL STATUS LIKE 'innodb_foreign_key_errors';

Generated at Thu Feb 08 10:33:15 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.