diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2021-09-29 20:40:00 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2021-09-29 20:40:52 +0200 |
commit | 333d6c30f87a7862a2d6ca379c49e2ea46451ebc (patch) | |
tree | 2970f35cdb3ca97fb3954257e08ea84fc560c92c | |
parent | f3bc4f49f7c02018cac2c721837f9d1f52e9fff0 (diff) | |
download | mariadb-git-333d6c30f87a7862a2d6ca379c49e2ea46451ebc.tar.gz |
MDEV-20699 followup.
Normally we disable caching of routines in "SHOW CREATE".
Introduce an exception, if debug_dbug="+d,cache_sp_in_show_create".
lock_sync.test needs a way to populate the cache without side effects,
or else it runs into debug_sync timeouts.
So, this possibility to cache will be remain only for very special tests.
-rw-r--r-- | mysql-test/main/lock_sync.result | 3 | ||||
-rw-r--r-- | mysql-test/main/lock_sync.test | 3 | ||||
-rw-r--r-- | sql/sp.cc | 8 |
3 files changed, 14 insertions, 0 deletions
diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result index d017cf90cb8..55ceaedd04f 100644 --- a/mysql-test/main/lock_sync.result +++ b/mysql-test/main/lock_sync.result @@ -205,6 +205,8 @@ end| # called below. # connection con1; +set @save_dbug=@@debug_dbug; +set debug_dbug="+d,cache_sp_in_show_create"; # Cache all functions used in the tests below so statements # calling them won't need to open and lock mysql.proc table # and we can assume that each statement locks its tables @@ -229,6 +231,7 @@ show create function f14; show create function f15; show create function f16; show create function f17; +set debug_dbug=@save_dbug; connection default; # # 1. Statements that read tables and do not use subqueries. diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test index af8435f7fbb..b576f211792 100644 --- a/mysql-test/main/lock_sync.test +++ b/mysql-test/main/lock_sync.test @@ -232,6 +232,8 @@ let $con_aux2= con2; let $table= t1; connection con1; +set @save_dbug=@@debug_dbug; +set debug_dbug="+d,cache_sp_in_show_create"; --echo # Cache all functions used in the tests below so statements --echo # calling them won't need to open and lock mysql.proc table --echo # and we can assume that each statement locks its tables @@ -257,6 +259,7 @@ show create function f14; show create function f15; show create function f16; show create function f17; +set debug_dbug=@save_dbug; --enable_result_log connection default; diff --git a/sql/sp.cc b/sql/sp.cc index fdfd9a79fef..8bf3c450941 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -1903,6 +1903,14 @@ Sp_handler::sp_show_create_routine(THD *thd, of the binary log or the query cache, which currently it does not. */ sp_head *sp= 0; + + DBUG_EXECUTE_IF("cache_sp_in_show_create", + /* Some tests need just need a way to cache SP without other side-effects.*/ + sp_cache_routine(thd, name, false, &sp); + sp->show_create_routine(thd, this); + DBUG_RETURN(false); + ); + bool free_sp= db_find_routine(thd, name, &sp) == SP_OK; bool ret= !sp || sp->show_create_routine(thd, this); if (ret) |