mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Added logging of all messages (also system warnings) one gets during a MyISAM recovery or auto-recovery.
sql/mysqld.cc: Log errors if thd->log_all_errors is set sql/sql_class.cc: Add log_all_errors sql/sql_class.h: Add log_all_errors storage/myisam/ha_myisam.cc: Write db and table name for all logged errors Log errors also during auto_recovery During auto_recovery, set thd->log_all_errors if log_warnings >2 to ensure that system errors are also logged to file
This commit is contained in:
@ -3155,7 +3155,7 @@ to_error_log:
|
|||||||
/* When simulating OOM, skip writing to error log to avoid mtr errors */
|
/* When simulating OOM, skip writing to error log to avoid mtr errors */
|
||||||
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(0););
|
DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_RETURN(0););
|
||||||
|
|
||||||
if (!thd || (MyFlags & ME_NOREFRESH))
|
if (!thd || thd->log_all_errors || (MyFlags & ME_NOREFRESH))
|
||||||
(*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
|
(*func)("%s: %s", my_progname_short, str); /* purecov: inspected */
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
@ -662,7 +662,7 @@ THD::THD()
|
|||||||
Open_tables_state(refresh_version), rli_fake(0),
|
Open_tables_state(refresh_version), rli_fake(0),
|
||||||
lock_id(&main_lock_id),
|
lock_id(&main_lock_id),
|
||||||
user_time(0), in_sub_stmt(0),
|
user_time(0), in_sub_stmt(0),
|
||||||
sql_log_bin_toplevel(false),
|
sql_log_bin_toplevel(false), log_all_errors(0),
|
||||||
binlog_table_maps(0), binlog_flags(0UL),
|
binlog_table_maps(0), binlog_flags(0UL),
|
||||||
table_map_for_update(0),
|
table_map_for_update(0),
|
||||||
arg_of_last_insert_id_function(FALSE),
|
arg_of_last_insert_id_function(FALSE),
|
||||||
|
@ -1467,6 +1467,8 @@ public:
|
|||||||
bool sql_log_bin_toplevel;
|
bool sql_log_bin_toplevel;
|
||||||
/* True when opt_userstat_running is set at start of query */
|
/* True when opt_userstat_running is set at start of query */
|
||||||
bool userstat_running;
|
bool userstat_running;
|
||||||
|
/* True if we want to log all errors */
|
||||||
|
bool log_all_errors;
|
||||||
|
|
||||||
/* container for handler's private per-connection data */
|
/* container for handler's private per-connection data */
|
||||||
Ha_data ha_data[MAX_HA];
|
Ha_data ha_data[MAX_HA];
|
||||||
|
@ -91,14 +91,16 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
|||||||
|
|
||||||
if (!thd->vio_ok())
|
if (!thd->vio_ok())
|
||||||
{
|
{
|
||||||
sql_print_error("%s", msgbuf);
|
sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
|
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
|
||||||
T_AUTO_REPAIR))
|
T_AUTO_REPAIR))
|
||||||
{
|
{
|
||||||
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
|
my_message(ER_NOT_KEYFILE, msgbuf, MYF(MY_WME));
|
||||||
|
if (thd->variables.log_warnings > 2)
|
||||||
|
sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
|
length=(uint) (strxmov(name, param->db_name,".",param->table_name,NullS) -
|
||||||
@ -124,7 +126,7 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
|||||||
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
|
sql_print_error("Failed on my_net_write, writing to stderr instead: %s\n",
|
||||||
msgbuf);
|
msgbuf);
|
||||||
else if (thd->variables.log_warnings > 2)
|
else if (thd->variables.log_warnings > 2)
|
||||||
sql_print_error("%s", msgbuf);
|
sql_print_error("%s.%s: %s", param->db_name, param->table_name, msgbuf);
|
||||||
|
|
||||||
#ifdef THREAD
|
#ifdef THREAD
|
||||||
if (param->need_print_msg_lock)
|
if (param->need_print_msg_lock)
|
||||||
@ -1668,7 +1670,10 @@ bool ha_myisam::check_and_repair(THD *thd)
|
|||||||
|
|
||||||
if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
|
if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
|
||||||
{
|
{
|
||||||
|
bool save_log_all_errors;
|
||||||
sql_print_warning("Recovering table: '%s'",table->s->path.str);
|
sql_print_warning("Recovering table: '%s'",table->s->path.str);
|
||||||
|
save_log_all_errors= thd->log_all_errors;
|
||||||
|
thd->log_all_errors= (thd->variables.log_warnings > 2);
|
||||||
if (myisam_recover_options & HA_RECOVER_FULL_BACKUP)
|
if (myisam_recover_options & HA_RECOVER_FULL_BACKUP)
|
||||||
{
|
{
|
||||||
char buff[MY_BACKUP_NAME_EXTRA_LENGTH+1];
|
char buff[MY_BACKUP_NAME_EXTRA_LENGTH+1];
|
||||||
@ -1686,6 +1691,7 @@ bool ha_myisam::check_and_repair(THD *thd)
|
|||||||
T_AUTO_REPAIR);
|
T_AUTO_REPAIR);
|
||||||
if (repair(thd, &check_opt))
|
if (repair(thd, &check_opt))
|
||||||
error=1;
|
error=1;
|
||||||
|
thd->log_all_errors= save_log_all_errors;
|
||||||
}
|
}
|
||||||
thd->set_query(old_query, old_query_length);
|
thd->set_query(old_query, old_query_length);
|
||||||
DBUG_RETURN(error);
|
DBUG_RETURN(error);
|
||||||
|
Reference in New Issue
Block a user