Skip to content

Commit aebd162

Browse files
committed
don't use session locale for the error log
1 parent 9cb0bb1 commit aebd162

File tree

11 files changed

+16
-18
lines changed

11 files changed

+16
-18
lines changed

sql/log.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3418,7 +3418,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
34183418
if (!write_error)
34193419
{
34203420
write_error= 1;
3421-
sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, errno);
3421+
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno);
34223422
}
34233423
goto end;
34243424
}

sql/opt_histogram_json.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,7 @@ bool Histogram_json_hb::parse(MEM_ROOT *mem_root, const char *db_name,
829829
ER_THD(thd, ER_JSON_HISTOGRAM_PARSE_FAILED),
830830
db_name, table_name,
831831
err, (je.s.c_str - (const uchar*)hist_data));
832-
sql_print_error(ER_THD(thd, ER_JSON_HISTOGRAM_PARSE_FAILED),
832+
sql_print_error(ER_DEFAULT(ER_JSON_HISTOGRAM_PARSE_FAILED),
833833
db_name, table_name, err,
834834
(je.s.c_str - (const uchar*)hist_data));
835835

sql/partition_info.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ void partition_info::vers_check_limit(THD *thd)
10381038
table->s->db.str, table->s->table_name.str,
10391039
vers_info->hist_part->partition_name.str, "LIMIT");
10401040

1041-
sql_print_warning(ER_THD(thd, WARN_VERS_PART_FULL),
1041+
sql_print_warning(ER_DEFAULT(WARN_VERS_PART_FULL),
10421042
table->s->db.str, table->s->table_name.str,
10431043
vers_info->hist_part->partition_name.str, "LIMIT");
10441044
}

sql/rpl_mi.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,7 @@ bool Master_info_index::init_all_master_info()
11881188
else
11891189
{
11901190
/* Master_info already in HASH */
1191-
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
1192-
ER_CONNECTION_ALREADY_EXISTS),
1191+
sql_print_error(ER_DEFAULT(ER_CONNECTION_ALREADY_EXISTS),
11931192
(int) connection_name.length, connection_name.str,
11941193
(int) connection_name.length, connection_name.str);
11951194
mi->unlock_slave_threads();
@@ -1207,8 +1206,7 @@ bool Master_info_index::init_all_master_info()
12071206
Sql_condition::WARN_LEVEL_NOTE))
12081207
{
12091208
/* Master_info was already registered */
1210-
sql_print_error(ER_THD_OR_DEFAULT(current_thd,
1211-
ER_CONNECTION_ALREADY_EXISTS),
1209+
sql_print_error(ER_DEFAULT(ER_CONNECTION_ALREADY_EXISTS),
12121210
(int) connection_name.length, connection_name.str,
12131211
(int) connection_name.length, connection_name.str);
12141212
mi->unlock_slave_threads();

sql/sql_acl.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13326,7 +13326,7 @@ static void login_failed_error(THD *thd)
1332613326
*/
1332713327
if (global_system_variables.log_warnings > 1)
1332813328
{
13329-
sql_print_warning(ER_THD(thd, access_denied_error_code(thd->password)),
13329+
sql_print_warning(ER_DEFAULT(access_denied_error_code(thd->password)),
1333013330
thd->main_security_ctx.user,
1333113331
thd->main_security_ctx.host_or_ip,
1333213332
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)
1496614966
if (global_system_variables.log_warnings > 1)
1496714967
{
1496814968
Security_context* sctx = thd->security_ctx;
14969-
sql_print_warning(ER_THD(thd, err),
14969+
sql_print_warning(ER_DEFAULT(err),
1497014970
sctx->priv_user, sctx->priv_host, mpvio.db.str);
1497114971
}
1497214972
}

sql/sql_class.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7651,7 +7651,7 @@ static void print_unsafe_warning_to_log(THD *thd, int unsafe_type, char* buf,
76517651
DBUG_ENTER("print_unsafe_warning_in_log");
76527652
sprintf(buf, ER_THD(thd, ER_BINLOG_UNSAFE_STATEMENT),
76537653
ER_THD(thd, LEX::binlog_stmt_unsafe_errcode[unsafe_type]));
7654-
sql_print_warning(ER_THD(thd, ER_MESSAGE_AND_STATEMENT), buf, query);
7654+
sql_print_warning(ER_DEFAULT(ER_MESSAGE_AND_STATEMENT), buf, query);
76557655
DBUG_VOID_RETURN;
76567656
}
76577657

sql/sql_class.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5440,7 +5440,7 @@ class THD: public THD_count, /* this must be first */
54405440
}
54415441
}
54425442
Security_context *sctx= &main_security_ctx;
5443-
sql_print_warning(ER_THD(this, ER_NEW_ABORTING_CONNECTION),
5443+
sql_print_warning(ER_DEFAULT(ER_NEW_ABORTING_CONNECTION),
54445444
thread_id, (db.str ? db.str : "unconnected"),
54455445
sctx->user ? sctx->user : "unauthenticated",
54465446
sctx->host_or_ip, real_ip_str, reason);

sql/sql_db.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
589589
get_charset_by_name(pos+1, MYF(utf8_flag))))
590590
{
591591
sql_print_error("Error while loading database options: '%s':",path);
592-
sql_print_error(ER_THD(thd, ER_UNKNOWN_CHARACTER_SET),pos+1);
592+
sql_print_error(ER_DEFAULT(ER_UNKNOWN_CHARACTER_SET),pos+1);
593593
create->default_table_charset= default_charset_info;
594594
}
595595
}
@@ -598,7 +598,7 @@ bool load_db_opt(THD *thd, const char *path, Schema_specification_st *create)
598598
if (!(create->default_table_charset= get_charset_by_name(pos+1, MYF(utf8_flag))))
599599
{
600600
sql_print_error("Error while loading database options: '%s':",path);
601-
sql_print_error(ER_THD(thd, ER_UNKNOWN_COLLATION),pos+1);
601+
sql_print_error(ER_DEFAULT(ER_UNKNOWN_COLLATION),pos+1);
602602
create->default_table_charset= default_charset_info;
603603
}
604604
}

sql/sql_plugin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1962,7 +1962,7 @@ static void plugin_load(MEM_ROOT *tmp_root)
19621962
mysql_mutex_unlock(&LOCK_plugin);
19631963
}
19641964
if (unlikely(error > 0))
1965-
sql_print_error(ER_THD(new_thd, ER_GET_ERRNO), my_errno,
1965+
sql_print_error(ER_DEFAULT(ER_GET_ERRNO), my_errno,
19661966
table->file->table_type());
19671967
end_read_record(&read_record_info);
19681968
table->mark_table_for_reopen();

sql/sql_udf.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static const char *init_syms(udf_func *tmp, char *nm)
9898
if (!opt_allow_suspicious_udfs)
9999
return nm;
100100
if (thd->variables.log_warnings)
101-
sql_print_warning(ER_THD(thd, ER_CANT_FIND_DL_ENTRY), nm, tmp->name.str);
101+
sql_print_warning(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), nm, tmp->name.str);
102102
}
103103
return 0;
104104
}
@@ -252,7 +252,7 @@ void udf_init()
252252
if (!(dl= dlopen(dlpath, RTLD_NOW)))
253253
{
254254
/* Print warning to log */
255-
sql_print_error(ER_THD(new_thd, ER_CANT_OPEN_LIBRARY),
255+
sql_print_error(ER_DEFAULT(ER_CANT_OPEN_LIBRARY),
256256
tmp->dl, errno, my_dlerror(dlpath));
257257
/* Keep the udf in the hash so that we can remove it later */
258258
continue;
@@ -265,7 +265,7 @@ void udf_init()
265265
const char *missing;
266266
if ((missing= init_syms(tmp, buf)))
267267
{
268-
sql_print_error(ER_THD(new_thd, ER_CANT_FIND_DL_ENTRY), missing,
268+
sql_print_error(ER_DEFAULT(ER_CANT_FIND_DL_ENTRY), missing,
269269
tmp->name.str);
270270
del_udf(tmp);
271271
if (new_dl)

0 commit comments

Comments
 (0)