MDEV-28610 : Assertion `marked_for_read()' failed upon range select with virtual column in index#5122
MDEV-28610 : Assertion `marked_for_read()' failed upon range select with virtual column in index#5122pranavktiwari wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the do_mark_index_columns function in sql/table.cc to ensure that virtual columns are registered in the read map even when the read flag is false. A review comment identifies a potential issue where this change causes the code to skip marking the write set for virtual columns, which could lead to missing updates in the storage engine. The reviewer suggested refactoring the logic to ensure virtual columns are registered in the read map without bypassing the write set marking.
| if (read || key_part[k].field->vcol_info) | ||
| key_part[k].field->register_field_in_read_map(); | ||
| else | ||
| bitmap_set_bit(bitmap, key_part[k].fieldnr-1); |
There was a problem hiding this comment.
The current implementation skips marking the field in the bitmap (which corresponds to the write set when read is false) if the field is a virtual column. This occurs because the else block is bypassed when key_part[k].field->vcol_info is true. For stored virtual columns that are part of an index, this could lead to missing updates in the storage engine during write operations, as the engine might not be notified that these columns need to be updated. It is recommended to ensure that virtual columns are always registered in the read map without affecting the logic for the write set marking.
if (read || key_part[k].field->vcol_info)
key_part[k].field->register_field_in_read_map();
if (!read)
bitmap_set_bit(bitmap, key_part[k].fieldnr-1);
No description provided.