Skip to content
Permalink
Browse files
MDEV-29518 ASAN Failure on i_s query when tablespace does rename oper…
…ation

- InnoDB information schema query access the tablespace name after
getting freed by concurrent rename operation. To avoid this, InnoDB
should take exclusive tablespace latch during rename operation
and I_S query should take shared tablespace latch before accessing
the name
  • Loading branch information
Thirunarayanan committed Nov 8, 2022
1 parent e3a5a69 commit 689e951
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
@@ -1488,13 +1488,15 @@ dict_table_t::rename_tablespace(span<const char> new_name, bool replace) const
err= DB_TABLESPACE_EXISTS;
else
{
space->x_lock();
err= space->rename(path, true, replace);
if (data_dir)
{
if (err == DB_SUCCESS)
new_name= {name.m_name, strlen(name.m_name)};
RemoteDatafile::delete_link_file(new_name);
}
space->x_unlock();
}

ut_free(path);
@@ -6491,7 +6491,9 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*)
{
space.reacquire();
mysql_mutex_unlock(&fil_system.mutex);
space.s_lock();
err= i_s_sys_tablespaces_fill(thd, space, tables->table);
space.s_unlock();
mysql_mutex_lock(&fil_system.mutex);
space.release();
if (err)
@@ -6719,8 +6721,10 @@ i_s_tablespaces_encryption_fill_table(
&& !space.is_stopping()) {
space.reacquire();
mysql_mutex_unlock(&fil_system.mutex);
space.s_lock();
err = i_s_dict_fill_tablespaces_encryption(
thd, &space, tables->table);
space.s_unlock();
mysql_mutex_lock(&fil_system.mutex);
space.release();
if (err) {

0 comments on commit 689e951

Please sign in to comment.