mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
Reason: ======= Following the changes in MDEV-38734, the server no longer marks all indexed virtual columns during an UPDATE operation. Consequently, ha_innobase::update() populates the upd_t vector with old_vrow but omits the actual data for these virtual columns. Despite this omission, trx_undo_page_report_modify() continues to write metadata for indexed virtual columns into the undo log. Because the actual values are missing from the update vector, the undo log entry is recorded without the historical data for these columns. When the purge thread processes the undo log to reconstruct a previous record state for MVCC, it identifies an indexed virtual column but finds no associated data. The purge thread incorrectly interprets this missing data as a NULL value, rather than a "missing/unrecorded" value. The historical record is reconstructed with an incorrect NULL for the virtual column. This causes the purge thread to incorrectly identify and purge records that are not actually delete-marked, leading to abort of server. Solution: ========= ha_innobase::column_bitmaps_signal(): Revert the column-marking logic to the state prior to commita4e4a56720, ensuring all indexed virtual columns are unconditionally marked during an UPDATE. The previous "optimization" attempted to manually detect indexed column changes before marking virtual columns. The manual check for indexed column modifications is redundant. InnoDB already provides the UPD_NODE_NO_ORD_CHANGE flag within row_upd_step(). This flag is being used in trx_undo_page_report_modify() and trx_undo_read_undo_rec() should log or read virtual column values. Refactored column_bitmaps_signal() to accept a mark_for_update parameter that controls when indexed virtual columns are marked. TABLE::mark_columns_needed_for_update() is the only place that needs mark_for_update=true because only UPDATE operations need to mark indexed virtual columns for InnoDB's undo logging mechanism. INSERT operation is already handled by TABLE::mark_virtual_columns_for_write(insert_fl=true). Even the commita4e4a56720changes are going to affect TABLE::mark_virtual_column_for_write(false) and It is called during UPDATE operation, and that's when column_bitmaps_signal() needs to mark indexed virtual columns. Online DDL has separate code path which is handled by row_log_mark_virtual_cols() for all DML operations
32 KiB
32 KiB