Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-32575 MSAN / Valgrind errors in test_if_cheaper_ordering upon re… #3762

Open
wants to merge 1 commit into
base: 11.4
Choose a base branch
from

Conversation

Olernov
Copy link
Contributor

@Olernov Olernov commented Jan 14, 2025

…aching in_predicate_conversion_threshold

  • The Jira issue number for this PR is: MDEV-32575

Description

When converting an IN-list to a subquery, a temporary table stores the IN-list values and participates in join optimization. The problem is the bitmap of usable keys for the temporary table is initialized after the optimization phase, during execution. It happens when the table is opened via ha_heap::open(), after the subroutine set_keys_for_scanning() is called. Trying to access the bitmap earlier, during optimization, leads to MSAN/Valgrind errors.

This fix removes the dependency on set_keys_for_scanning(). The key bitmap is now dynamically composed on demand in keys_to_use_for_scanning(), ensuring correctness without imposing strict call-order constraints.

Release Notes

When converting a large IN-list of values to a subquery there was a chance that optimizer accessed an uninitialized bitmap of indexes which could lead to wrong results or a crash

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

…aching in_predicate_conversion_threshold

When converting an IN-list to a subquery, a temporary table stores the IN-list
values and participates in join optimization. The problem is the bitmap
of usable keys for the temporary table is initialized after the optimization
phase, during execution. It happens when the table is opened
via `ha_heap::open()`, after the subroutine `set_keys_for_scanning()`
is called. Trying to access the bitmap earlier, during optimization, leads
to MSAN/Valgrind errors.

This fix removes the dependency on `set_keys_for_scanning()`. The key bitmap
is now dynamically composed on demand in `keys_to_use_for_scanning()`,
ensuring correctness without imposing strict call-order constraints.
@Olernov Olernov requested a review from sanja-byelkin January 14, 2025 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant