Skip to content

Commit

Permalink
Extract some of MariaDB#3360 fixes to 10.6.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 MariaDB#3485).
  • Loading branch information
ParadoxV5 committed Sep 1, 2024
1 parent b1f7522 commit 9221411
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions sql/ha_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1474,8 +1474,8 @@ bool print_admin_msg(THD* thd, uint len,
Also we likely need to lock mutex here (in both cases with protocol and
push_warning).
*/
DBUG_PRINT("info",("print_admin_msg: %s, %s, %s, %s", name, op_name,
msg_type, msgbuf));
DBUG_PRINT("info",("print_admin_msg: %s, %s, %s, %s", name, op_name->str,
msg_type->str, msgbuf));
protocol->prepare_for_resend();
protocol->store(name, length, system_charset_info);
protocol->store(op_name, system_charset_info);
Expand Down
2 changes: 1 addition & 1 deletion sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11412,7 +11412,7 @@ int TC_LOG_BINLOG::recover(LOG_INFO *linfo, const char *last_log_name,
Query_log_event *query_ev= (Query_log_event*) ev;
if (query_ev->xid)
{
DBUG_PRINT("QQ", ("xid: %llu xid"));
DBUG_PRINT("QQ", ("xid: %llu xid", query_ev->xid));
DBUG_ASSERT(sizeof(query_ev->xid) == sizeof(my_xid));
uchar *x= (uchar *) memdup_root(&mem_root,
(uchar*) &query_ev->xid,
Expand Down
2 changes: 1 addition & 1 deletion sql/partition_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool partition_info::add_named_partition(const char *part_name, size_t length)
}
DBUG_PRINT("info", ("Found partition %u is_subpart %d for name %.*s",
part_def->part_id, part_def->is_subpart,
length, part_name));
(int) length, part_name));
DBUG_RETURN(false);
}

Expand Down
2 changes: 1 addition & 1 deletion sql/semisync_master.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1445,7 +1445,7 @@ void Repl_semi_sync_master::await_all_slave_replies(const char *msg)
if (msg && first)
{
first= false;
sql_print_information(msg);
sql_print_information("%s", msg);
}

wait_result=
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/btr/btr0btr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ static bool btr_root_fseg_validate(ulint offset,
sql_print_error("InnoDB: Index root page " UINT32PF " in %s is corrupted "
"at " ULINTPF,
block.page.id().page_no(),
UT_LIST_GET_FIRST(space.chain)->name);
UT_LIST_GET_FIRST(space.chain)->name, offset);
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions storage/innobase/dict/dict0load.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2300,9 +2300,9 @@ dict_load_tablespace(
table->file_unreadable = true;

if (!(ignore_err & DICT_ERR_IGNORE_RECOVER_LOCK)) {
sql_print_error("InnoDB: Failed to load tablespace "
ULINTPF " for table %s",
table->space_id, table->name);
sql_print_error("InnoDB: Failed to load tablespace %"
PRIu32 " for table %s",
table->space_id, table->name.m_name);
}
}

Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,7 @@ static int innodb_check_version(handlerton *hton, const char *path,
const trx_id_t trx_id= table->def_trx_id;
DBUG_ASSERT(trx_id <= create_id);
dict_table_close(table);
DBUG_PRINT("info", ("create_id: %llu trx_id: %llu", create_id, trx_id));
DBUG_PRINT("info", ("create_id: %llu trx_id: %" PRIu64, create_id, trx_id));
DBUG_RETURN(create_id != trx_id);
}
else
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/os/os0file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2776,7 +2776,7 @@ os_file_io(

if (type.type != IORequest::READ_MAYBE_PARTIAL) {
sql_print_warning("InnoDB: %zu bytes should have been"
" %s at %llu from %s,"
" %s at %" PRIu64 " from %s,"
" but got only %zd."
" Retrying.",
n, type.is_read()
Expand Down Expand Up @@ -2950,7 +2950,7 @@ os_file_read_func(

os_file_handle_error_cond_exit(type.node ? type.node->name : nullptr, "read",
false, false);
sql_print_error("InnoDB: Tried to read %zu bytes at offset %llu"
sql_print_error("InnoDB: Tried to read %zu bytes at offset %" PRIu64
" of file %s, but was only able to read %zd",
n, offset, type.node ? type.node->name : "(unknown)",
n_bytes);
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/row/row0sel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6776,7 +6776,7 @@ dberr_t row_check_index(row_prebuilt_t *prebuilt, ulint *n_rows)
{
push_warning_printf(prebuilt->trx->mysql_thd,
Sql_condition::WARN_LEVEL_WARN, ER_NOT_KEYFILE,
"InnoDB: Invalid PAGE_MAX_TRX_ID=%llu"
"InnoDB: Invalid PAGE_MAX_TRX_ID=%" PRIu64
" in index '%-.200s'",
page_trx_id, index->name());
prebuilt->autoinc_error= DB_INDEX_CORRUPT;
Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ void _ma_report_error(int errcode, const LEX_STRING *name, myf flags)
}
}
my_printf_error(errcode, "Got error '%M' for '%s'",
flags, (int) errcode, file_name);
flags, errcode, file_name);
DBUG_VOID_RETURN;
}

Expand Down
2 changes: 1 addition & 1 deletion storage/maria/ma_loghandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -8705,7 +8705,7 @@ my_bool translog_purge(TRANSLOG_ADDRESS low)
log_descriptor.open_files.elements);
DBUG_ASSERT(log_descriptor.min_file == i);
file= *((TRANSLOG_FILE **)pop_dynamic(&log_descriptor.open_files));
DBUG_PRINT("info", ("Files : %d", log_descriptor.open_files.elements));
DBUG_PRINT("info", ("Files : %zu", log_descriptor.open_files.elements));
DBUG_ASSERT(i == file->number);
log_descriptor.min_file++;
DBUG_ASSERT(log_descriptor.max_file - log_descriptor.min_file + 1 ==
Expand Down

0 comments on commit 9221411

Please sign in to comment.