Commit f7ebdaef authored by Kristofer Pettersson's avatar Kristofer Pettersson

Bug#34895 'show procedure status' or 'show function status' +

          'flush tables' crashes

The server crashes when 'show procedure status' and 'flush tables' are
run concurrently.

This is caused by the way mysql.proc table is added twice to the list
of table to lock although the requirements on the current locking API
assumes differently.

No test case is submitted because of the nature of the crash which is 
currently difficult to reproduce in a deterministic way.

This is a backport from 5.1
parent 869c0112
...@@ -171,7 +171,7 @@ my_bool check_table_is_closed(const char *name, const char *where) ...@@ -171,7 +171,7 @@ my_bool check_table_is_closed(const char *name, const char *where)
char filename[FN_REFLEN]; char filename[FN_REFLEN];
LIST *pos; LIST *pos;
DBUG_ENTER("check_table_is_closed"); DBUG_ENTER("check_table_is_closed");
pthread_mutex_lock(&THR_LOCK_myisam);
(void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32); (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32);
for (pos=myisam_open_list ; pos ; pos=pos->next) for (pos=myisam_open_list ; pos ; pos=pos->next)
{ {
...@@ -181,12 +181,14 @@ my_bool check_table_is_closed(const char *name, const char *where) ...@@ -181,12 +181,14 @@ my_bool check_table_is_closed(const char *name, const char *where)
{ {
if (share->last_version) if (share->last_version)
{ {
fprintf(stderr,"Warning: Table: %s is open on %s\n", name,where); fprintf(stderr,"Warning: Table: %s is open on %s\n", name,where);
DBUG_PRINT("warning",("Table: %s is open on %s", name,where)); DBUG_PRINT("warning",("Table: %s is open on %s", name,where));
DBUG_RETURN(1); pthread_mutex_unlock(&THR_LOCK_myisam);
DBUG_RETURN(1);
} }
} }
} }
pthread_mutex_unlock(&THR_LOCK_myisam);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
...@@ -8276,8 +8276,6 @@ show_param: ...@@ -8276,8 +8276,6 @@ show_param:
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC; lex->orig_sql_command= SQLCOM_SHOW_STATUS_PROC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
...@@ -8286,8 +8284,6 @@ show_param: ...@@ -8286,8 +8284,6 @@ show_param:
LEX *lex= Lex; LEX *lex= Lex;
lex->sql_command= SQLCOM_SELECT; lex->sql_command= SQLCOM_SELECT;
lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC; lex->orig_sql_command= SQLCOM_SHOW_STATUS_FUNC;
if (!sp_add_to_query_tables(YYTHD, lex, "mysql", "proc", TL_READ))
MYSQL_YYABORT;
if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES)) if (prepare_schema_table(YYTHD, lex, 0, SCH_PROCEDURES))
MYSQL_YYABORT; MYSQL_YYABORT;
} }
......
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