mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
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
This commit is contained in:
parent
dcd68f2f0a
commit
221b1ea5a4
3 changed files with 38 additions and 18 deletions
|
@ -838,14 +838,18 @@ log_io_complete(
|
|||
/* It was a checkpoint write */
|
||||
group = (log_group_t*)((ulint)group - 1);
|
||||
|
||||
fil_flush(group->space_id);
|
||||
|
||||
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
|
||||
fil_flush(group->space_id);
|
||||
}
|
||||
|
||||
log_io_complete_checkpoint(group);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
fil_flush(group->space_id);
|
||||
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
|
||||
fil_flush(group->space_id);
|
||||
}
|
||||
|
||||
mutex_enter(&(log_sys->mutex));
|
||||
|
||||
|
@ -1474,7 +1478,9 @@ log_checkpoint(
|
|||
recv_apply_hashed_log_recs(TRUE);
|
||||
}
|
||||
|
||||
fil_flush_file_spaces(FIL_TABLESPACE);
|
||||
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
|
||||
fil_flush_file_spaces(FIL_TABLESPACE);
|
||||
}
|
||||
|
||||
mutex_enter(&(log_sys->mutex));
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ Created 10/21/1995 Heikki Tuuri
|
|||
#include "os0file.h"
|
||||
#include "os0sync.h"
|
||||
#include "ut0mem.h"
|
||||
#include "srv0srv.h"
|
||||
|
||||
|
||||
#ifdef POSIX_ASYNC_IO
|
||||
|
@ -345,12 +346,11 @@ try_again:
|
|||
|
||||
UT_NOT_USED(purpose);
|
||||
|
||||
/* On Linux opening a file in the O_SYNC mode seems to be much
|
||||
more efficient for small writes than calling an explicit fsync or
|
||||
fdatasync after each write, but on Solaris O_SYNC and O_DSYNC is
|
||||
extremely slow in large block writes to a big file. Therefore we
|
||||
do not use these options, but use explicit fdatasync. */
|
||||
|
||||
#ifdef O_DSYNC
|
||||
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
|
||||
create_flag = create_flag | O_DSYNC;
|
||||
}
|
||||
#endif
|
||||
if (create_mode == OS_FILE_CREATE) {
|
||||
file = open(name, create_flag, S_IRUSR | S_IWUSR | S_IRGRP
|
||||
| S_IWGRP | S_IROTH | S_IWOTH);
|
||||
|
@ -546,6 +546,12 @@ os_file_flush(
|
|||
return(FALSE);
|
||||
#else
|
||||
int ret;
|
||||
|
||||
#ifdef O_DSYNC
|
||||
if (srv_unix_file_flush_method == SRV_UNIX_O_DSYNC) {
|
||||
return(TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FDATASYNC
|
||||
ret = fdatasync(file);
|
||||
|
@ -621,10 +627,15 @@ os_file_pwrite(
|
|||
#ifdef HAVE_PWRITE
|
||||
ret = pwrite(file, buf, n, offs);
|
||||
|
||||
/* Always do fsync to reduce the probability that when the OS crashes,
|
||||
a database page is only partially physically written to disk. */
|
||||
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
|
||||
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
|
||||
|
||||
ut_a(TRUE == os_file_flush(file));
|
||||
/* 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));
|
||||
}
|
||||
|
||||
return(ret);
|
||||
#else
|
||||
|
@ -645,10 +656,15 @@ os_file_pwrite(
|
|||
|
||||
ret = write(file, buf, n);
|
||||
|
||||
/* Always do fsync to reduce the probability that when the OS crashes,
|
||||
a database page is only partially physically written to disk. */
|
||||
if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
|
||||
&& srv_unix_file_flush_method != SRV_UNIX_NOSYNC) {
|
||||
|
||||
ut_a(TRUE == os_file_flush(file));
|
||||
/* 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));
|
||||
}
|
||||
|
||||
os_mutex_exit(os_file_seek_mutexes[i]);
|
||||
|
||||
|
|
|
@ -548,8 +548,6 @@ innobase_start_or_create_for_mysql(void)
|
|||
return(DB_ERROR);
|
||||
}
|
||||
|
||||
printf("InnoDB file flush method %lu\n", srv_unix_file_flush_method);
|
||||
|
||||
os_aio_use_native_aio = srv_use_native_aio;
|
||||
|
||||
err = srv_boot();
|
||||
|
|
Loading…
Add table
Reference in a new issue