mirror of
https://github.com/MariaDB/server.git
synced 2025-01-21 06:22:28 +01:00
branches/zip: ha_innobase::final_drop_index(): Allocate a separate transaction
for dropping the index trees, and set the dictionary operation flag, similar to what ha_innobase::add_index() does. This should ensure correct crash recovery.
This commit is contained in:
parent
27f7818005
commit
d5c04aae8e
2 changed files with 26 additions and 10 deletions
|
@ -651,6 +651,8 @@ ha_innobase::add_index(
|
|||
possible adaptive hash latch to avoid deadlocks of threads. */
|
||||
trx_search_latch_release_if_reserved(prebuilt->trx);
|
||||
|
||||
/* Create a background transaction for the operations on
|
||||
the data dictionary tables. */
|
||||
trx = trx_allocate_for_mysql();
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
|
@ -1084,12 +1086,25 @@ ha_innobase::final_drop_index(
|
|||
update_thd();
|
||||
|
||||
trx_search_latch_release_if_reserved(prebuilt->trx);
|
||||
trx = prebuilt->trx;
|
||||
|
||||
/* Create a background transaction for the operations on
|
||||
the data dictionary tables. */
|
||||
trx = trx_allocate_for_mysql();
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
trans_register_ha(user_thd, FALSE, ht);
|
||||
|
||||
trx->mysql_thd = user_thd;
|
||||
trx->mysql_query_str = thd_query(user_thd);
|
||||
|
||||
/* Drop indexes marked to be dropped */
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
/* Flag this transaction as a dictionary operation, so that
|
||||
the data dictionary will be locked in crash recovery. */
|
||||
trx_set_dict_operation(trx, TRX_DICT_OP_INDEX);
|
||||
|
||||
index = dict_table_get_first_index(prebuilt->table);
|
||||
|
||||
while (index) {
|
||||
|
@ -1111,6 +1126,7 @@ ha_innobase::final_drop_index(
|
|||
dict_table_check_for_dup_indexes(prebuilt->table);
|
||||
#endif
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
/* Flush the log to reduce probability that the .frm files and
|
||||
|
@ -1119,12 +1135,12 @@ ha_innobase::final_drop_index(
|
|||
|
||||
log_buffer_flush_to_disk();
|
||||
|
||||
trx_free_for_mysql(trx);
|
||||
|
||||
/* Tell the InnoDB server that there might be work for
|
||||
utility threads: */
|
||||
|
||||
srv_active_wake_master_thread();
|
||||
|
||||
trx_commit_for_mysql(trx);
|
||||
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
|
@ -366,14 +366,14 @@ enum trx_dict_op {
|
|||
recovery. This and TRX_DICT_OP_NONE are the only possible
|
||||
operation modes in crash recovery. */
|
||||
TRX_DICT_OP_TABLE = 1,
|
||||
/** The transaction is creating an index in an existing table,
|
||||
In crash recovery, the the data dictionary must be locked, but
|
||||
the table must not be dropped. */
|
||||
/** The transaction is creating or dropping an index in an
|
||||
existing table. In crash recovery, the the data dictionary
|
||||
must be locked, but the table must not be dropped. */
|
||||
TRX_DICT_OP_INDEX = 2,
|
||||
/** The transaction is creating an index in an existing table,
|
||||
In crash recovery, the the data dictionary must be locked, but
|
||||
the table must not be dropped. A lock wait timeout is allowed
|
||||
to occur. */
|
||||
/** The transaction is creating or dropping an index in an
|
||||
existing table. In crash recovery, the the data dictionary
|
||||
must be locked, but the table must not be dropped. A lock
|
||||
wait timeout is allowed to occur. */
|
||||
TRX_DICT_OP_INDEX_MAY_WAIT = 3
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue