From 2f8dfb3f4a13e8cd205e490722fb298712257ebf Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 May 2001 18:04:49 +0300 Subject: [PATCH] srv0srv.h One can now specify innodb_unix_file_flush_method in my.cnf srv0srv.c One can now specify innodb_unix_file_flush_method in my.cnf srv0start.c One can now specify innodb_unix_file_flush_method in my.cnf ha_innobase.cc One can now specify innodb_unix_file_flush_method in my.cnf ha_innobase.h One can now specify innodb_unix_file_flush_method in my.cnf mysqld.cc One can now specify innodb_unix_file_flush_method in my.cnf sql/ha_innobase.cc: One can now specify innodb_unix_file_flush_method in my.cnf sql/ha_innobase.h: One can now specify innodb_unix_file_flush_method in my.cnf sql/mysqld.cc: One can now specify innodb_unix_file_flush_method in my.cnf innobase/srv/srv0srv.c: One can now specify innodb_unix_file_flush_method in my.cnf innobase/srv/srv0start.c: One can now specify innodb_unix_file_flush_method in my.cnf innobase/include/srv0srv.h: One can now specify innodb_unix_file_flush_method in my.cnf BitKeeper/etc/logging_ok: Logging to logging@openlogging.org accepted --- BitKeeper/etc/logging_ok | 1 + innobase/include/srv0srv.h | 10 ++++++++++ innobase/srv/srv0srv.c | 3 +++ innobase/srv/srv0start.c | 18 ++++++++++++++++++ sql/ha_innobase.cc | 5 +++++ sql/ha_innobase.h | 1 + sql/mysqld.cc | 7 +++++++ 7 files changed, 45 insertions(+) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index b6a17f4bda9..11b5f930d29 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -1,3 +1,4 @@ jani@janikt.pp.saunalahti.fi monty@tik.mysql.fi monty@donna.mysql.fi +heikki@donna.mysql.fi diff --git a/innobase/include/srv0srv.h b/innobase/include/srv0srv.h index 8853745926d..26164e2ccdc 100644 --- a/innobase/include/srv0srv.h +++ b/innobase/include/srv0srv.h @@ -48,6 +48,9 @@ extern dulint srv_archive_recovery_limit_lsn; extern ulint srv_lock_wait_timeout; +extern char* srv_unix_file_flush_method_str; +extern ulint srv_unix_file_flush_method; + extern ibool srv_set_thread_priorities; extern int srv_query_thread_priority; @@ -100,6 +103,13 @@ typedef struct srv_sys_struct srv_sys_t; /* The server system */ extern srv_sys_t* srv_sys; +/* Alternatives for fiel flush option in Unix; see the InnoDB manual about +what these mean */ +#define SRV_UNIX_FDATASYNC 1 +#define SRV_UNIX_O_DSYNC 2 +#define SRV_UNIX_LITTLESYNC 3 +#define SRV_UNIX_NOSYNC 4 + /************************************************************************* Boots Innobase server. */ diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index df36ec446a3..186ed1b8d56 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -88,6 +88,9 @@ dulint srv_archive_recovery_limit_lsn; ulint srv_lock_wait_timeout = 1024 * 1024 * 1024; +char* srv_unix_file_flush_method_str = NULL; +ulint srv_unix_file_flush_method = 0; + ibool srv_set_thread_priorities = TRUE; int srv_query_thread_priority = 0; /*-------------------------------------------*/ diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 9e10cca7200..105d6e11623 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -532,6 +532,24 @@ innobase_start_or_create_for_mysql(void) srv_is_being_started = TRUE; + if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) { + srv_unix_file_flush_method = SRV_UNIX_FDATASYNC; + } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "O_DSYNC")) { + srv_unix_file_flush_method = SRV_UNIX_O_DSYNC; + } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, + "littlesync")) { + srv_unix_file_flush_method = SRV_UNIX_LITTLESYNC; + } else if (0 == ut_strcmp(srv_unix_file_flush_method_str, "nosync")) { + srv_unix_file_flush_method = SRV_UNIX_NOSYNC; + } else { + fprintf(stderr, + "InnoDB: Unrecognized value for innodb_unix_file_flush_method\n"); + + 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(); diff --git a/sql/ha_innobase.cc b/sql/ha_innobase.cc index 3e86d0da6f1..fa44cebe19d 100644 --- a/sql/ha_innobase.cc +++ b/sql/ha_innobase.cc @@ -83,6 +83,7 @@ long innobase_mirrored_log_groups, innobase_log_files_in_group, char *innobase_data_home_dir, *innobase_data_file_path; char *innobase_log_group_home_dir, *innobase_log_arch_dir; +char *innobase_unix_file_flush_method; bool innobase_flush_log_at_trx_commit, innobase_log_archive, innobase_use_native_aio; @@ -474,6 +475,10 @@ innobase_init(void) DBUG_RETURN(TRUE); } + srv_unix_file_flush_method_str = (innobase_unix_file_flush_method ? + innobase_unix_file_flush_method : + (char*)"fdatasync"); + srv_n_log_groups = (ulint) innobase_mirrored_log_groups; srv_n_log_files = (ulint) innobase_log_files_in_group; srv_log_file_size = (ulint) innobase_log_file_size; diff --git a/sql/ha_innobase.h b/sql/ha_innobase.h index 429e47523dd..258e34cbf86 100644 --- a/sql/ha_innobase.h +++ b/sql/ha_innobase.h @@ -161,6 +161,7 @@ extern long innobase_buffer_pool_size, innobase_additional_mem_pool_size; extern long innobase_file_io_threads, innobase_lock_wait_timeout; extern char *innobase_data_home_dir, *innobase_data_file_path; extern char *innobase_log_group_home_dir, *innobase_log_arch_dir; +extern char *innobase_unix_file_flush_method; extern bool innobase_flush_log_at_trx_commit, innobase_log_archive, innobase_use_native_aio; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 982e32a9fd7..dccb54ae7ec 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2456,6 +2456,7 @@ enum options { OPT_INNODB_LOG_ARCH_DIR, OPT_INNODB_LOG_ARCHIVE, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT, + OPT_INNODB_UNIX_FILE_FLUSH_METHOD, OPT_SAFE_SHOW_DB, OPT_GEMINI_SKIP, OPT_INNODB_SKIP, OPT_TEMP_POOL, OPT_TX_ISOLATION, @@ -2516,6 +2517,8 @@ static struct option long_options[] = { OPT_INNODB_LOG_ARCHIVE}, {"innodb_flush_log_at_trx_commit", optional_argument, 0, OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT}, + {"innodb_unix_file_flush_method", required_argument, 0, + OPT_INNODB_UNIX_FILE_FLUSH_METHOD}, #endif {"help", no_argument, 0, '?'}, {"init-file", required_argument, 0, (int) OPT_INIT_FILE}, @@ -2793,6 +2796,7 @@ struct show_var_st init_vars[]= { {"innodb_log_arch_dir", (char*) &innobase_log_arch_dir, SHOW_CHAR_PTR}, {"innodb_log_archive", (char*) &innobase_log_archive, SHOW_MY_BOOL}, {"innodb_log_group_home_dir", (char*) &innobase_log_group_home_dir, SHOW_CHAR_PTR}, + {"innodb_unix_file_flush_method", (char*) &innobase_unix_file_flush_method, SHOW_CHAR_PTR}, #endif {"interactive_timeout", (char*) &net_interactive_timeout, SHOW_LONG}, {"join_buffer_size", (char*) &join_buff_size, SHOW_LONG}, @@ -3653,6 +3657,9 @@ static void get_options(int argc,char **argv) case OPT_INNODB_FLUSH_LOG_AT_TRX_COMMIT: innobase_flush_log_at_trx_commit= optarg ? test(atoi(optarg)) : 1; break; + case OPT_INNODB_UNIX_FILE_FLUSH_METHOD: + innobase_unix_file_flush_method=optarg; + break; #endif /* HAVE_INNOBASE_DB */ case OPT_MYISAM_RECOVER: {