Commit 134b1fda authored by marko's avatar marko

Lock the data dictionary during rollback. This removes the rare

debug assertion failure ut_ad(mutex_own(&(dict_sys->mutex))) in
dict_table_get_on_id() after the rollback following crash recovery.
parent 7ae16135
...@@ -689,7 +689,8 @@ dict_table_get_on_id( ...@@ -689,7 +689,8 @@ dict_table_get_on_id(
if we are doing a rollback to handle an error in TABLE if we are doing a rollback to handle an error in TABLE
CREATE, for example, we already have the mutex! */ CREATE, for example, we already have the mutex! */
ut_ad(mutex_own(&(dict_sys->mutex))); ut_ad(mutex_own(&(dict_sys->mutex))
|| trx->dict_operation_lock_mode == RW_X_LATCH);
return(dict_table_get_on_id_low(table_id)); return(dict_table_get_on_id_low(table_id));
} }
......
...@@ -213,7 +213,7 @@ row_undo( ...@@ -213,7 +213,7 @@ row_undo(
ulint err; ulint err;
trx_t* trx; trx_t* trx;
dulint roll_ptr; dulint roll_ptr;
ibool froze_data_dict = FALSE; ibool locked_data_dict;
ut_ad(node && thr); ut_ad(node && thr);
...@@ -266,13 +266,13 @@ row_undo( ...@@ -266,13 +266,13 @@ row_undo(
/* Prevent DROP TABLE etc. while we are rolling back this row. /* Prevent DROP TABLE etc. while we are rolling back this row.
If we are doing a TABLE CREATE or some other dictionary operation, If we are doing a TABLE CREATE or some other dictionary operation,
then we already have dict_operation_lock locked in x-mode. Do not then we already have dict_operation_lock locked in x-mode. Do not
try to lock again in s-mode, because that would cause a hang. */ try to lock again, because that would cause a hang. */
if (trx->dict_operation_lock_mode == 0) { locked_data_dict = (trx->dict_operation_lock_mode == 0);
row_mysql_freeze_data_dictionary(trx); if (locked_data_dict) {
froze_data_dict = TRUE; row_mysql_lock_data_dictionary(trx);
} }
if (node->state == UNDO_NODE_INSERT) { if (node->state == UNDO_NODE_INSERT) {
...@@ -285,9 +285,9 @@ row_undo( ...@@ -285,9 +285,9 @@ row_undo(
err = row_undo_mod(node, thr); err = row_undo_mod(node, thr);
} }
if (froze_data_dict) { if (locked_data_dict) {
row_mysql_unfreeze_data_dictionary(trx); row_mysql_unlock_data_dictionary(trx);
} }
/* Do some cleanup */ /* Do some cleanup */
......
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