diff options
author | unknown <guilhem@gbichot3.local> | 2006-11-21 22:22:59 +0100 |
---|---|---|
committer | unknown <guilhem@gbichot3.local> | 2006-11-21 22:22:59 +0100 |
commit | a41ac15b960aee306e3464835b05a835fd98771d (patch) | |
tree | bac3eccdcb9906c3a529aa064ac3b9dcb8841edf /libmysql | |
parent | 3becab22e9dd774d58983e553b6fbbfb9960f852 (diff) | |
download | mariadb-git-a41ac15b960aee306e3464835b05a835fd98771d.tar.gz |
Maria - various fixes around durability of files:
1) on Mac OS X >=10.3, fcntl() is recommended over fsync (from the
man page: "[With fsync()] the disk drive may also re-order the data
so that later writes may be present while earlier writes are not.
Applications such as databases that require a strict ordering of writes
should use F_FULLFSYNC to ensure their data is written in the order
they expect"). I have seen two other pieces of software changing from
fsync to F_FULLFSYNC on Mac OS X.
2) to make a file creation/deletion/renaming durable on Linux (at least
ext2 as I have tested) (see "man fsync"), a fsync() on the directory
is needed: new functions to do that, and a flag MY_SYNC_DIR to do
it in my_create/my_delete/my_rename.
3) now using this directory syncing when creating he frm if
opt_sync_frm, and for Maria's control file when it is created.
include/my_sys.h:
new flag to my_create/my_delete/my_rename, which asks to sync the
directory after the operation is done (currently does nothing except
on Linux)
libmysql/CMakeLists.txt:
my_create() now depends on my_sync() so my_sync is needed for libmysql
libmysql/Makefile.shared:
my_create() now depends on my_sync() so my_sync is needed for libmysql
mysys/my_create.c:
my_create() can now sync the directory if asked for
mysys/my_delete.c:
my_delete() can now sync the directory if asked for
mysys/my_open.c:
it was a bug that my_close() is done on fd but a positive fd would
still be returned, by my_register_filename().
mysys/my_rename.c:
my_rename() can now sync the two directories (the one of "from" and
the one of "to") if asked for.
mysys/my_sync.c:
On recent Mac OS X, fcntl(F_FULLFSYNC) is recommended over fsync()
(see "man fsync" on Mac OS X 10.3).
my_sync_dir(): to sync a directory after a file creation/deletion/
renaming; can be called directly or via MY_SYNC_DIR in my_create/
my_delete/my_rename(). No-op except on Linux (see "man fsync" on Linux).
my_sync_dir_from_file(): same as above, just more practical when the
caller has a file name but no directory name ready.
Should the #warning even be a #error? I mean do we want to release
binaries which don't guarantee any durability?
sql/log.cc:
a TODO for the future.
sql/unireg.cc:
If we sync the frm it makes sense to also sync its creation in the
directory.
storage/maria/ma_control_file.c:
control file is vital, try to make it to disk
Diffstat (limited to 'libmysql')
-rw-r--r-- | libmysql/CMakeLists.txt | 1 | ||||
-rw-r--r-- | libmysql/Makefile.shared | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index d12b6ca6c10..3c9ed53a866 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -37,6 +37,7 @@ ADD_LIBRARY(libmysql SHARED dll.c libmysql.def ../mysys/my_open.c ../mysys/my_pread.c ../mysys/my_pthread.c ../mysys/my_read.c ../mysys/my_realloc.c ../mysys/my_rename.c ../mysys/my_seek.c ../mysys/my_static.c ../strings/my_strtoll10.c ../mysys/my_symlink.c + ../mysys/my_sync.c ../mysys/my_symlink2.c ../mysys/my_thr_init.c ../sql-common/my_time.c ../strings/my_vsnprintf.c ../mysys/my_wincond.c ../mysys/my_winthread.c ../mysys/my_write.c ../sql/net_serv.cc ../sql-common/pack.c ../sql/password.c diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index c2d98a81042..6326e255559 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -68,7 +68,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ mf_iocache2.lo my_seek.lo my_sleep.lo \ my_pread.lo mf_cache.lo md5.lo sha1.lo \ my_getopt.lo my_gethostbyname.lo my_port.lo \ - my_rename.lo my_chsize.lo + my_rename.lo my_chsize.lo my_sync.lo sqlobjects = net.lo sql_cmn_objects = pack.lo client.lo my_time.lo |