Commit d02aaab4 authored by unknown's avatar unknown

log0log.c InnoDB now allows parameter innodb_unix_file_flush_method

os0file.c	InnoDB now allows parameter innodb_unix_file_flush_method
srv0start.c	InnoDB now allows parameter innodb_unix_file_flush_method


innobase/srv/srv0start.c:
  InnoDB now allows parameter innodb_unix_file_flush_method
innobase/os/os0file.c:
  InnoDB now allows parameter innodb_unix_file_flush_method
innobase/log/log0log.c:
  InnoDB now allows parameter innodb_unix_file_flush_method
parent f68e5ce7
...@@ -838,14 +838,18 @@ log_io_complete( ...@@ -838,14 +838,18 @@ log_io_complete(
/* It was a checkpoint write */ /* It was a checkpoint write */
group = (log_group_t*)((ulint)group - 1); group = (log_group_t*)((ulint)group - 1);
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id); fil_flush(group->space_id);
}
log_io_complete_checkpoint(group); log_io_complete_checkpoint(group);
return; return;
} }
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush(group->space_id); fil_flush(group->space_id);
}
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
...@@ -1474,7 +1478,9 @@ log_checkpoint( ...@@ -1474,7 +1478,9 @@ log_checkpoint(
recv_apply_hashed_log_recs(TRUE); recv_apply_hashed_log_recs(TRUE);
} }
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
fil_flush_file_spaces(FIL_TABLESPACE); fil_flush_file_spaces(FIL_TABLESPACE);
}
mutex_enter(&(log_sys->mutex)); mutex_enter(&(log_sys->mutex));
......
...@@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri ...@@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri
#include "os0file.h" #include "os0file.h"
#include "os0sync.h" #include "os0sync.h"
#include "ut0mem.h" #include "ut0mem.h"
#include "srv0srv.h"
#ifdef POSIX_ASYNC_IO #ifdef POSIX_ASYNC_IO
...@@ -345,12 +346,11 @@ try_again: ...@@ -345,12 +346,11 @@ try_again:
UT_NOT_USED(purpose); UT_NOT_USED(purpose);
/* On Linux opening a file in the O_SYNC mode seems to be much #ifdef O_DSYNC
more efficient for small writes than calling an explicit fsync or if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is create_flag = create_flag | O_DSYNC;
extremely slow in large block writes to a big file. Therefore we }
do not use these options, but use explicit fdatasync. */ #endif
if (create_mode == OS_FILE_CREATE) { if (create_mode == OS_FILE_CREATE) {
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
| S_IWGRP | S_IROTH | S_IWOTH); | S_IWGRP | S_IROTH | S_IWOTH);
...@@ -547,6 +547,12 @@ os_file_flush( ...@@ -547,6 +547,12 @@ os_file_flush(
#else #else
int ret; int ret;
#ifdef O_DSYNC
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
return(TRUE);
}
#endif
#ifdef HAVE_FDATASYNC #ifdef HAVE_FDATASYNC
ret = fdatasync(file); ret = fdatasync(file);
#else #else
...@@ -621,10 +627,15 @@ os_file_pwrite( ...@@ -621,10 +627,15 @@ os_file_pwrite(
#ifdef HAVE_PWRITE #ifdef HAVE_PWRITE
ret = pwrite(file, buf, n, offs); ret = pwrite(file, buf, n, offs);
/* Always do fsync to reduce the probability that when the OS crashes, if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
a database page is only partially physically written to disk. */ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file)); ut_a(TRUE == os_file_flush(file));
}
return(ret); return(ret);
#else #else
...@@ -645,10 +656,15 @@ os_file_pwrite( ...@@ -645,10 +656,15 @@ os_file_pwrite(
ret = write(file, buf, n); ret = write(file, buf, n);
/* Always do fsync to reduce the probability that when the OS crashes, if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
a database page is only partially physically written to disk. */ && srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
/* Always do fsync to reduce the probability that when
the OS crashes, a database page is only partially
physically written to disk. */
ut_a(TRUE == os_file_flush(file)); ut_a(TRUE == os_file_flush(file));
}
os_mutex_exit(os_file_seek_mutexes[i]); os_mutex_exit(os_file_seek_mutexes[i]);
......
...@@ -548,8 +548,6 @@ innobase_start_or_create_for_mysql(void) ...@@ -548,8 +548,6 @@ innobase_start_or_create_for_mysql(void)
return(DB_ERROR); return(DB_ERROR);
} }
printf("InnoDB file flush method %lu\n", srv_unix_file_flush_method);
os_aio_use_native_aio = srv_use_native_aio; os_aio_use_native_aio = srv_use_native_aio;
err = srv_boot(); err = srv_boot();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment