fill_temporary_tables() does not protect thd->temporary_tables access with LOCK_temporary_tables

Bug #1223335 reported by Laurynas Biveinis on 2013-09-10
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Invalid
Undecided
Unassigned

Bug Description

int fill_temporary_tables(THD *thd, TABLE_LIST *tables, Item *cond)
{
...
  TABLE *tmp;

  for (tmp=thd->temporary_tables; tmp; tmp=tmp->next) {
    if (store_temporary_table_record(thd, tables->table, tmp,
                                     thd->lex->select_lex.db)) {
      DBUG_RETURN(1);
    }
  }
  DBUG_RETURN(0);
}

It needs to hold thd->LOCK_temporary_tables around this loop.

tags: added: i-s-temp-tables
Alexey Kopytov (akopytov) wrote :

The whole point of introducing LOCK_temporary_tables was to protect reads in fill_global_temporary_tables() from concurrent thd->temporary_tables modifications in other threads.

Since fill_temporary_tables() is only used to read the current connection's list of temporary tables, no concurrent modifications are possible. Thus the bug is invalid.

no longer affects: percona-server/5.6
no longer affects: percona-server/5.5
no longer affects: percona-server/5.1
Changed in percona-server:
status: Fix Committed → Invalid
importance: Medium → Undecided
assignee: Laurynas Biveinis (laurynas-biveinis) → nobody

Indeed. I also mistakenly thought that LOCK_temporary_tables was an upstream mutex.

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-3021

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers