mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 19:11:46 +01:00
bugfix: EE_OPEN_WARNING could be statistically wrong
don't rely on imprecise my_file_opened | my_stream_opened, scan the array for open handles instead. also, remove my_print_open_files() and embed it in my_end() to have one array scan instead of two.
This commit is contained in:
parent
0322ced7e5
commit
8f47c65867
3 changed files with 21 additions and 34 deletions
|
@ -734,12 +734,6 @@ void my_create_backup_name(char *to, const char *from,
|
|||
extern int my_copystat(const char *from, const char *to, int MyFlags);
|
||||
extern char * my_filename(File fd);
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
void my_print_open_files(void);
|
||||
#else
|
||||
#define my_print_open_files()
|
||||
#endif
|
||||
|
||||
extern my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist);
|
||||
extern char *my_tmpdir(MY_TMPDIR *tmpdir);
|
||||
extern void free_tmpdir(MY_TMPDIR *tmpdir);
|
||||
|
|
|
@ -158,17 +158,33 @@ void my_end(int infoflag)
|
|||
}
|
||||
|
||||
if ((infoflag & MY_CHECK_ERROR) || print_info)
|
||||
{ /* Test if some file is left open */
|
||||
char ebuff[512];
|
||||
uint i, open_files, open_streams;
|
||||
|
||||
{ /* Test if some file is left open */
|
||||
if (my_file_opened | my_stream_opened)
|
||||
for (open_streams= open_files= i= 0 ; i < my_file_limit ; i++)
|
||||
{
|
||||
if (my_file_info[i].type == UNOPEN)
|
||||
continue;
|
||||
if (my_file_info[i].type == STREAM_BY_FOPEN ||
|
||||
my_file_info[i].type == STREAM_BY_FDOPEN)
|
||||
open_streams++;
|
||||
else
|
||||
open_files++;
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
fprintf(stderr, EE(EE_FILE_NOT_CLOSED), my_file_info[i].name, i);
|
||||
fputc('\n', stderr);
|
||||
#endif
|
||||
}
|
||||
if (open_files || open_streams)
|
||||
{
|
||||
char ebuff[512];
|
||||
my_snprintf(ebuff, sizeof(ebuff), EE(EE_OPEN_WARNING),
|
||||
my_file_opened, my_stream_opened);
|
||||
open_files, open_streams);
|
||||
my_message_stderr(EE_OPEN_WARNING, ebuff, ME_BELL);
|
||||
DBUG_PRINT("error", ("%s", ebuff));
|
||||
my_print_open_files();
|
||||
}
|
||||
|
||||
#ifdef CHECK_UNLIKELY
|
||||
end_my_likely(info_file);
|
||||
#endif
|
||||
|
|
|
@ -161,26 +161,3 @@ File my_register_filename(File fd, const char *FileName, enum file_type
|
|||
}
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef EXTRA_DEBUG
|
||||
|
||||
void my_print_open_files(void)
|
||||
{
|
||||
if (my_file_opened | my_stream_opened)
|
||||
{
|
||||
uint i;
|
||||
for (i= 0 ; i < my_file_limit ; i++)
|
||||
{
|
||||
if (my_file_info[i].type != UNOPEN)
|
||||
{
|
||||
fprintf(stderr, EE(EE_FILE_NOT_CLOSED), my_file_info[i].name, i);
|
||||
fputc('\n', stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue