Commit 3a8e7698 authored by Dmitry Shulga's avatar Dmitry Shulga

DEV-5816: Stored programs: validation of stored program statements

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 routine 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.
parent 8a3c62c6
This diff is collapsed.
This diff is collapsed.
......@@ -233,6 +233,7 @@ void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp)
{
if ((*sp)->sp_cache_version() < Cversion && !(*sp)->is_invoked())
{
DBUG_EXECUTE_IF("check_sp_cache_not_invalidated", DBUG_SUICIDE(););
(*cp)->remove(*sp);
*sp= NULL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment