Commit 99f97f8c 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 582c74c5
......@@ -737,6 +737,17 @@ err_exit:
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 @@ err_exit:
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 @@ err_exit:
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