1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-27087: Add thread ID and database / table, where the error occured

to SQL error plugin

New plugin variable "with_db_and_thread_info" is added which prints the
thread id and databse name to the logfile. the value is stored in variable
"with_db_and_thread_info"

log_sql_errors() is responsible for printing in the log. If detailed is
enabled, print thread id and database name both, otherwise skip it.
This commit is contained in:
Rucha Deodhar
2023-11-13 23:21:49 +05:30
parent 4ef9c9bb75
commit 90cd712b84
6 changed files with 84 additions and 2 deletions

View File

@@ -0,0 +1 @@
--plugin-load-add=$SQL_ERRLOG_SO --sql-error-log-with-db-and-thread-info=1

View File

@@ -0,0 +1,18 @@
--source include/not_embedded.inc
if (!$SQL_ERRLOG_SO) {
skip No SQL_ERROR_LOG plugin;
}
show variables like 'sql_error_log%';
set global sql_error_log_rate=1;
--error ER_NO_SUCH_TABLE
select * from t_doesnt_exist;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--let SEARCH_FILE= $MYSQLD_DATADIR/sql_errors.log
--let LINES_TO_READ=1
--replace_regex /[1-9]* test [1-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [ 0-9][0-9]:[0-9][0-9]:[0-9][0-9] [^E]*/THREAD_ID DATABASE_NAME TIME HOSTNAME /
--source include/read_head.inc
remove_file $MYSQLD_DATADIR/sql_errors.log;