Skip to content

Commit 81a0073

Browse files
Bug #31749490 OLD FTS FILES AFTER UPGRADE: ASSERTION FAILURE:
PARS0PARS.CC:736:SYM_NODE->TABLE != NULLPTR Problem: If we drop last fulltext index on a table and upgrade the server from 5.7 to 8.0. INSERT operation hit an assert. Analysis: After dropping last fulltext index, innodb does not drop common aux tables. because we still maintain hidden FTS_DOC_ID column & FTS_DOC_ID_INDEX index in the table. when we upgrade from 5.7 to 8.0, we do not migrate metadata of fts common table to server new data dictionary. Later while inserting into the table, we fetch doc_id from fts config table. Since config table is not in server data dictionary, we could not load innodb metadata object (dict_table_t) for config table and hit an assert. Fix: During upgrade if we keep hidden FTS_DOC_ID column in the table then migrate metadata of fts common tables to server new data dictionary. RB: 25080 Reviewed by : Rahul Agarkar <[email protected]>
1 parent 36eb846 commit 81a0073

File tree

3 files changed

+113
-1
lines changed

3 files changed

+113
-1
lines changed

mysql-test/suite/innodb/r/upgrade_fts.result

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,21 @@ SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLES
176176
WHERE name LIKE '%test%'
177177
ORDER BY name;
178178
lower(name)
179+
test/fts_0000000000000424_being_deleted
180+
test/fts_0000000000000424_being_deleted_cache
181+
test/fts_0000000000000424_config
182+
test/fts_0000000000000424_deleted
183+
test/fts_0000000000000424_deleted_cache
179184
test/t1
180185
SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
181186
WHERE name LIKE '%test%'
182187
ORDER BY name;
183188
lower(name)
189+
test/fts_0000000000000424_being_deleted
190+
test/fts_0000000000000424_being_deleted_cache
191+
test/fts_0000000000000424_config
192+
test/fts_0000000000000424_deleted
193+
test/fts_0000000000000424_deleted_cache
184194
test/t1
185195
# Check DDL & DML opearations are working
186196
SELECT * FROM t1;
@@ -245,3 +255,52 @@ DROP TABLE t1;
245255
# Remove copied files
246256
# Restart the server
247257
# restart
258+
#
259+
# Bug #31749490 OLD FTS FILES AFTER UPGRADE: ASSERTION FAILURE:
260+
# PARS0PARS.CC:736:SYM_NODE->TABLE != NULLPTR
261+
#
262+
# Stop the running server
263+
#
264+
# Copy and unzip the datadir
265+
#
266+
# Restart the server with the unzipped datadir
267+
# restart: --datadir=DATADIR --innodb_page_size=16k
268+
# Check the contents of INFORMATION_SCHEMA
269+
SHOW TABLES;
270+
Tables_in_test
271+
t1
272+
SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLES
273+
WHERE name LIKE '%test%'
274+
ORDER BY name;
275+
lower(name)
276+
test/fts_0000000000000424_being_deleted
277+
test/fts_0000000000000424_being_deleted_cache
278+
test/fts_0000000000000424_config
279+
test/fts_0000000000000424_deleted
280+
test/fts_0000000000000424_deleted_cache
281+
test/t1
282+
SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
283+
WHERE name LIKE '%test%'
284+
ORDER BY name;
285+
lower(name)
286+
test/fts_0000000000000424_being_deleted
287+
test/fts_0000000000000424_being_deleted_cache
288+
test/fts_0000000000000424_config
289+
test/fts_0000000000000424_deleted
290+
test/fts_0000000000000424_deleted_cache
291+
test/t1
292+
INSERT INTO t1 (val) VALUES ('Upgraded successfully to 8.0 version');
293+
SELECT * FROM t1;
294+
id val
295+
1 Upgrade mysql database to 8.0 version
296+
2 Upgraded successfully to 8.0 version
297+
DELETE FROM t1 WHERE val LIKE 'Upgrade mysql database to 8.0 version';
298+
SELECT * FROM t1;
299+
id val
300+
2 Upgraded successfully to 8.0 version
301+
DROP TABLE t1;
302+
# Cleanup
303+
# Shutdown server
304+
# Remove copied files
305+
# Restart the server
306+
# restart

mysql-test/suite/innodb/t/upgrade_fts.test

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,56 @@ DROP TABLE t1;
166166
--echo # Restart the server
167167
let $restart_parameters =;
168168
--source include/start_mysqld.inc
169+
170+
--echo #
171+
--echo # Bug #31749490 OLD FTS FILES AFTER UPGRADE: ASSERTION FAILURE:
172+
--echo # PARS0PARS.CC:736:SYM_NODE->TABLE != NULLPTR
173+
--echo #
174+
175+
--echo # Stop the running server
176+
--source include/shutdown_mysqld.inc
177+
178+
--echo #
179+
--echo # Copy and unzip the datadir
180+
--echo #
181+
182+
--copy_file $MYSQLTEST_VARDIR/std_data/data57_drop_fts.zip $MYSQL_TMP_DIR/data57_drop_fts.zip
183+
--file_exists $MYSQL_TMP_DIR/data57_drop_fts.zip
184+
--exec unzip -qo $MYSQL_TMP_DIR/data57_drop_fts.zip -d $MYSQL_TMP_DIR
185+
let $DATADIR1 = $MYSQL_TMP_DIR/data57_drop_fts;
186+
187+
--echo # Restart the server with the unzipped datadir
188+
--replace_result $DATADIR1 DATADIR
189+
--let $wait_counter=3000
190+
--let $restart_parameters = restart: --datadir=$DATADIR1 --innodb_page_size=16k
191+
--source include/start_mysqld.inc
192+
193+
--echo # Check the contents of INFORMATION_SCHEMA
194+
SHOW TABLES;
195+
SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLES
196+
WHERE name LIKE '%test%'
197+
ORDER BY name;
198+
199+
SELECT lower(name) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES
200+
WHERE name LIKE '%test%'
201+
ORDER BY name;
202+
203+
INSERT INTO t1 (val) VALUES ('Upgraded successfully to 8.0 version');
204+
SELECT * FROM t1;
205+
206+
DELETE FROM t1 WHERE val LIKE 'Upgrade mysql database to 8.0 version';
207+
SELECT * FROM t1;
208+
DROP TABLE t1;
209+
210+
--echo # Cleanup
211+
--echo # Shutdown server
212+
--source include/shutdown_mysqld.inc
213+
214+
--echo # Remove copied files
215+
--file_exists $MYSQL_TMP_DIR/data57_drop_fts.zip
216+
--force-rmdir $MYSQL_TMP_DIR/data57_drop_fts
217+
--remove_file $MYSQL_TMP_DIR/data57_drop_fts.zip
218+
219+
--echo # Restart the server
220+
let $restart_parameters =;
221+
--source include/start_mysqld.inc

storage/innobase/dict/dict0upgrade.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ bool dd_upgrade_table(THD *thd, const char *db_name, const char *table_name,
10151015
ib_table->autoinc = auto_inc == 0 ? 0 : auto_inc + 1;
10161016
}
10171017

1018-
if (dict_table_has_fts_index(ib_table)) {
1018+
if (dict_table_has_fts_index(ib_table) || added_fts_col) {
10191019
dberr_t err = fts_upgrade_aux_tables(ib_table);
10201020

10211021
if (err != DB_SUCCESS) {

0 commit comments

Comments
 (0)