branches/zip: ha_innobase::add_index(): Fix a race condition that

existed before the fast-index-creation code was merged, in r1414.

Do not call row_prebuilt_table_obsolete(innodb_table) until after
the table has been renamed to a temporary name.  Otherwise, the
following could happen when creating a clustered index on table T:

(a1) copy T to T#1
(a2) mark T obsolete
(b1) add the name of T to the background drop list
(a3) rename T to T#2 and T#1 to T
(b2) drop the table on the background

These steps are executed by two threads, a and b.

If b1 is executed after a3, all is fine: the name T#2 will be added
to the background drop list.  If b1 is executed before a3, the name
T will be added, and T#2 will survive.
This commit is contained in:
marko 2007-09-11 06:20:19 +00:00
parent cee366907b
commit 5cff259229

View file

@ -8489,8 +8489,6 @@ error_handling:
row_mysql_lock_data_dictionary(trx);
dict_locked = TRUE;
row_prebuilt_table_obsolete(innodb_table);
error = row_merge_rename_tables(innodb_table, indexed_table,
tmp_name, trx);
@ -8512,6 +8510,8 @@ error_handling:
break;
}
row_prebuilt_table_obsolete(innodb_table);
row_prebuilt_free(prebuilt, TRUE);
prebuilt = row_create_prebuilt(indexed_table);