Skip to content

Commit d097b8b

Browse files
Jimmy Yangdahlerlend
Jimmy Yang
authored andcommitted
Fix Bug#27508095 UPGRADING FROM 5.6.39 TO 8.0.4 OR 8.0.5 GENERATES A
SERVER ASSERTION Reviewed-by: Sunny Bains <[email protected]>
1 parent ea5d556 commit d097b8b

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

share/errmsg-utf8.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17809,6 +17809,9 @@ ER_IB_MSG_1269
1780917809
ER_IB_MSG_1270
1781017810
eng "%s"
1781117811

17812+
ER_IB_MSG_1271
17813+
eng "Cannot upgrade server earlier than 5.7 to 8.0"
17814+
1781217815
ER_RPL_SLAVE_SQL_THREAD_STOP_CMD_EXEC_TIMEOUT
1781317816
eng "STOP SLAVE command execution is incomplete: Slave SQL thread got the stop signal, thread is busy, SQL thread will stop once the current task is complete."
1781417817

storage/innobase/dict/dict0dict.cc

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7167,16 +7167,24 @@ void dict_upgrade_evict_tables_cache() {
71677167

71687168
/** Build the table_id array of SYS_* tables. This
71697169
array is used to determine if a table is InnoDB SYSTEM
7170-
table or not. */
7171-
void dict_sys_table_id_build() {
7170+
table or not.
7171+
@return true if successful, false otherwise */
7172+
bool dict_sys_table_id_build() {
71727173
mutex_enter(&dict_sys->mutex);
71737174
for (uint32_t i = 0; i < SYS_NUM_SYSTEM_TABLES; i++) {
71747175
dict_table_t *system_table = dict_table_get_low(SYSTEM_TABLE_NAME[i]);
71757176

7176-
ut_a(system_table != nullptr);
7177+
if (system_table == nullptr) {
7178+
/* Cannot find a system table, this happens only if user trying
7179+
to boot server earlier than 5.7 */
7180+
mutex_exit(&dict_sys->mutex);
7181+
LogErr(ERROR_LEVEL, ER_IB_MSG_1271);
7182+
return (false);
7183+
}
71777184
dict_sys_table_id[i] = system_table->id;
71787185
}
71797186
mutex_exit(&dict_sys->mutex);
7187+
return (true);
71807188
}
71817189

71827190
/** @return true if table is InnoDB SYS_* table

storage/innobase/handler/ha_innodb.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4417,7 +4417,9 @@ static int innobase_init_files(dict_init_mode_t dict_init_mode,
44174417
}
44184418

44194419
if (srv_is_upgrade_mode) {
4420-
dict_sys_table_id_build();
4420+
if (!dict_sys_table_id_build()) {
4421+
DBUG_RETURN(innodb_init_abort());
4422+
}
44214423
/* Disable AHI when we start loading tables for purge.
44224424
These tables are evicted anyway after purge. */
44234425

storage/innobase/include/dict0dict.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,8 +1720,9 @@ bool dict_table_is_system(table_id_t table_id);
17201720

17211721
/** Build the table_id array of SYS_* tables. This
17221722
array is used to determine if a table is InnoDB SYSTEM
1723-
table or not. */
1724-
void dict_sys_table_id_build();
1723+
table or not.
1724+
@return true if successful, false otherwise */
1725+
bool dict_sys_table_id_build();
17251726

17261727
/** Change the table_id of SYS_* tables if they have been created after
17271728
an earlier upgrade. This will update the table_id by adding DICT_MAX_DD_TABLES

0 commit comments

Comments
 (0)