1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

- Renaming variables so that they don't shadow others (After this patch one can compile with -Wshadow and get much fewer warnings)

- Changed ER(ER_...) to ER_THD(thd, ER_...) when thd was known or if there was many calls to current_thd in the same function.
- Changed ER(ER_..) to ER_THD_OR_DEFAULT(current_thd, ER...) in some places where current_thd is not necessary defined.
- Removing calls to current_thd when we have access to thd

Part of this is optimization (not calling current_thd when not needed),
but part is bug fixing for error condition when current_thd is not defined
(For example on startup and end of mysqld)

Notable renames done as otherwise a lot of functions would have to be changed:
- In JOIN structure renamed:
   examined_rows -> join_examined_rows
   record_count -> join_record_count
- In Field, renamed new_field() to make_new_field()

Other things:
- Added DBUG_ASSERT(thd == tmp_thd) in Item_singlerow_subselect() just to be safe.
- Removed old 'tab' prefix in JOIN_TAB::save_explain_data() and use members directly
- Added 'thd' as argument to a few functions to avoid calling current_thd.
This commit is contained in:
Monty
2015-07-06 20:24:14 +03:00
parent 8d4d185a08
commit 7332af49e4
107 changed files with 1562 additions and 1290 deletions

View File

@ -559,7 +559,7 @@ bool purge_error_message(THD* thd, int res)
if ((errcode= purge_log_get_error_code(res)) != 0)
{
my_message(errcode, ER(errcode), MYF(0));
my_message(errcode, ER_THD(thd, errcode), MYF(0));
return TRUE;
}
my_ok(thd);
@ -3099,14 +3099,15 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
if (!opt_skip_slave_start)
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_MISSING_SKIP_SLAVE,
ER(ER_MISSING_SKIP_SLAVE));
ER_THD(thd, ER_MISSING_SKIP_SLAVE));
}
mysql_mutex_unlock(&mi->rli.data_lock);
}
else if (thd->lex->mi.pos || thd->lex->mi.relay_log_pos)
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
ER(ER_UNTIL_COND_IGNORED));
push_warning(thd,
Sql_condition::WARN_LEVEL_NOTE, ER_UNTIL_COND_IGNORED,
ER_THD(thd, ER_UNTIL_COND_IGNORED));
if (!slave_errno)
slave_errno = start_slave_threads(0 /*no mutex */,
@ -3123,7 +3124,7 @@ int start_slave(THD* thd , Master_info* mi, bool net_report)
{
/* no error if all threads are already started, only a warning */
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SLAVE_WAS_RUNNING,
ER(ER_SLAVE_WAS_RUNNING));
ER_THD(thd, ER_SLAVE_WAS_RUNNING));
}
err:
@ -3190,14 +3191,14 @@ int stop_slave(THD* thd, Master_info* mi, bool net_report )
//no error if both threads are already stopped, only a warning
slave_errno= 0;
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SLAVE_WAS_NOT_RUNNING,
ER(ER_SLAVE_WAS_NOT_RUNNING));
ER_THD(thd, ER_SLAVE_WAS_NOT_RUNNING));
}
unlock_slave_threads(mi);
if (slave_errno)
{
if (net_report)
my_message(slave_errno, ER(slave_errno), MYF(0));
my_message(slave_errno, ER_THD(thd, slave_errno), MYF(0));
DBUG_RETURN(1);
}
@ -3590,7 +3591,8 @@ bool change_master(THD* thd, Master_info* mi, bool *master_info_added)
lex_mi->ssl_cert || lex_mi->ssl_cipher || lex_mi->ssl_key ||
lex_mi->ssl_verify_server_cert || lex_mi->ssl_crl || lex_mi->ssl_crlpath)
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_SLAVE_IGNORED_SSL_PARAMS, ER(ER_SLAVE_IGNORED_SSL_PARAMS));
ER_SLAVE_IGNORED_SSL_PARAMS,
ER_THD(thd, ER_SLAVE_IGNORED_SSL_PARAMS));
#endif
if (lex_mi->relay_log_name)
@ -3775,7 +3777,8 @@ int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len)
if (!mysql_bin_log.is_open())
{
my_message(ER_FLUSH_MASTER_BINLOG_CLOSED,
ER(ER_FLUSH_MASTER_BINLOG_CLOSED), MYF(ME_BELL+ME_WAITTANG));
ER_THD(thd, ER_FLUSH_MASTER_BINLOG_CLOSED),
MYF(ME_BELL+ME_WAITTANG));
return 1;
}
@ -4313,7 +4316,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_MASTER_GTID_POS_MISSING_DOMAIN,
ER(ER_MASTER_GTID_POS_MISSING_DOMAIN),
ER_THD(thd, ER_MASTER_GTID_POS_MISSING_DOMAIN),
binlog_gtid->domain_id, binlog_gtid->domain_id,
binlog_gtid->server_id, binlog_gtid->seq_no);
gave_missing_warning= true;
@ -4333,7 +4336,7 @@ rpl_gtid_pos_check(THD *thd, char *str, size_t len)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG,
ER(ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG),
ER_THD(thd, ER_MASTER_GTID_POS_CONFLICTS_WITH_BINLOG),
slave_gtid->domain_id, slave_gtid->server_id,
slave_gtid->seq_no, binlog_gtid->domain_id,
binlog_gtid->server_id, binlog_gtid->seq_no);