MDEV-28610 : Assertion `marked_for_read()' failed upon range select with virtual column in index#5122
Open
pranavktiwari wants to merge 1 commit into
Open
MDEV-28610 : Assertion `marked_for_read()' failed upon range select with virtual column in index#5122pranavktiwari wants to merge 1 commit into
pranavktiwari wants to merge 1 commit 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.
…h virtual column in index. Fix read_set propagation for virtual columns during keyread The keyread initialization path was populating using , which internally uses the non-recursive index marking path. This only marks direct index fields and does not resolve dependencies of virtual/generated columns. As a result, when a covering index contained a virtual column, its dependent base columns could be missing from , leading to assertions during virtual column evaluation. Replace the call with , which uses the recursive read-marking path and correctly propagates virtual/generated column dependencies into during keyread setup.
54fc376 to
ade25f4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fixes MDEV-28610
Problem:
Executing a range select using an index that includes virtual/generated columns
(e.g. SELECT ... WHERE c BETWEEN ... ORDER BY d) could trigger:
Assertion 'marked_for_read()' failed in Field access during execution.
Cause:
The keyread initialization path was populating table->read_set using
mark_index_columns(), which follows the non-recursive index marking path.
This only marks direct index fields and does not resolve dependencies of
virtual/generated columns.
As a result, when an index contained virtual columns, their dependent base
columns were not included in read_set, leading to invalid access during
later evaluation of virtual columns.
Fix:
Replace mark_index_columns() with mark_index_columns_for_read() in the
keyread initialization path. This ensures the recursive read-marking logic is
used, so virtual/generated column dependencies are correctly propagated into
read_set before execution.