diff options
Diffstat (limited to 'storage/xtradb/srv/srv0start.cc')
-rw-r--r-- | storage/xtradb/srv/srv0start.cc | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index fd6ccfe75b1..248f1e4db89 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -133,23 +133,32 @@ UNIV_INTERN enum srv_shutdown_state srv_shutdown_state = SRV_SHUTDOWN_NONE; static os_file_t files[1000]; /** io_handler_thread parameters for thread identification */ -static ulint n[SRV_MAX_N_IO_THREADS + 6]; -/** io_handler_thread identifiers, 32 is the maximum number of purge threads */ -/** 6 is the ? */ -#define START_OLD_THREAD_CNT (SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS) -static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS + MTFLUSH_MAX_WORKER]; +static ulint n[SRV_MAX_N_IO_THREADS]; +/** io_handler_thread identifiers, 32 is the maximum number of purge threads. +The extra elements at the end are allocated as follows: +SRV_MAX_N_IO_THREADS + 1: srv_master_thread +SRV_MAX_N_IO_THREADS + 2: lock_wait_timeout_thread +SRV_MAX_N_IO_THREADS + 3: srv_error_monitor_thread +SRV_MAX_N_IO_THREADS + 4: srv_monitor_thread +SRV_MAX_N_IO_THREADS + 5: srv_redo_log_follow_thread +SRV_MAX_N_IO_THREADS + 6: srv_purge_coordinator_thread +SRV_MAX_N_IO_THREADS + 7: srv_worker_thread +... +SRV_MAX_N_IO_THREADS + 7 + srv_n_purge_threads - 1: srv_worker_thread */ +static os_thread_id_t thread_ids[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS + MTFLUSH_MAX_WORKER]; + +/** Thead handles */ +static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS+ MTFLUSH_MAX_WORKER]; /* Thread contex data for multi-threaded flush */ void *mtflush_ctx=NULL; -/** Thead handles */ -static os_thread_t thread_handles[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS]; static os_thread_t buf_flush_page_cleaner_thread_handle; static os_thread_t buf_dump_thread_handle; static os_thread_t dict_stats_thread_handle; static os_thread_t buf_flush_lru_manager_thread_handle; static os_thread_t srv_redo_log_follow_thread_handle; /** Status variables, is thread started ?*/ -static bool thread_started[SRV_MAX_N_IO_THREADS + 6 + SRV_MAX_N_PURGE_THREADS] = {false}; +static bool thread_started[SRV_MAX_N_IO_THREADS + 7 + SRV_MAX_N_PURGE_THREADS] = {false}; static bool buf_flush_page_cleaner_thread_started = false; static bool buf_dump_thread_started = false; static bool dict_stats_thread_started = false; @@ -1891,6 +1900,7 @@ innobase_start_or_create_for_mysql(void) + 1 /* srv_error_monitor_thread */ + 1 /* srv_monitor_thread */ + 1 /* srv_master_thread */ + + 1 /* srv_redo_log_follow_thread */ + 1 /* srv_purge_coordinator_thread */ + 1 /* buf_dump_thread */ + 1 /* dict_stats_thread */ @@ -2798,21 +2808,21 @@ files_checked: if (!srv_read_only_mode && srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { - thread_handles[5 + SRV_MAX_N_IO_THREADS] = os_thread_create( + thread_handles[6 + SRV_MAX_N_IO_THREADS] = os_thread_create( srv_purge_coordinator_thread, - NULL, thread_ids + 5 + SRV_MAX_N_IO_THREADS); + NULL, thread_ids + 6 + SRV_MAX_N_IO_THREADS); - thread_started[5 + SRV_MAX_N_IO_THREADS] = true; + thread_started[6 + SRV_MAX_N_IO_THREADS] = true; ut_a(UT_ARR_SIZE(thread_ids) - > 5 + srv_n_purge_threads + SRV_MAX_N_IO_THREADS); + > 6 + srv_n_purge_threads + SRV_MAX_N_IO_THREADS); /* We've already created the purge coordinator thread above. */ for (i = 1; i < srv_n_purge_threads; ++i) { - thread_handles[5 + i + SRV_MAX_N_IO_THREADS] = os_thread_create( + thread_handles[6 + i + SRV_MAX_N_IO_THREADS] = os_thread_create( srv_worker_thread, NULL, - thread_ids + 5 + i + SRV_MAX_N_IO_THREADS); - thread_started[5 + i + SRV_MAX_N_IO_THREADS] = true; + thread_ids + 6 + i + SRV_MAX_N_IO_THREADS); + thread_started[6 + i + SRV_MAX_N_IO_THREADS] = true; } srv_start_wait_for_purge_to_start(); @@ -3219,9 +3229,9 @@ innobase_shutdown_for_mysql(void) ibuf_close(); log_shutdown(); - lock_sys_close(); trx_sys_file_format_close(); trx_sys_close(); + lock_sys_close(); /* We don't create these mutexes in RO mode because we don't create the temp files that the cover. */ |