MDEV-39440: replay context throwed a warning for a query after altering an index#5064
Open
bsrikanth-mariadb wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds a regression test for MDEV-39440 and modifies sql/opt_range.cc to move the optimizer context recording logic. A review comment correctly identifies that this change could lead to the use of uninitialized max_index_blocks and max_row_blocks variables when the row count is invalid, suggesting they be initialized to zero to prevent recording garbage data.
7b8dcc0 to
58cc38e
Compare
…ng an index The problem is that handler->multi_range_read_info_const() call in check_quick_select() returned rows equal to HA_POS_ERROR, both during context capture and replay. However, we never stored the ranges info into the context when rows=HA_POS_ERROR. However, during replay, we try to infuse stats for the given range, and since no match was found in the context, we produced a warning. Solution is to store range_info for all the ranges even when they get HA_POS_ERROR number of rows.
58cc38e to
a745b59
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.
The problem is that handler->multi_range_read_info_const() call in check_quick_select() returned rows equal to HA_POS_ERROR, both during context capture and replay. However, we never stored the ranges info into the context when rows=HA_POS_ERROR. However, during replay, we try to infuse stats for the given range, and since no match was found in the context, we produced a warning.
Solution is to store range_info for all the ranges even when they get HA_POS_ERROR number of rows.