diff options
Diffstat (limited to 'innobase/row/row0purge.c')
-rw-r--r-- | innobase/row/row0purge.c | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/innobase/row/row0purge.c b/innobase/row/row0purge.c index 3d9ae6aad8b..b64003f22d4 100644 --- a/innobase/row/row0purge.c +++ b/innobase/row/row0purge.c @@ -24,6 +24,7 @@ Created 3/14/1997 Heikki Tuuri #include "row0row.h" #include "row0upd.h" #include "row0vers.h" +#include "row0mysql.h" #include "log0log.h" /************************************************************************ @@ -454,8 +455,8 @@ ibool row_purge_parse_undo_rec( /*=====================*/ /* out: TRUE if purge operation required: - NOTE that then the CALLER must s-unlock - dict_operation_lock! */ + NOTE that then the CALLER must unfreeze + data dictionary! */ purge_node_t* node, /* in: row undo node */ ibool* updated_extern, /* out: TRUE if an externally stored field @@ -464,6 +465,7 @@ row_purge_parse_undo_rec( { dict_index_t* clust_index; byte* ptr; + trx_t* trx; dulint undo_no; dulint table_id; dulint trx_id; @@ -473,6 +475,8 @@ row_purge_parse_undo_rec( ulint cmpl_info; ut_ad(node && thr); + + trx = thr_get_trx(thr); ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info, updated_extern, &undo_no, &table_id); @@ -498,17 +502,18 @@ row_purge_parse_undo_rec( /* Prevent DROP TABLE etc. from running when we are doing the purge for this row */ - rw_lock_s_lock(&dict_operation_lock); - mutex_enter(&(dict_sys->mutex)); + row_mysql_freeze_data_dictionary(trx); - node->table = dict_table_get_on_id_low(table_id, thr_get_trx(thr)); + mutex_enter(&(dict_sys->mutex)); - mutex_exit(&(dict_sys->mutex)); + node->table = dict_table_get_on_id_low(table_id, thr_get_trx(thr)); + mutex_exit(&(dict_sys->mutex)); + if (node->table == NULL) { /* The table has been dropped: no need to do purge */ - rw_lock_s_unlock(&dict_operation_lock); + row_mysql_unfreeze_data_dictionary(trx); return(FALSE); } @@ -518,7 +523,7 @@ row_purge_parse_undo_rec( if (clust_index == NULL) { /* The table was corrupt in the data dictionary */ - rw_lock_s_unlock(&dict_operation_lock); + row_mysql_unfreeze_data_dictionary(trx); return(FALSE); } @@ -556,9 +561,12 @@ row_purge( dulint roll_ptr; ibool purge_needed; ibool updated_extern; + trx_t* trx; ut_ad(node && thr); + trx = thr_get_trx(thr); + node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr, &(node->reservation), node->heap); @@ -577,8 +585,8 @@ row_purge( } else { purge_needed = row_purge_parse_undo_rec(node, &updated_extern, thr); - /* If purge_needed == TRUE, we must also remember to unlock - dict_operation_lock! */ + /* If purge_needed == TRUE, we must also remember to unfreeze + data dictionary! */ } if (purge_needed) { @@ -600,7 +608,7 @@ row_purge( btr_pcur_close(&(node->pcur)); } - rw_lock_s_unlock(&dict_operation_lock); + row_mysql_unfreeze_data_dictionary(trx); } /* Do some cleanup */ |