Skip to content
Permalink
Browse files
MDEV-18867 Long Time to Stop and Start
fts_drop_orphaned_tables() takes long time to remove the orphaned
FTS tables. In order to reduce the time, do the following:

- Traverse fil_system.space_list and construct a set of
table_id,index_id of all FTS_*.ibd tablespaces.
- Traverse the sys_indexes table and ignore the entry
from the above collection if it exist.
- Existing elements in the collection can be considered as
orphaned fts tables. construct the table name from
(table_id,index_id) and invoke fts_drop_tables().
- Removed DICT_TF2_FTS_AUX_HEX_NAME flag usage from upgrade.
- is_aux_table() in dict_table_t to check whether the given name
is fts auxiliary table
fts_space_set_t is a structure to store set of parent table id
and index id
- Remove unused FTS function in fts0fts.cc
- Remove the fulltext index in row_format_redundant test case.
Because it deals with the condition that SYS_TABLES does have
corrupted entry and valid entry exist in SYS_INDEXES.
  • Loading branch information
Thirunarayanan committed Sep 10, 2020
1 parent 5c07ce4 commit 75e82f7
Show file tree
Hide file tree
Showing 11 changed files with 285 additions and 1,449 deletions.
@@ -5,8 +5,7 @@ SET GLOBAL innodb_file_per_table=1;
#
SET GLOBAL innodb_file_per_table=ON;
create table t1 (a int not null, d varchar(15) not null, b
varchar(198) not null, c char(156),
fulltext ftsic(c)) engine=InnoDB
varchar(198) not null, c char(156)) engine=InnoDB
row_format=redundant;
insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
insert into t1 values(456, 'abcdef', 'jghikl', 'mnop');
@@ -72,7 +71,7 @@ DROP TABLE t1;
Warnings:
Warning 1932 Table 'test.t1' doesn't exist in engine
DROP TABLE t2,t3;
FOUND 50 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b/ in mysqld.1.err
FOUND 6 /\[ERROR\] InnoDB: Table `test`\.`t1` in InnoDB data dictionary contains invalid flags\. SYS_TABLES\.TYPE=1 SYS_TABLES\.MIX_LEN=255\b/ in mysqld.1.err
ib_buffer_pool
ib_logfile0
ib_logfile1
@@ -32,8 +32,7 @@ SET GLOBAL innodb_file_per_table=1;

SET GLOBAL innodb_file_per_table=ON;
create table t1 (a int not null, d varchar(15) not null, b
varchar(198) not null, c char(156),
fulltext ftsic(c)) engine=InnoDB
varchar(198) not null, c char(156)) engine=InnoDB
row_format=redundant;

insert into t1 values(123, 'abcdef', 'jghikl', 'mnop');
@@ -5416,51 +5416,6 @@ fil_delete_file(
}
}

/**
Iterate over all the spaces in the space list and fetch the
tablespace names. It will return a copy of the name that must be
freed by the caller using: delete[].
@return DB_SUCCESS if all OK. */
dberr_t
fil_get_space_names(
/*================*/
space_name_list_t& space_name_list)
/*!< in/out: List to append to */
{
fil_space_t* space;
dberr_t err = DB_SUCCESS;

mutex_enter(&fil_system->mutex);

for (space = UT_LIST_GET_FIRST(fil_system->space_list);
space != NULL;
space = UT_LIST_GET_NEXT(space_list, space)) {

if (space->purpose == FIL_TYPE_TABLESPACE) {
ulint len;
char* name;

len = ::strlen(space->name);
name = UT_NEW_ARRAY_NOKEY(char, len + 1);

if (name == 0) {
/* Caller to free elements allocated so far. */
err = DB_OUT_OF_MEMORY;
break;
}

memcpy(name, space->name, len);
name[len] = 0;

space_name_list.push_back(name);
}
}

mutex_exit(&fil_system->mutex);

return(err);
}

/** Generate redo log for swapping two .ibd files
@param[in] old_table old table
@param[in] new_table new table
@@ -148,9 +148,7 @@ fts_config_create_index_param_name(
::strcpy(name, param);
name[len] = '_';

fts_write_object_id(index->id, name + len + 1,
DICT_TF2_FLAG_IS_SET(index->table,
DICT_TF2_FTS_AUX_HEX_NAME));
fts_write_object_id(index->id, name + len + 1);

return(name);
}

0 comments on commit 75e82f7

Please sign in to comment.