[t:4695], call restore_add_index in final_add_index all the time

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@41785 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Zardosht Kasheff 2012-04-12 02:09:44 +00:00 committed by Yoni Fogel
parent 68df4116a7
commit 42958dceb4

View file

@ -7763,9 +7763,14 @@ int ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
DBUG_EXECUTE_IF("final_add_index_fail", {
error = 1;
});
if (!commit || error) {
restore_add_index(table, num_of_keys, incremented_numDBs, modified_DBs);
}
// at this point, the metadata lock ensures that the
// newly created indexes cannot be modified,
// regardless of whether the add index was hot.
// Because a subsequent drop index may cause an
// error requireing us to abort the transaction,
// we prematurely close the added indexes, regardless
// of whether we are committing or aborting.
restore_add_index(table, num_of_keys, incremented_numDBs, modified_DBs);
// transaction does not need to be committed,
// we depend on MySQL to rollback the transaction
// by calling tokudb_rollback