Skip to content

Commit be4f3f6

Browse files
Bug#31789964: HELP TABLES UPGRADE FAILS ENTIRE SERVER UPGRADE - WITHOUT PRINTING ERROR...
PROBLEM: -------- When we attempt to upgrade existing help tables which had the older DEFAULT CHARSET=latin1, the upgrade fails when attempting to populate the help tables, due to the character set mismatch. FIX: ---- The appropriate ALTER TABLE statements are added to mysql_system_tables_fix.sql to convert help tables to utf8 during upgrade. Note: Additional error messages are not added for this particular failure as it should no longer occur and thus would not be logged. Change-Id: Ieaa90e9be2d9b750642021eb291ca7b1311f5c87
1 parent 09686ea commit be4f3f6

File tree

4 files changed

+78
-0
lines changed

4 files changed

+78
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copy the 5.7 data zip file to working directory and check it exists.
2+
# Unzip 5.7 data directory.
3+
# Set data directory and log file
4+
# Restart server to trigger upgrade.
5+
# Upgrade of help tables should succeed.
6+
# restart: --datadir=MYSQLD_DATADIR1 --log-error=MYSQLD_LOG
7+
# Check for errors in the error log.
8+
Pattern "\[ERROR\]" not found
9+
# Check for mysql_upgrade_info file in data directory.
10+
# Cleanup.
11+
# Restart the server with default options.
12+
# restart
Binary file not shown.
+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
--source include/have_case_sensitive_file_system.inc
2+
3+
###############################################################################
4+
#
5+
# Bug#31789964 : HELP TABLES UPGRADE FAILS ENTIRE SERVER UPGRADE - WITHOUT
6+
# PRINTING ERROR...
7+
#
8+
###############################################################################
9+
# To create the file std_data/upgrade/data_57_help_tables.zip
10+
#
11+
# - In 5.7, execute:
12+
#
13+
# CREATE SCHEMA test;
14+
# ALTER TABLE mysql.help_topic CONVERT TO CHARACTER SET latin1;
15+
# ALTER TABLE mysql.help_category CONVERT TO CHARACTER SET latin1;
16+
# ALTER TABLE mysql.help_relation CONVERT TO CHARACTER SET latin1;
17+
# ALTER TABLE mysql.help_keyword CONVERT TO CHARACTER SET latin1;
18+
#
19+
# - then zip the data folder
20+
#
21+
# zip -r data_57_help_tables.zip db/
22+
#
23+
###############################################################################
24+
25+
--echo # Copy the 5.7 data zip file to working directory and check it exists.
26+
--copy_file $MYSQLTEST_VARDIR/std_data/upgrade/data_57_help_tables.zip $MYSQL_TMP_DIR/data_57_help_tables.zip
27+
--file_exists $MYSQL_TMP_DIR/data_57_help_tables.zip
28+
29+
--echo # Unzip 5.7 data directory.
30+
--exec unzip -qo $MYSQL_TMP_DIR/data_57_help_tables.zip -d $MYSQL_TMP_DIR/data_57_help_tables
31+
32+
--echo # Set data directory and log file
33+
--let $MYSQLD_DATADIR1= $MYSQL_TMP_DIR/data_57_help_tables/db
34+
--let $MYSQLD_LOG= $MYSQLTEST_VARDIR/log/data_57_help_tables.log
35+
36+
--echo # Restart server to trigger upgrade.
37+
--echo # Upgrade of help tables should succeed.
38+
39+
--replace_result $MYSQLD MYSQLD $MYSQLD_DATADIR1 MYSQLD_DATADIR1 $MYSQLD_LOG MYSQLD_LOG
40+
--let $restart_parameters = restart: --datadir=$MYSQLD_DATADIR1 --log-error=$MYSQLD_LOG
41+
--let $wait_counter= 10000
42+
--source include/restart_mysqld.inc
43+
44+
--echo # Check for errors in the error log.
45+
--let SEARCH_FILE= $MYSQLD_LOG
46+
--let SEARCH_PATTERN= \[ERROR\]
47+
--source include/search_pattern.inc
48+
49+
--echo # Check for mysql_upgrade_info file in data directory.
50+
--file_exists $MYSQLD_DATADIR1/mysql_upgrade_info
51+
52+
--echo # Cleanup.
53+
--remove_file $MYSQL_TMP_DIR/data_57_help_tables.zip
54+
--force-rmdir $MYSQL_TMP_DIR/data_57_help_tables
55+
56+
--echo # Restart the server with default options.
57+
--let $restart_parameters=
58+
--source include/restart_mysqld.inc

scripts/mysql_system_tables_fix.sql

+8
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,14 @@ SET GLOBAL automatic_sp_privileges = @global_automatic_sp_privileges;
989989
ALTER TABLE help_category MODIFY url TEXT NOT NULL;
990990
ALTER TABLE help_topic MODIFY url TEXT NOT NULL;
991991

992+
--
993+
-- Upgrade help tables character set to utf8
994+
--
995+
ALTER TABLE help_topic CONVERT TO CHARACTER SET utf8;
996+
ALTER TABLE help_category CONVERT TO CHARACTER SET utf8;
997+
ALTER TABLE help_relation CONVERT TO CHARACTER SET utf8;
998+
ALTER TABLE help_keyword CONVERT TO CHARACTER SET utf8;
999+
9921000
--
9931001
-- Upgrade a table engine from MyISAM to InnoDB for the system tables
9941002
-- help_topic, help_category, help_relation, help_keyword, plugin, servers,

0 commit comments

Comments
 (0)