• Oleksandr Byelkin's avatar
    MDEV-8087: Server crashed in Time_and_counter_tracker::incr_loops · 92271c78
    Oleksandr Byelkin authored
    Problem:
    Procedure which uses stack of views first executed without most deep view.
    It fails but one view cached (as well as whole procedure).
    Then simultaniusely create the second view we lack and execute the procedure.
    In the beginning of procedure execution the view is not yet created so
    procedure used as it was cached (cache was not invalidated).
    But by the time we are trying to use most deep view it is already created.
    The problem with the view is that thd->select_number (first view was not parsed) so second view will get the same number.
    
    The fix is in keeping the thd->select_number correct even if we use cached views.
    In the proposed solution (to keep it simple) counter can be bigger then should but it should not create problem because numbers are still unique and situation is very rare.
    92271c78
sql_lex.h 92.7 KB