1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Backport of:

------------------------------------------------------------
revno: 2617.68.24
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-next-bg-pre2-2
timestamp: Wed 2009-09-16 17:25:29 +0400
message:
  Pre-requisite patch for fixing bug #30977 "Concurrent statement
  using stored function and DROP FUNCTION breaks SBR".

  Added MDL_request for stored routine as member to Sroutine_hash_entry
  in order to be able perform metadata locking for stored routines in
  future (Sroutine_hash_entry is an equivalent of TABLE_LIST class for
  stored routines).
(WL#4284, follow up fixes).
This commit is contained in:
Konstantin Osipov
2009-12-09 19:11:26 +03:00
parent 10db8e79c5
commit 4f85df4b95
8 changed files with 109 additions and 105 deletions

View File

@ -3777,17 +3777,18 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx,
Prelocking_strategy *prelocking_strategy,
bool *need_prelocking)
{
int type= rt->key.str[0];
DBUG_ENTER("open_and_process_routine");
switch (type)
switch (rt->mdl_request.key.mdl_namespace())
{
case TYPE_ENUM_FUNCTION:
case TYPE_ENUM_PROCEDURE:
case MDL_FUNCTION:
case MDL_PROCEDURE:
{
sp_name name(thd, rt->key.str, rt->key.length);
char qname_buff[NAME_LEN*2+1+1];
sp_name name(&rt->mdl_request.key, qname_buff);
sp_head *sp;
int type= (rt->mdl_request.key.mdl_namespace() == MDL_FUNCTION) ?
TYPE_ENUM_FUNCTION : TYPE_ENUM_PROCEDURE;
if (sp_cache_routine(thd, type, &name, &sp))
DBUG_RETURN(TRUE);
@ -3799,7 +3800,7 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx,
}
}
break;
case TYPE_ENUM_TRIGGER:
case MDL_TRIGGER:
break;
default:
/* Impossible type value. */
@ -4304,7 +4305,7 @@ handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
*/
if (rt != (Sroutine_hash_entry*)prelocking_ctx->sroutines_list.first ||
rt->key.str[0] != TYPE_ENUM_PROCEDURE)
rt->mdl_request.key.mdl_namespace() != MDL_PROCEDURE)
{
*need_prelocking= TRUE;
sp_update_stmt_used_routines(thd, prelocking_ctx, &sp->m_sroutines,
@ -8302,7 +8303,7 @@ tdc_wait_for_old_versions(THD *thd, MDL_request_list *mdl_requests)
while ((mdl_request= it++))
{
if ((share= get_cached_table_share(mdl_request->key.db_name(),
mdl_request->key.table_name())) &&
mdl_request->key.name())) &&
share->version != refresh_version &&
!share->used_tables.is_empty())
break;