Commit eb752765 authored by Konstantin Osipov's avatar Konstantin Osipov

A fix for Bug#52432 "Crash in check_table_is_closed on an

information_schema query.
Porting a fix done for a feature tree by Ingo Struewing.
No test case since the crash only occurs under a stress
load.
parent 571acc87
...@@ -164,7 +164,19 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg, ...@@ -164,7 +164,19 @@ void _mi_print_key(FILE *stream, register HA_KEYSEG *keyseg,
} /* print_key */ } /* print_key */
#ifdef EXTRA_DEBUG #ifdef EXTRA_DEBUG
/**
Check if the named table is in the open list.
@param[in] name table path as in MYISAM_SHARE::unique_file_name
@param[in] where verbal description of caller
@retval TRUE table is in open list
@retval FALSE table is not in open list
@note This function takes THR_LOCK_myisam. Do not call it when
this mutex is locked by this thread already.
*/
my_bool check_table_is_closed(const char *name, const char *where) my_bool check_table_is_closed(const char *name, const char *where)
{ {
...@@ -173,6 +185,7 @@ my_bool check_table_is_closed(const char *name, const char *where) ...@@ -173,6 +185,7 @@ my_bool check_table_is_closed(const char *name, const char *where)
DBUG_ENTER("check_table_is_closed"); DBUG_ENTER("check_table_is_closed");
(void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32); (void) fn_format(filename,name,"",MI_NAME_IEXT,4+16+32);
mysql_mutex_lock(&THR_LOCK_myisam);
for (pos=myisam_open_list ; pos ; pos=pos->next) for (pos=myisam_open_list ; pos ; pos=pos->next)
{ {
MI_INFO *info=(MI_INFO*) pos->data; MI_INFO *info=(MI_INFO*) pos->data;
...@@ -181,12 +194,14 @@ my_bool check_table_is_closed(const char *name, const char *where) ...@@ -181,12 +194,14 @@ my_bool check_table_is_closed(const char *name, const char *where)
{ {
if (share->last_version) if (share->last_version)
{ {
mysql_mutex_unlock(&THR_LOCK_myisam);
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); DBUG_RETURN(1);
} }
} }
} }
mysql_mutex_unlock(&THR_LOCK_myisam);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
#endif /* EXTRA_DEBUG */ #endif /* EXTRA_DEBUG */
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