mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
REPLACE into a system-versioned table turns the conflicting row into history in TABLE::delete_row(): it saves the new row into record[2], restores the conflicting row from record[1] and sets its row_end with vers_update_end(). The VCOL_UPDATE_FOR_WRITE computation in vers_update_end() also recomputes stored generated columns. When Field_blob::store() copies the value into Field_blob::value (e.g. on a character set conversion), it overwrote the buffer that the stored generated blob of the new row in record[2] points to, and the new row was written with the value of the history row. The index on the column holds the same value, so CHECK TABLE does not detect it. remember_blob_values(), which keeps Field_blob::value around vers_update_end() in TABLE::delete_row() and vers_insert_history_row() and around update_generated_fields() in period_make_insert(), covered only virtual columns. The fix adds the with_stored parameter to remember_blob_values(), restore_blob_values() and free_blob_values(), which also covers stored generated blob columns. TABLE::delete_row(), vers_insert_history_row() and period_make_insert() use it and size the storage by TABLE_SHARE::virtual_fields, the number of all generated columns.
186 KiB
186 KiB