• Dmitry Shulga's avatar
    MDEV-5816: Stored programs: validation of stored program statements · 998745d7
    Dmitry Shulga authored
    The follow-up patch to check in mtr tests that recompilation of
    a SP's instruction doesn't lead to eviction of SP from sp_cache.
    
    This patch adds the debug keyword 'check_sp_cache_not_invalidated'
    checked in sp_cache_flush_obsolete. In case this debug keyword
    is set the macros DBUG_SUICIDE() called to cause test failure.
    
    The function sp_cache_flush_obsolete() is called on opening
    a stored routine. So setting this keyword before second execution
    of some stored routine that supposed to cause recompilation of
    SP's statement will guarantee that this stored routing not evicted
    from sp_cache.
    
    Suggested approach has one limitation - the statement
     CREATE/ALTER/DROP VIEW
    forces invalidation of the whole sp_cache (by invoking the function
     sp_cache_invalidate()).
    So, for those tests (actually, there are very small number of such tests)
    that create/alter/drop a view before the second execution of some stored
    routine, the debug keyword 'check_sp_cache_not_invalidated' isn't set.
    
    The proposal to add some way a check that a stored routine is not force out
    from sp_cache on re-parsing a failing statement of a stored routine was
    done during reiew, that is the reason the proposed change has been formatted
    as a separate patch.
    998745d7
sp_validation.result 38.9 KB