mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03: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 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
This commit is contained in:
@ -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);
|
||||||
|
|
||||||
fil_flush(group->space_id);
|
if (srv_unix_file_flush_method == SRV_UNIX_LITTLESYNC) {
|
||||||
|
fil_flush(group->space_id);
|
||||||
|
}
|
||||||
|
|
||||||
log_io_complete_checkpoint(group);
|
log_io_complete_checkpoint(group);
|
||||||
|
|
||||||
return;
|
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));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
@ -1474,7 +1478,9 @@ log_checkpoint(
|
|||||||
recv_apply_hashed_log_recs(TRUE);
|
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));
|
mutex_enter(&(log_sys->mutex));
|
||||||
|
|
||||||
|
@ -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:
|
|||||||
|
|
||||||
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);
|
||||||
@ -546,6 +546,12 @@ os_file_flush(
|
|||||||
return(FALSE);
|
return(FALSE);
|
||||||
#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);
|
||||||
@ -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) {
|
||||||
|
|
||||||
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);
|
return(ret);
|
||||||
#else
|
#else
|
||||||
@ -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) {
|
||||||
|
|
||||||
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]);
|
os_mutex_exit(os_file_seek_mutexes[i]);
|
||||||
|
|
||||||
|
@ -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();
|
||||||
|
Reference in New Issue
Block a user