-
Debarun Banerjee authored
Problem : --------- If "ALTER TABLE ADD UNIQUE index" operation fails, the command adds the new index in dict_table_t in "Prepare" stage and attempts to remove the index in "Rollback" stage. We prevent the removal if any concurrent operation is going on the table. This is done by checking if dict_table_t is referenced by other objects (n_ref_count > 1). In 5.7 partitioned table, we keep the dict_table_t objects for the partitions in shared place and for multiple TABLE objects, referred by concurrent operations, we keep only one reference for dict_table_t object (n_ref_count = 1). It causes the ALTER TABLE to remove the index entry and concurrent INSERT hits the ASSERT as ins_node_t::entry_list count doesn't match the number of indexes in dict_table_t. Solution : ---------- Increment already cached dict_table_t reference count for all the partitions during ha_innopart handler initialization. a. New dictionary interface to increase and decrease reference count for already cached dict_cache_t element. dict_table_t::acquire dict_table_t::release b. Acquire [dict_sys->mutex] during ope/close ha_innopart handler and increase/decrease dict_table_t reference count for all partitions. Ha_innopart_share::open_table_parts Ha_innopart_share::close_table_part Reviewed-by:
Marko Makela <marko.makela@oracle.com> Reviewed-by:
Mattias Jonsson <mattias.jonsson@oracle.com> RB: 8463
Debarun Banerjee authoredProblem : --------- If "ALTER TABLE ADD UNIQUE index" operation fails, the command adds the new index in dict_table_t in "Prepare" stage and attempts to remove the index in "Rollback" stage. We prevent the removal if any concurrent operation is going on the table. This is done by checking if dict_table_t is referenced by other objects (n_ref_count > 1). In 5.7 partitioned table, we keep the dict_table_t objects for the partitions in shared place and for multiple TABLE objects, referred by concurrent operations, we keep only one reference for dict_table_t object (n_ref_count = 1). It causes the ALTER TABLE to remove the index entry and concurrent INSERT hits the ASSERT as ins_node_t::entry_list count doesn't match the number of indexes in dict_table_t. Solution : ---------- Increment already cached dict_table_t reference count for all the partitions during ha_innopart handler initialization. a. New dictionary interface to increase and decrease reference count for already cached dict_cache_t element. dict_table_t::acquire dict_table_t::release b. Acquire [dict_sys->mutex] during ope/close ha_innopart handler and increase/decrease dict_table_t reference count for all partitions. Ha_innopart_share::open_table_parts Ha_innopart_share::close_table_part Reviewed-by:
Marko Makela <marko.makela@oracle.com> Reviewed-by:
Mattias Jonsson <mattias.jonsson@oracle.com> RB: 8463
Loading