From 10802c4d9046fd54bf1a27cb7611c182ecde93fb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 30 Aug 2012 10:53:49 +0200 Subject: MDEV-381: fdatasync() does not correctly flush growing binlog file. When we append data to the binlog file, we use fdatasync() to ensure the data gets to disk so that crash recovery can work. Unfortunately there seems to be a bug in ext3/ext4 on linux, so that fdatasync() does not correctly sync all data when the size of a file is increased. This causes crash recovery to not work correctly (it loses transactions from the binlog). As a work-around, use fsync() for the binlog, not fdatasync(). Since we are increasing the file size, (correct) fdatasync() will most likely not be faster than fsync() on any file system, and fsync() does work correctly on ext3/ext4. This avoids the need to try to detect if we are running on buggy ext3/ext4. --- include/my_sys.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/my_sys.h b/include/my_sys.h index db22f55f492..ebe643abce5 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -70,6 +70,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */ #define MY_SYNC 4096 /* my_copy(): sync dst file */ #define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */ +#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ -- cgit v1.2.1