MDEV-36896 - Assertion `marked_for_read()' failed in virtual String *Field_varstring::val_str(String *, String *)#5158
Open
pranavktiwari wants to merge 1 commit into
Open
MDEV-36896 - Assertion `marked_for_read()' failed in virtual String *Field_varstring::val_str(String *, String *)#5158pranavktiwari 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 comments out the column_bitmaps_set call in sql/filesort.cc to address an assertion failure. However, the reviewer notes that this is incorrect because it bypasses the temporary read map optimization and pollutes the original read set. The recommended approach is to identify the missing field and ensure it is properly registered instead of disabling the bitmap switch.
…Field_varstring::val_str(String *, String *) update_virtual_field() uses tmp_set only as an accumulator during dependency traversal. The walk itself sets all required bits for the current virtual-column evaluation. Clearing tmp_set beforehand is not required to discover the current dependencies, but it does remove previously established bits. Since find_all_keys() aliases tmp_set as both read_set and write_set, clearing tmp_set also clears the active column maps. Replacing tmp_set with an independent bitmap or avoiding the clear eliminates the issue and all regression tests continue to pass.
834f750 to
5b140dc
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-36896
Problem:
Executing queries that require virtual/generated column evaluation during filesort trigger sdebug assertions due to missing columns in read_set.
Cause:
find_all_keys() temporarily assigns TABLE::tmp_set as both read_set and write_set. Later, TABLE::update_virtual_field() clears tmp_set before evaluating virtual column dependencies.
Since all three pointers reference the same bitmap, clearing tmp_set also clears the active column maps, causing required columns to be missing during execution.
Fix:
Remove the bitmap_clear_all(&tmp_set) call from TABLE::update_virtual_field(). The dependency walk populates the required bits for virtual column evaluation, and clearing the shared bitmap can unintentionally invalidate the active read_set/write_set.