Skip to content

Commit

Permalink
Trivial fixups, no code changes
Browse files Browse the repository at this point in the history
- Indentation changes
- Fixed wrong name for used in DBUG_ENTER
- Added some code comments
  • Loading branch information
montywi committed Oct 21, 2020
1 parent dd757ee commit 3c4b844
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
6 changes: 4 additions & 2 deletions sql/log_event.h
Expand Up @@ -2227,8 +2227,10 @@ class Query_compressed_log_event:public Query_log_event{
virtual bool is_commit() { return false; }
virtual bool is_rollback() { return false; }
#ifdef MYSQL_SERVER
Query_compressed_log_event(THD* thd_arg, const char* query_arg, ulong query_length,
bool using_trans, bool direct, bool suppress_use, int error);
Query_compressed_log_event(THD* thd_arg, const char* query_arg,
ulong query_length,
bool using_trans, bool direct, bool suppress_use,
int error);
virtual bool write();
#endif
};
Expand Down
10 changes: 5 additions & 5 deletions sql/sql_class.cc
Expand Up @@ -6562,8 +6562,8 @@ exit:;
/**
Check if we should log a table DDL to the binlog
@@return true yes
@@return false no
@retval true yes
@retval false no
*/

bool THD::binlog_table_should_be_logged(const LEX_CSTRING *db)
Expand Down Expand Up @@ -7452,14 +7452,14 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg,
*/
if (binlog_should_compress(query_len))
{
Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
Query_compressed_log_event qinfo(this, query_arg, query_len, is_trans,
direct, suppress_use, errcode);
error= mysql_bin_log.write(&qinfo);
}
else
{
Query_log_event qinfo(this, query_arg, query_len, is_trans, direct,
suppress_use, errcode);
suppress_use, errcode);
error= mysql_bin_log.write(&qinfo);
}
/*
Expand Down
17 changes: 10 additions & 7 deletions sql/sql_insert.cc
Expand Up @@ -1211,7 +1211,7 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list,
such case the flag is ignored for constructing binlog event.
*/
DBUG_ASSERT(thd->killed != KILL_BAD_DATA || error > 0);
if (was_insert_delayed && table_list->lock_type == TL_WRITE)
if (was_insert_delayed && table_list->lock_type == TL_WRITE)
{
/* Binlog INSERT DELAYED as INSERT without DELAYED. */
String log_query;
Expand Down Expand Up @@ -3823,15 +3823,18 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
*/
lex->current_select= lex->first_select_lex();

res= setup_returning_fields(thd, table_list) ||
setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0, 0) ||
check_insert_fields(thd, table_list, *fields, values,
!insert_into_view, 1, &map);
res= (setup_returning_fields(thd, table_list) ||
setup_fields(thd, Ref_ptr_array(), values, MARK_COLUMNS_READ, 0, 0,
0) ||
check_insert_fields(thd, table_list, *fields, values,
!insert_into_view, 1, &map));

if (!res && fields->elements)
{
Abort_on_warning_instant_set aws(thd, !info.ignore && thd->is_strict_mode());
res= check_that_all_fields_are_given_values(thd, table_list->table, table_list);
Abort_on_warning_instant_set aws(thd,
!info.ignore && thd->is_strict_mode());
res= check_that_all_fields_are_given_values(thd, table_list->table,
table_list);
}

if (info.handle_duplicates == DUP_UPDATE && !res)
Expand Down
16 changes: 12 additions & 4 deletions sql/sql_table.cc
Expand Up @@ -2828,6 +2828,12 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
append_identifier(thd, &query, table_name);
query.append(STRING_WITH_LEN("/* Generated to handle "
"failed CREATE OR REPLACE */"));

/*
In case of temporary tables we don't have to log the database name
in the binary log. We log this for non temporary tables, as the slave
may use a filter to ignore queries for a specific database.
*/
error= thd->binlog_query(THD::STMT_QUERY_TYPE,
query.ptr(), query.length(),
FALSE, FALSE, temporary_table, 0) > 0;
Expand Down Expand Up @@ -5205,7 +5211,8 @@ int create_table_impl(THD *thd, const LEX_CSTRING &orig_db,
thd->variables.option_bits|= OPTION_KEEP_LOG;
thd->log_current_statement= 1;
create_info->table_was_deleted= 1;
DBUG_EXECUTE_IF("send_kill_after_delete", thd->set_killed(KILL_QUERY); );
DBUG_EXECUTE_IF("send_kill_after_delete",
thd->set_killed(KILL_QUERY); );

/*
Restart statement transactions for the case of CREATE ... SELECT.
Expand Down Expand Up @@ -5745,7 +5752,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,
DBUG_ENTER("mysql_rename_table");
DBUG_ASSERT(base);
DBUG_PRINT("enter", ("old: '%s'.'%s' new: '%s'.'%s'",
old_db->str, old_name->str, new_db->str, new_name->str));
old_db->str, old_name->str, new_db->str,
new_name->str));

// Temporarily disable foreign key checks
if (flags & NO_FK_CHECKS)
Expand All @@ -5755,8 +5763,8 @@ mysql_rename_table(handlerton *base, const LEX_CSTRING *old_db,

build_table_filename(from, sizeof(from) - 1, old_db->str, old_name->str, "",
flags & FN_FROM_IS_TMP);
length= build_table_filename(to, sizeof(to) - 1, new_db->str, new_name->str, "",
flags & FN_TO_IS_TMP);
length= build_table_filename(to, sizeof(to) - 1, new_db->str,
new_name->str, "", flags & FN_TO_IS_TMP);
// Check if we hit FN_REFLEN bytes along with file extension.
if (length+reg_ext_length > FN_REFLEN)
{
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_trigger.cc
Expand Up @@ -1826,7 +1826,7 @@ bool Table_triggers_list::drop_all_triggers(THD *thd, const LEX_CSTRING *db,
TABLE table;
char path[FN_REFLEN];
bool result= 0;
DBUG_ENTER("Triggers::drop_all_triggers");
DBUG_ENTER("Table_triggers_list::drop_all_triggers");

table.reset();
init_sql_alloc(key_memory_Table_trigger_dispatcher,
Expand Down

0 comments on commit 3c4b844

Please sign in to comment.