diff options
author | unknown <heikki@hundin.mysql.fi> | 2005-01-06 11:19:20 +0200 |
---|---|---|
committer | unknown <heikki@hundin.mysql.fi> | 2005-01-06 11:19:20 +0200 |
commit | 51cae387a9a2c67b0f6249864714b8659c951670 (patch) | |
tree | e4c30dd8afacffe701e7f226587184522915f34c /innobase | |
parent | 6f2f0d5cf3a7cb9a638bc753a3f3ec1b518bc4ed (diff) | |
download | mariadb-git-51cae387a9a2c67b0f6249864714b8659c951670.tar.gz |
os0file.c:
Use the fcntl() file flush method on OS X; Apple disabled fsync() for internal disk drives, which caused corruption in power outages; the patch was recommended by an Apple engineer
innobase/os/os0file.c:
Use the fcntl() file flush method on OS X; Apple disabled fsync() for internal disk drives, which caused corruption in power outages; the patch was recommended by an Apple engineer
Diffstat (limited to 'innobase')
-rw-r--r-- | innobase/os/os0file.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/innobase/os/os0file.c b/innobase/os/os0file.c index aa45030d93b..f02b81b8fd8 100644 --- a/innobase/os/os0file.c +++ b/innobase/os/os0file.c @@ -1763,7 +1763,21 @@ os_file_flush( #else int ret; -#ifdef HAVE_FDATASYNC +#ifdef HAVE_DARWIN_THREADS + /* Apple has disabled fsync() for internal disk drives in OS X. That + caused corruption for a user when he tested a power outage. Let us in + OS X use a nonstandard flush method recommended by an Apple + engineer. */ + + ret = fcntl(file, F_FULLFSYNC, NULL); + + if (ret) { + /* If we are not on a file system that supports this, then + fall back to a plain fsync. */ + + ret = fsync(file); + } +#elif HAVE_FDATASYNC ret = fdatasync(file); #else /* fprintf(stderr, "Flushing to file %p\n", file); */ |