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-32397, MDEV-32403 Crashes during join processing. #3176

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

Commits on May 14, 2024

  1. MDEV-32397, MDEV-32403 Crashes during join processing.

    Queries having the following form may cause a crash
      SELECT t1.a FROM ( SELECT a AS a1 FROM t1 ) dt
      JOIN t1 ON a1 LIKE EXISTS ( SELECT a + RAND () FROM t1 UNION SELECT a FROM t1);
    because the table t1 has some JOIN cleanup operations performed prematurely
    during the subselect.
    
    In this particular case, the presence of RAND() makes the subquery
    uncacheable, necessitating the need to execute the subquery multiple
    times during join record evaluation.  Each time the subquery runs, it
    creates its own JOIN structure which has references to the table t1.
    When the subquery completes, JOIN::cleanup and functions called by it
    result in ha_end_keyread() being called on table t1.  However, we are
    not done with table t1 because the upper level `select t1.a from...`
    query requires table t1 to be open.  To solve this, we make the executor
    aware of when we're in subqueries like this and delay JOIN cleanup
    until the end of the query.
    DaveGosselin-MariaDB committed May 14, 2024
    Configuration menu
    Copy the full SHA
    6b267ed View commit details
    Browse the repository at this point in the history