Skip to content

Commit

Permalink
Extract some of #3360 fixes to 10.11.x
Browse files Browse the repository at this point in the history
That PR uncovered countless issues on `my_snprintf` uses.
This commit backports a squashed subset of their fixes.
(Excludes previous parts #3485 and #3493)
  • Loading branch information
ParadoxV5 committed Sep 13, 2024
1 parent a8c5717 commit b8e182e
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion mysys/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ void get_dynamic(DYNAMIC_ARRAY *array, void *element, size_t idx)
{
if (idx >= array->elements)
{
DBUG_PRINT("warning",("To big array idx: %d, array size is %d",
DBUG_PRINT("warning",("To big array idx: %zu, array size is %zu",
idx,array->elements));
bzero(element,array->size_of_element);
return;
Expand Down
3 changes: 1 addition & 2 deletions mysys/waiting_threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ static int unlock_lock_and_free_resource(WT_THD *thd, WT_RESOURCE *rc)

if (rc->owners.elements || rc->waiter_count)
{
DBUG_PRINT("wt", ("nothing to do, %u owners, %u waiters",
DBUG_PRINT("wt", ("nothing to do, %zu owners, %u waiters",
rc->owners.elements, rc->waiter_count));
rc_unlock(rc);
DBUG_RETURN(0);
Expand Down Expand Up @@ -1142,4 +1142,3 @@ void wt_thd_release(WT_THD *thd, const WT_RESOURCE_ID *resid)
reset_dynamic(&thd->my_resources);
DBUG_VOID_RETURN;
}

Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ int HCData::curl_run (const char *url, std::string *response,
else if (is_error)
{
my_printf_error(ER_UNKNOWN_ERROR, PLUGIN_ERROR_HEADER
"Hashicorp server error: %d, response: %s",
"Hashicorp server error: %ld, response: %s",
ME_ERROR_LOG_ONLY | ME_WARNING, http_code, res);
}
}
Expand Down
2 changes: 1 addition & 1 deletion sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ static void check_and_remove_stale_alter(Relay_log_info *rli)
{
DBUG_ASSERT(info->state == start_alter_state::REGISTERED);

sql_print_warning("ALTER query started at %u-%u-%llu could not "
sql_print_warning("ALTER query started at %llu-%u-%u could not "
"be completed because of unexpected master server "
"or its binlog change", info->sa_seq_no, // todo:gtid
0, 0);
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3380,7 +3380,7 @@ void plugin_thdvar_cleanup(THD *thd)
if ((idx= thd->lex->plugins.elements))
{
list= ((plugin_ref*) thd->lex->plugins.buffer) + idx - 1;
DBUG_PRINT("info",("unlocking %d plugins", idx));
DBUG_PRINT("info",("unlocking %zu plugins", idx));
while ((uchar*) list >= thd->lex->plugins.buffer)
intern_plugin_unlock(NULL, *list--);
}
Expand Down
6 changes: 3 additions & 3 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6362,9 +6362,9 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info,
}
if (!part_elem)
{
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_PARTITION_DOES_NOT_EXIST,
ER_THD(thd, ER_PARTITION_DOES_NOT_EXIST));
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE,
ER_PARTITION_DOES_NOT_EXIST,
ER_THD(thd, ER_PARTITION_DOES_NOT_EXIST));
names_it.remove();
}
}
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/fil/fil0fil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2475,7 +2475,7 @@ fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)

if (space) {
sql_print_information("InnoDB: Ignoring data file '%s'"
" with space ID " ULINTPF
" with space ID %" PRIu32
". Another data file called %s"
" exists"
" with the same space ID.",
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/fsp/fsp0fsp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2638,7 +2638,7 @@ dberr_t fseg_free_page(fseg_header_t *seg_header, fil_space_t *space,
mtr->x_lock_space(space);

DBUG_PRINT("fseg_free_page",
("space_id: " ULINTPF ", page_no: %u", space->id, offset));
("space_id: %" PRIu32 ", page_no: %" PRIu32, space->id, offset));

dberr_t err;
if (fseg_inode_t *seg_inode= fseg_inode_try_get(seg_header,
Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3766,7 +3766,7 @@ compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags)
if (is_loaded[compression_algorithm])
return 0;

my_printf_error(HA_ERR_UNSUPPORTED, "InnoDB: compression algorithm %s (%u)"
my_printf_error(HA_ERR_UNSUPPORTED, "InnoDB: compression algorithm %s (%lu)"
" is not available. Please, load the corresponding provider plugin.", flags,
page_compression_algorithms[compression_algorithm], compression_algorithm);
return 1;
Expand Down Expand Up @@ -4011,7 +4011,7 @@ static int innodb_init_params()
"InnoDB: innodb_open_files=%lu is not greater "
"than the number of system tablespace files, "
"temporary tablespace files, "
"innodb_undo_tablespaces=%lu; adjusting "
"innodb_undo_tablespaces=%u; adjusting "
"to innodb_open_files=%zu",
innobase_open_files, srv_undo_tablespaces,
min_open_files_limit);
Expand Down Expand Up @@ -18536,7 +18536,7 @@ static void innodb_log_file_size_update(THD *thd, st_mysql_sys_var*,
*static_cast<const ulonglong*>(save) < log_sys.buf_size)
my_printf_error(ER_WRONG_ARGUMENTS,
"innodb_log_file_size must be at least"
" innodb_log_buffer_size=%zu", MYF(0), log_sys.buf_size);
" innodb_log_buffer_size=%u", MYF(0), log_sys.buf_size);
else
{
switch (log_sys.resize_start(*static_cast<const ulonglong*>(save))) {
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/log/log0recv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4492,7 +4492,7 @@ static dberr_t recv_rename_files()
err= space->rename(new_name, false);
if (err != DB_SUCCESS)
sql_print_error("InnoDB: Cannot replay rename of tablespace "
UINT32PF " to '%s: %s", new_name, ut_strerr(err));
UINT32PF " to '%s': %s", id, new_name, ut_strerr(err));
goto done;
}
mysql_mutex_unlock(&fil_system.mutex);
Expand Down
3 changes: 2 additions & 1 deletion storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4030,7 +4030,8 @@ bool fil_node_t::read_page0()
(flags & ~FSP_FLAGS_MEM_MASK)))
{
invalid:
sql_print_error("InnoDB: Expected tablespace flags 0x%zx but found 0x%zx"
sql_print_error("InnoDB: Expected tablespace flags 0x%" PRIx32
" but found 0x%" PRIx32
" in the file %s", space->flags, flags, name);
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions storage/maria/ma_loghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -5707,7 +5707,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
goto err_unlock;
}

DBUG_PRINT("info", ("chunk: #%u first_page: %u (%u) "
DBUG_PRINT("info", ("chunk: #%zu first_page: %u (%u) "
"full_pages: %lu (%lu) "
"Left %lu",
groups.elements,
Expand Down Expand Up @@ -5875,8 +5875,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
record_rest + header_fixed_part +
(groups.elements - groups_per_page * (chunk0_pages - 1)) * (7 + 1))
chunk0_pages++;
DBUG_PRINT("info", ("chunk0_pages: %u groups %u groups per full page: %u "
"Group on last page: %u",
DBUG_PRINT("info", ("chunk0_pages: %u groups %zu groups per full page: %u "
"Group on last page: %zu",
chunk0_pages, groups.elements,
groups_per_page,
(groups.elements -
Expand Down

0 comments on commit b8e182e

Please sign in to comment.