don't use session locale for the error log

This commit is contained in:
Sergei Golubchik 2024-05-21 21:04:41 +02:00
parent 9cb0bb1de0
commit aebd16201f
11 changed files with 16 additions and 18 deletions

View file

@ -3418,7 +3418,7 @@ err:
if (!write_error)
{
write_error= 1;
sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, errno);
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno);
}
goto end;
}

View file

@ -829,7 +829,7 @@ err:
ER_THD(thd, ER_JSON_HISTOGRAM_PARSE_FAILED),
db_name, table_name,
err, (je.s.c_str - (const uchar*)hist_data));
sql_print_error(ER_THD(thd, ER_JSON_HISTOGRAM_PARSE_FAILED),
sql_print_error(ER_DEFAULT(ER_JSON_HISTOGRAM_PARSE_FAILED),
db_name, table_name, err,
(je.s.c_str - (const uchar*)hist_data));

View file

@ -1038,7 +1038,7 @@ void partition_info::vers_check_limit(THD *thd)
table->s->db.str, table->s->table_name.str,
vers_info->hist_part->partition_name.str, "LIMIT");
sql_print_warning(ER_THD(thd, WARN_VERS_PART_FULL),
sql_print_warning(ER_DEFAULT(WARN_VERS_PART_FULL),
table->s->db.str, table->s->table_name.str,
vers_info->hist_part->partition_name.str, "LIMIT");
}

View file

@ -1188,8 +1188,7 @@ bool Master_info_index::init_all_master_info()
else
{
/* Master_info already in HASH */
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
ER_CONNECTION_ALREADY_EXISTS),
sql_print_error(ER_DEFAULT(ER_CONNECTION_ALREADY_EXISTS),
(int) connection_name.length, connection_name.str,
(int) connection_name.length, connection_name.str);
mi->unlock_slave_threads();
@ -1207,8 +1206,7 @@ bool Master_info_index::init_all_master_info()
Sql_condition::WARN_LEVEL_NOTE))
{
/* Master_info was already registered */
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
ER_CONNECTION_ALREADY_EXISTS),
sql_print_error(ER_DEFAULT(ER_CONNECTION_ALREADY_EXISTS),
(int) connection_name.length, connection_name.str,
(int) connection_name.length, connection_name.str);
mi->unlock_slave_threads();

View file

@ -13326,7 +13326,7 @@ static void login_failed_error(THD *thd)
*/
if (global_system_variables.log_warnings > 1)
{
sql_print_warning(ER_THD(thd, access_denied_error_code(thd->password)),
sql_print_warning(ER_DEFAULT(access_denied_error_code(thd->password)),
thd->main_security_ctx.user,
thd->main_security_ctx.host_or_ip,
thd->password ? ER_THD(thd, ER_YES) : ER_THD(thd, ER_NO));
@ -14966,7 +14966,7 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len)
if (global_system_variables.log_warnings > 1)
{
Security_context* sctx = thd->security_ctx;
sql_print_warning(ER_THD(thd, err),
sql_print_warning(ER_DEFAULT(err),
sctx->priv_user, sctx->priv_host, mpvio.db.str);
}
}

View file

@ -7651,7 +7651,7 @@ static void print_unsafe_warning_to_log(THD *thd, int unsafe_type, char* buf,
DBUG_ENTER("print_unsafe_warning_in_log");
sprintf(buf, ER_THD(thd, ER_BINLOG_UNSAFE_STATEMENT),
ER_THD(thd, LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
sql_print_warning(ER_THD(thd, ER_MESSAGE_AND_STATEMENT), buf, query);
sql_print_warning(ER_DEFAULT(ER_MESSAGE_AND_STATEMENT), buf, query);
DBUG_VOID_RETURN;
}

View file

@ -5440,7 +5440,7 @@ public:
}
}
Security_context *sctx= &main_security_ctx;
sql_print_warning(ER_THD(this, ER_NEW_ABORTING_CONNECTION),
sql_print_warning(ER_DEFAULT(ER_NEW_ABORTING_CONNECTION),
thread_id, (db.str ? db.str : "unconnected"),
sctx->user ? sctx->user : "unauthenticated",
sctx->host_or_ip, real_ip_str, reason);

View file

@ -589,7 +589,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
get_charset_by_name(pos+1, MYF(utf8_flag))))
{
sql_print_error("Error while loading database options: '%s':",path);
sql_print_error(ER_THD(thd, ER_UNKNOWN_CHARACTER_SET),pos+1);
sql_print_error(ER_DEFAULT(ER_UNKNOWN_CHARACTER_SET),pos+1);
create->default_table_charset= default_charset_info;
}
}
@ -598,7 +598,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
if (!(create->default_table_charset= get_charset_by_name(pos+1, MYF(utf8_flag))))
{
sql_print_error("Error while loading database options: '%s':",path);
sql_print_error(ER_THD(thd, ER_UNKNOWN_COLLATION),pos+1);
sql_print_error(ER_DEFAULT(ER_UNKNOWN_COLLATION),pos+1);
create->default_table_charset= default_charset_info;
}
}

View file

@ -1962,7 +1962,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
mysql_mutex_unlock(&LOCK_plugin);
}
if (unlikely(error > 0))
sql_print_error(ER_THD(new_thd, ER_GET_ERRNO), my_errno,
sql_print_error(ER_DEFAULT(ER_GET_ERRNO), my_errno,
table->file->table_type());
end_read_record(&read_record_info);
table->mark_table_for_reopen();

View file

@ -98,7 +98,7 @@ static const char *init_syms(udf_func *tmp, char *nm)
if (!opt_allow_suspicious_udfs)
return nm;
if (thd->variables.log_warnings)
sql_print_warning(ER_THD(thd, ER_CANT_FIND_DL_ENTRY), nm, tmp->name.str);
sql_print_warning(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), nm, tmp->name.str);
}
return 0;
}
@ -252,7 +252,7 @@ void udf_init()
if (!(dl= dlopen(dlpath, RTLD_NOW)))
{
/* Print warning to log */
sql_print_error(ER_THD(new_thd, ER_CANT_OPEN_LIBRARY),
sql_print_error(ER_DEFAULT(ER_CANT_OPEN_LIBRARY),
tmp->dl, errno, my_dlerror(dlpath));
/* Keep the udf in the hash so that we can remove it later */
continue;
@ -265,7 +265,7 @@ void udf_init()
const char *missing;
if ((missing= init_syms(tmp, buf)))
{
sql_print_error(ER_THD(new_thd, ER_CANT_FIND_DL_ENTRY), missing,
sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), missing,
tmp->name.str);
del_udf(tmp);
if (new_dl)

View file

@ -54,7 +54,7 @@ extern "C" {
/* Skip writing to the error log to avoid mtr complaints */
DBUG_EXECUTE_IF("simulate_out_of_memory", return;);
sql_print_error("%s", ER_THD_OR_DEFAULT(thd, ER_OUT_OF_RESOURCES));
sql_print_error(ER_DEFAULT(ER_OUT_OF_RESOURCES));
}
}