diff options
Diffstat (limited to 'innobase/srv/srv0start.c')
-rw-r--r-- | innobase/srv/srv0start.c | 92 |
1 files changed, 48 insertions, 44 deletions
diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index dfa122b2ece..d6d610bb5b8 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -515,7 +515,7 @@ srv_calc_high32( } /************************************************************************* -Creates or opens the log files. */ +Creates or opens the log files and closes them. */ static ulint open_or_create_log_file( @@ -640,7 +640,7 @@ open_or_create_log_file( } /************************************************************************* -Creates or opens database data files. */ +Creates or opens database data files and closes them. */ static ulint open_or_create_data_files( @@ -965,31 +965,63 @@ innobase_start_or_create_for_mysql(void) srv_is_being_started = TRUE; srv_startup_is_before_trx_rollback_phase = TRUE; + os_aio_use_native_aio = FALSE; + +#ifdef __WIN__ + if (os_get_os_version() == OS_WIN95 + || os_get_os_version() == OS_WIN31 + || os_get_os_version() == OS_WINNT) { + + /* On Win 95, 98, ME, Win32 subsystem for Windows 3.1, + and NT use simulated aio. In NT Windows provides async i/o, + but when run in conjunction with InnoDB Hot Backup, it seemed + to corrupt the data files. */ + + os_aio_use_native_aio = FALSE; + } else { + /* On Win 2000 and XP use async i/o */ + os_aio_use_native_aio = TRUE; + } +#endif + if (srv_file_flush_method_str == NULL) { + /* These are the default options */ + + srv_unix_file_flush_method = SRV_UNIX_FDATASYNC; - if (0 == ut_strcmp(srv_unix_file_flush_method_str, "fdatasync")) { + srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; +#ifndef __WIN__ + } else if (0 == ut_strcmp(srv_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")) { + } else if (0 == ut_strcmp(srv_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, + } else if (0 == ut_strcmp(srv_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")) { + } else if (0 == ut_strcmp(srv_file_flush_method_str, "nosync")) { srv_unix_file_flush_method = SRV_UNIX_NOSYNC; +#else + } else if (0 == ut_strcmp(srv_file_flush_method_str, "normal")) { + srv_win_file_flush_method = SRV_WIN_IO_NORMAL; + os_aio_use_native_aio = FALSE; + + } else if (0 == ut_strcmp(srv_file_flush_method_str, "unbuffered")) { + srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; + os_aio_use_native_aio = FALSE; + + } else if (0 == ut_strcmp(srv_file_flush_method_str, + "async_unbuffered")) { + srv_win_file_flush_method = SRV_WIN_IO_UNBUFFERED; +#endif } else { fprintf(stderr, "InnoDB: Unrecognized value %s for innodb_flush_method\n", - srv_unix_file_flush_method_str); + srv_file_flush_method_str); return(DB_ERROR); } - /* - printf("srv_unix set to %lu\n", srv_unix_file_flush_method); - */ - os_aio_use_native_aio = srv_use_native_aio; - err = srv_boot(); if (err != DB_SUCCESS) { @@ -999,34 +1031,15 @@ innobase_start_or_create_for_mysql(void) /* Restrict the maximum number of file i/o threads */ if (srv_n_file_io_threads > SRV_MAX_N_IO_THREADS) { + srv_n_file_io_threads = SRV_MAX_N_IO_THREADS; } -#if !(defined(WIN_ASYNC_IO) || defined(POSIX_ASYNC_IO)) - /* In simulated aio we currently have use only for 4 threads */ - - os_aio_use_native_aio = FALSE; - - srv_n_file_io_threads = 4; -#endif - -#ifdef __WIN__ - if (os_get_os_version() == OS_WIN95 - || os_get_os_version() == OS_WIN31) { + if (!os_aio_use_native_aio) { + /* In simulated aio we currently have use only for 4 threads */ - /* On Win 95, 98, ME, and Win32 subsystem for Windows 3.1 use - simulated aio */ + srv_n_file_io_threads = 4; - os_aio_use_native_aio = FALSE; - srv_n_file_io_threads = 4; - } else { - /* On NT and Win 2000 always use aio */ - os_aio_use_native_aio = TRUE; - } -#endif - os_aio_use_native_aio = FALSE; - - if (!os_aio_use_native_aio) { os_aio_init(8 * SRV_N_PENDING_IOS_PER_THREAD * srv_n_file_io_threads, srv_n_file_io_threads, @@ -1047,15 +1060,6 @@ innobase_start_or_create_for_mysql(void) lock_sys_create(srv_lock_table_size); -#ifdef POSIX_ASYNC_IO - if (os_aio_use_native_aio) { - /* There is only one thread per async io array: - one for ibuf i/o, one for log i/o, one for ordinary reads, - one for ordinary writes; we need only 4 i/o threads */ - - srv_n_file_io_threads = 4; - } -#endif /* Create i/o-handler threads: */ for (i = 0; i < srv_n_file_io_threads; i++) { |