mariadb/storage/innobase/row
Thirunarayanan Balathandayuthapani cf2c6b7f8d MDEV-24971 InnoDB access freed virtual column after rollback of secondary index
Problem:
========
 InnoDB fails to clean the index stub if it fails to add the
virtual index which contains new virtual column. But it clears
the newly virtual column from index in clear_added_indexes()
during inplace_alter_table. On commit, InnoDB evicts and
reload the table. In case of rollback, it doesn't happen.
InnoDB clears the ABORTED index while opening the table
or doing the DDL. In the mean time, InnoDB can access
the dropped virtual index columns while creating prebuilt
or rollback of concurrent DML.

Solution:
==========
(1) InnoDB should maintain newly added virtual column while
rollbacking the newly added virtual index.
(2) InnoDB must not defer the index removal
if the alter table is executed with LOCK=EXCLUSIVE.
(3) For LOCK=SHARED, InnoDB should check whether the table
has any other transaction lock other than alter transaction
before deferring the index stub.

Replaced has_new_v_col with dict_add_vcol_info in dict_index_t to
indicate whether the index has any new virtual column.

dict_index_t::has_new_v_col(): Returns whether the index has
newly added virtual column, it doesn't say which columns are
newly added virtual column

ha_innobase_inplace_ctx::is_new_vcol(): Return whether the
given column is added as a part of the current alter.

ha_innobase_inplace_ctx::clean_new_vcol_index(): Copy the newly
added virtual column to new_vcol_info in dict_index_t. Replace
the column in the index fields with virtual column stored
in new_vcol_info.

dict_index_t::assign_new_v_col(): Store the number of virtual
column added in index as a part of alter table.

dict_index_t::get_n_new_vcol(): Get the number of newly added
virtual column

dict_index_t::assign_drop_v_col(): Allocate the memory for
adding new virtual column in new_vcol_info.

dict_index_t::add_drop_v_col(): Add the newly added virtual
column in new_vcol_info.

dict_table_t::has_lock_for_other_trx(): Whether the table has
any other transaction lock than given transaction.

row_merge_drop_indexes(): Add parameter alter_trx and check
whether the table has any other lock than alter transaction.
2021-04-12 16:06:06 +05:30
..
row0ext.cc MDEV-20377: Make WITH_MSAN more usable 2020-07-01 17:23:00 +03:00
row0ftsort.cc BtrBulk::table_name(): Return the table name while displaying 2021-04-09 17:38:21 +05:30
row0import.cc MDEV-15527 page_compressed compressed page partially during import tablespace 2021-03-30 20:34:39 +05:30
row0ins.cc MDEV-24041 Generated column DELETE with FOREIGN KEY crash InnoDB 2020-12-18 20:17:45 +10:00
row0log.cc Cleanup: row_log_free() 2020-11-25 10:54:38 +02:00
row0merge.cc MDEV-24971 InnoDB access freed virtual column after rollback of secondary index 2021-04-12 16:06:06 +05:30
row0mysql.cc fixup 58b56f14a0: Remove dead code 2021-03-04 18:11:25 +02:00
row0purge.cc MDEV-24971 InnoDB access freed virtual column after rollback of secondary index 2021-04-12 16:06:06 +05:30
row0quiesce.cc Merge 10.1 into 10.2 2019-05-13 17:54:04 +03:00
row0row.cc MDEV-21595: innodb offset_t rename to rec_offs 2020-04-29 12:02:47 +03:00
row0sel.cc fixup 58b56f14a0: Remove dead code 2021-03-04 18:11:25 +02:00
row0trunc.cc MDEV-23475 InnoDB performance regression for write-heavy workloads 2020-08-19 11:18:56 +03:00
row0uins.cc MDEV-23991 dict_table_stats_lock() has unnecessarily long scope 2020-10-27 19:09:20 +03:00
row0umod.cc Revert MDEV-23484 Rollback unnecessarily acquires dict_operation_lock 2020-10-20 19:55:16 +03:00
row0undo.cc Revert MDEV-23484 Rollback unnecessarily acquires dict_operation_lock 2020-10-20 19:55:16 +03:00
row0upd.cc MDEV-24786: row_upd_clust_step() skips mtr_t::commit() on virtual column error 2021-03-26 14:12:39 +02:00
row0vers.cc MDEV-20618 Assertion failed in row_upd_sec_index_entry 2020-09-01 18:27:09 +10:00