summaryrefslogtreecommitdiff
path: root/mysys/my_sync.c
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-04-05 13:17:49 +0200
committerunknown <serg@serg.mylan>2005-04-05 13:17:49 +0200
commitcd0a50bf34477bf547cc4a66f0d5d9651574a65b (patch)
treea9dd96a05ad4e0e84d0b4f7711b882492d5ea59d /mysys/my_sync.c
parent5dbcb1555fb63618be171b478a1af8a49b3b46ef (diff)
downloadmariadb-git-cd0a50bf34477bf547cc4a66f0d5d9651574a65b.tar.gz
remove the rest of isam/merge references
fix a race condition in TC_LOG_BINLOG::unlog include/Makefile.am: remove the rest of isam/merge references include/config-win.h: unused and abused macro removed include/my_pthread.h: unused and abused macro removed include/my_sys.h: MY_IGNORE_BADFD flag include/mysql_embed.h: remove the rest of isam/merge references mysql-test/r/replace.result: remove the rest of isam/merge references mysql-test/t/replace.test: remove the rest of isam/merge references mysql-test/t/xa.test: comment mysys/my_sync.c: MY_IGNORE_BADFD flag sql/handler.cc: remove the rest of isam/merge references sql/log.cc: fix a race condition in TC_LOG_BINLOG::unlog preparation for binlog group commit sql/mysql_priv.h: remove duplicates sql/mysqld.cc: remove the rest of isam/merge references sql/opt_range.cc: remove the rest of isam/merge references sql/set_var.cc: hide unused variables. simplify sync_binlog code sql/sql_base.cc: remove the rest of isam/merge references sql/sql_class.h: cleanup
Diffstat (limited to 'mysys/my_sync.c')
-rw-r--r--mysys/my_sync.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/mysys/my_sync.c b/mysys/my_sync.c
index bd372f03c87..bfaf09ce402 100644
--- a/mysys/my_sync.c
+++ b/mysys/my_sync.c
@@ -27,7 +27,14 @@
my_flags Flags (now only MY_WME is supported)
NOTE
- If file system supports its, only file data is synced, not inode date
+ If file system supports its, only file data is synced, not inode data.
+
+ MY_IGNORE_BADFD is useful when fd is "volatile" - not protected by a
+ mutex. In this case by the time of fsync(), fd may be already closed by
+ another thread, or even reassigned to a different file. With this flag -
+ MY_IGNORE_BADFD - such a situation will not be considered an error.
+ (which is correct behaviour, if we know that the other thread synced the
+ file before closing)
RETURN
0 ok
@@ -55,10 +62,15 @@ int my_sync(File fd, myf my_flags)
if (res)
{
- if (!(my_errno= errno))
- my_errno= -1; /* Unknown error */
- if (my_flags & MY_WME)
+ int er= errno;
+ if (!(my_errno= er))
+ my_errno= -1; /* Unknown error */
+ if (my_flags & MY_IGNORE_BADFD &&
+ (er == EBADF || er == EINVAL || er == EROFS))
+ res= 0;
+ else if (my_flags & MY_WME)
my_error(EE_SYNC, MYF(ME_BELL+ME_WAITTANG), my_filename(fd), my_errno);
}
DBUG_RETURN(res);
-} /* my_read */
+} /* my_sync */
+