From 839681eba5a9ea8e59de7574ee3a3572e7f83892 Mon Sep 17 00:00:00 2001 From: Hashim Syed Date: Thu, 23 May 2024 22:38:29 +0000 Subject: [PATCH] Fix misleading error messages When the upgrade process fails due to missing either one of the files, innodb_index_stats.ibd and innodb_table_stats.ibd, the same misleading error was logged: "Error in renaming mysql_index_stats_ibd". To correctly log the error, separate the messages for missing innodb_{index,table}_stats.ibd files to two variables, and use the corresponding variable during upgrade process. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysql-test/t/percona_dd_upgrade_file_per_table_off.test | 3 ++- share/messages_to_error_log.txt | 5 ++++- sql/dd/upgrade_57/upgrade.cc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mysql-test/t/percona_dd_upgrade_file_per_table_off.test b/mysql-test/t/percona_dd_upgrade_file_per_table_off.test index 83079c93fb6c..8fd09c44b893 100644 --- a/mysql-test/t/percona_dd_upgrade_file_per_table_off.test +++ b/mysql-test/t/percona_dd_upgrade_file_per_table_off.test @@ -3,7 +3,8 @@ --source include/have_util_unzip.inc --disable_query_log -call mtr.add_suppression("Error in renaming mysql_index_stats.ibd"); +call mtr.add_suppression("Missing required files mysql/innodb_index_stats.ibd."); +call mtr.add_suppression("Missing required files mysql/innodb_table_stats.ibd."); call mtr.add_suppression("Resizing redo log from"); call mtr.add_suppression("Upgrading redo log"); call mtr.add_suppression("Starting to delete and rewrite log files"); diff --git a/share/messages_to_error_log.txt b/share/messages_to_error_log.txt index 1b41d751218f..a67b9e506fa2 100644 --- a/share/messages_to_error_log.txt +++ b/share/messages_to_error_log.txt @@ -3042,7 +3042,10 @@ ER_RES_GRP_SOLARIS_PROCESSOR_AFFINITY_FAILED eng "%s failed: processor_affinity failed (error code %d - %-.192s)." ER_DD_UPGRADE_RENAME_IDX_STATS_FILE_FAILED - eng "Error in renaming mysql_index_stats.ibd." + eng "Missing required files mysql/innodb_index_stats.ibd." + +ER_DD_UPGRADE_RENAME_TBL_STATS_FILE_FAILED + eng "Missing required files mysql/innodb_table_stats.ibd." ER_DD_UPGRADE_DD_OPEN_FAILED eng "Error in opening data directory %s." diff --git a/sql/dd/upgrade_57/upgrade.cc b/sql/dd/upgrade_57/upgrade.cc index f020e0cd2e1f..50a0abdaceb6 100644 --- a/sql/dd/upgrade_57/upgrade.cc +++ b/sql/dd/upgrade_57/upgrade.cc @@ -175,7 +175,7 @@ static void rename_stats_tables() { table_stats.c_str(), IBD_EXT.c_str(), 0, ¬_used); if (mysql_file_rename(key_file_misc, from_path, to_path, MYF(0))) { - LogErr(WARNING_LEVEL, ER_DD_UPGRADE_RENAME_IDX_STATS_FILE_FAILED); + LogErr(WARNING_LEVEL, ER_DD_UPGRADE_RENAME_TBL_STATS_FILE_FAILED); } }