Skip to content

Commit 292bab3

Browse files
committed
cleanup: Sp_caches::sp_caches_swap()
remove the fix for MDEV-25243. It's no longer needed, because a routine can no longer be re-parsed in the middle of a statement.
1 parent 78e474b commit 292bab3

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

sql/sql_class.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2468,13 +2468,6 @@ class Sp_caches
24682468
DBUG_ASSERT(sp_package_spec_cache == NULL);
24692469
DBUG_ASSERT(sp_package_body_cache == NULL);
24702470
}
2471-
void sp_caches_swap(Sp_caches &rhs)
2472-
{
2473-
swap_variables(sp_cache*, sp_proc_cache, rhs.sp_proc_cache);
2474-
swap_variables(sp_cache*, sp_func_cache, rhs.sp_func_cache);
2475-
swap_variables(sp_cache*, sp_package_spec_cache, rhs.sp_package_spec_cache);
2476-
swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache);
2477-
}
24782471
void sp_caches_clear();
24792472
/**
24802473
Clear content of sp related caches.

sql/sql_show.cc

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5285,30 +5285,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
52855285
uint table_open_method= tables->table_open_method;
52865286
bool can_deadlock;
52875287
MEM_ROOT tmp_mem_root;
5288-
/*
5289-
We're going to open FRM files for tables.
5290-
In case of VIEWs that contain stored function calls,
5291-
these stored functions will be parsed and put to the SP cache.
5292-
5293-
Suppose we have a view containing a stored function call:
5294-
CREATE VIEW v1 AS SELECT f1() AS c1;
5295-
and now we're running:
5296-
SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME=f1();
5297-
If a parallel thread invalidates the cache,
5298-
e.g. by creating or dropping some stored routine,
5299-
the SELECT query will re-parse f1() when processing "v1"
5300-
and replace the outdated cached version of f1() to a new one.
5301-
But the old version of f1() is referenced from the m_sp member
5302-
of the Item_func_sp instances used in the WHERE condition.
5303-
We cannot destroy it. To avoid such clashes, let's remember
5304-
all old routines into a temporary SP cache collection
5305-
and process tables with a new empty temporary SP cache collection.
5306-
Then restore to the old SP cache collection at the end.
5307-
*/
5308-
Sp_caches old_sp_caches;
5309-
5310-
old_sp_caches.sp_caches_swap(*thd);
5311-
53125288
bzero(&tmp_mem_root, sizeof(tmp_mem_root));
53135289

53145290
/*
@@ -5481,14 +5457,6 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
54815457
err:
54825458
thd->restore_backup_open_tables_state(&open_tables_state_backup);
54835459
free_root(&tmp_mem_root, 0);
5484-
5485-
/*
5486-
Now restore to the saved SP cache collection
5487-
and clear the temporary SP cache collection.
5488-
*/
5489-
old_sp_caches.sp_caches_swap(*thd);
5490-
old_sp_caches.sp_caches_clear();
5491-
54925460
DBUG_RETURN(error);
54935461
}
54945462

0 commit comments

Comments
 (0)