summaryrefslogtreecommitdiff
path: root/mysys/my_open.c
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-09-02 01:22:34 +0300
committerMichael Widenius <monty@askmonty.org>2011-09-02 01:22:34 +0300
commit31c8c95bb204e74431412d07970a8133a352984f (patch)
treed426921a646bd54f2ec862ff67f8d3c70a87b99c /mysys/my_open.c
parent4692537f608bb69e8d02c4b102b4fb888f7bec12 (diff)
downloadmariadb-git-31c8c95bb204e74431412d07970a8133a352984f.tar.gz
Added logging of all errors from my_read/my_write/my_pread/my_pwrite/my_open & my_malloc to mysqld error log if one sets log-warning to 10 or 11
The idea is that my_global_flags is ored to the MyFlags parameter for the above functions if the MY_WME flag is not set. As the my_global_flags has ME_JUST_INFO (mark error as 'note') and possible ME_NOREFRESH (write error to log) this will force mysqld to log the not critical error to the log as a note. include/my_sys.h: Moved MY_SYNC_DIR to ensure it never clashes with ME_JUST_INFO Added my_global_flags mysql-test/Makefile.am: Removed not used bugs directory mysys/my_init.c: Added my_global_flags, a variable that is ored to MyFlags in a those mysys functions we want extra logging. mysys/my_malloc.c: Added support for my_global_flags mysys/my_open.c: Added support for my_global_flags mysys/my_pread.c: Added support for my_global_flags mysys/my_read.c: Added support for my_global_flags mysys/my_static.c: Added my_global_flags mysys/my_write.c: Added support for my_global_flags sql/mysqld.cc: Set my_global_flags for warning levels 10 & 11 sql/sql_base.cc: Don't increment unhandled errors for notes or warnings.
Diffstat (limited to 'mysys/my_open.c')
-rw-r--r--mysys/my_open.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/mysys/my_open.c b/mysys/my_open.c
index fe7f65c450b..3980e3a9a77 100644
--- a/mysys/my_open.c
+++ b/mysys/my_open.c
@@ -43,6 +43,9 @@ File my_open(const char *FileName, int Flags, myf MyFlags)
DBUG_ENTER("my_open");
DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %d",
FileName, Flags, MyFlags));
+ if (!(MyFlags & (MY_WME | MY_FAE | MY_FFNF)))
+ MyFlags|= my_global_flags;
+
#if defined(__WIN__)
/*
Check that we don't try to open or create a file name that may
@@ -92,6 +95,8 @@ int my_close(File fd, myf MyFlags)
int err;
DBUG_ENTER("my_close");
DBUG_PRINT("my",("fd: %d MyFlags: %d",fd, MyFlags));
+ if (!(MyFlags & (MY_WME | MY_FAE)))
+ MyFlags|= my_global_flags;
pthread_mutex_lock(&THR_LOCK_open);
do
@@ -104,7 +109,8 @@ int my_close(File fd, myf MyFlags)
DBUG_PRINT("error",("Got error %d on close",err));
my_errno=errno;
if (MyFlags & (MY_FAE | MY_WME))
- my_error(EE_BADCLOSE, MYF(ME_BELL+ME_WAITTANG),my_filename(fd),errno);
+ my_error(EE_BADCLOSE, MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
+ my_filename(fd),errno);
}
if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN)
{
@@ -180,8 +186,8 @@ File my_register_filename(File fd, const char *FileName, enum file_type
{
if (my_errno == EMFILE)
error_message_number= EE_OUT_OF_FILERESOURCES;
- DBUG_PRINT("error",("print err: %d",error_message_number));
- my_error(error_message_number, MYF(ME_BELL+ME_WAITTANG),
+ my_error(error_message_number,
+ MYF(ME_BELL | ME_WAITTANG | (MyFlags & (ME_JUST_INFO | ME_NOREFRESH))),
FileName, my_errno);
}
DBUG_RETURN(-1);