Commit d8de71ff authored by marko's avatar marko

branches/zip: ha_innobase::add_index(): Lock the table before creating

any indexes.  Before this fix, other transactions could see the empty indexes
before we acquired the table lock.
parent 93157fcd
......@@ -737,6 +737,17 @@ ha_innobase::add_index(
trx->table_id = indexed_table->id;
}
ut_ad(!error);
/* Acquire an exclusive lock on the table
before creating any indexes. */
error = row_merge_lock_table(trx, innodb_table);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
goto error_handling;
}
num_created = 0;
/* Create the indexes in SYS_INDEXES and load into dictionary. */
......@@ -754,7 +765,7 @@ ha_innobase::add_index(
num_created++;
}
ut_ad(!error);
ut_ad(error == DB_SUCCESS);
/* Raise version number of the table to track this table's
definition changes. */
......@@ -767,13 +778,6 @@ ha_innobase::add_index(
ut_a(trx->n_active_thrs == 0);
ut_a(UT_LIST_GET_LEN(trx->signals) == 0);
error = row_merge_lock_table(trx, innodb_table);
if (UNIV_UNLIKELY(error != DB_SUCCESS)) {
goto error_handling;
}
if (UNIV_UNLIKELY(new_primary)) {
/* A primary key is to be built. Acquire an exclusive
table lock also on the table that is being created. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment