The world's most popular open source database
#include "univ.i"#include "sync0sync.h"#include "os0sync.h"#include "que0types.h"#include "trx0types.h"Include dependency graph for srv0srv.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
| #define kernel_mutex (*kernel_mutex_temp) |
Definition at line 177 of file srv0srv.h.
Referenced by dict_print(), fseg_alloc_free_page_general(), fseg_create_general(), fseg_free_page(), fseg_free_step(), fseg_free_step_not_header(), fseg_n_reserved_pages(), fsp_get_available_space_in_free_extents(), fsp_reserve_free_extents(), lock_cancel_waiting_and_release(), lock_check_trx_id_sanity(), lock_deadlock_occurs(), lock_deadlock_recursive(), lock_get_n_rec_locks(), lock_grant(), lock_rec_add_to_queue(), lock_rec_cancel(), lock_rec_convert_impl_to_expl(), lock_rec_create(), lock_rec_dequeue_from_page(), lock_rec_discard(), lock_rec_enqueue_waiting(), lock_rec_expl_exist_on_page(), lock_rec_find_similar_on_page(), lock_rec_free_all_from_discard_page(), lock_rec_get_first(), lock_rec_get_first_on_page(), lock_rec_get_first_on_page_addr(), lock_rec_get_next(), lock_rec_get_next_on_page(), lock_rec_get_prev(), lock_rec_has_expl(), lock_rec_has_to_wait_in_queue(), lock_rec_inherit_to_gap(), lock_rec_inherit_to_gap_if_gap_lock(), lock_rec_lock(), lock_rec_lock_fast(), lock_rec_lock_slow(), lock_rec_move(), lock_rec_other_has_conflicting(), lock_rec_other_has_expl_req(), lock_rec_print(), lock_rec_reset_and_inherit_gap_locks(), lock_rec_reset_and_release_wait(), lock_rec_unlock(), lock_rec_validate_page(), lock_release_off_kernel(), lock_reset_all_on_table(), lock_reset_all_on_table_for_trx(), lock_sec_rec_some_has_impl_off_kernel(), lock_table_create(), lock_table_dequeue(), lock_table_enqueue_waiting(), lock_table_has(), lock_table_other_has_incompatible(), lock_table_print(), lock_table_queue_validate(), lock_table_remove_low(), lock_table_unlock(), lock_table_unlock_auto_inc(), logs_empty_and_mark_files_at_shutdown(), que_fork_error_handle(), que_graph_publish(), que_graph_try_free(), que_run_threads(), que_run_threads_low(), que_thr_dec_refer_count(), que_thr_end_wait(), que_thr_end_wait_no_next_thr(), que_thr_node_step(), que_thr_stop(), que_thr_stop_for_mysql(), read_cursor_set_for_mysql(), read_cursor_view_close_for_mysql(), read_cursor_view_create_for_mysql(), read_view_close(), read_view_close_for_mysql(), read_view_oldest_copy_or_open_new(), read_view_open_now(), row_add_table_to_background_drop_list(), row_check_table_for_mysql(), row_drop_tables_for_mysql_in_background(), row_get_background_drop_list_len_low(), row_search_check_if_query_cache_permitted(), row_search_for_mysql(), row_vers_build_for_semi_consistent_read(), row_vers_impl_x_locked_off_kernel(), sess_close(), sess_open(), sess_try_close(), srv_active_wake_master_thread(), srv_get_n_threads(), srv_get_thread_type(), srv_init(), srv_lock_timeout_and_monitor_thread(), srv_master_thread(), srv_que_round_robin(), srv_que_task_enqueue(), srv_que_task_enqueue_low(), srv_que_task_queue_check(), srv_release_mysql_thread_if_suspended(), srv_release_threads(), srv_suspend_mysql_thread(), srv_suspend_thread(), srv_table_reserve_slot_for_mysql(), srv_wake_master_thread(), trx_allocate_for_background(), trx_allocate_for_mysql(), trx_assign_read_view(), trx_assign_rseg(), trx_commit_for_mysql(), trx_commit_off_kernel(), trx_commit_step(), trx_create(), trx_end_lock_wait(), trx_end_signal_handling(), trx_finish_error_processing(), trx_finish_partial_rollback_off_kernel(), trx_finish_rollback_off_kernel(), trx_free(), trx_free_for_background(), trx_free_for_mysql(), trx_general_rollback_for_mysql(), trx_get_trx_by_xid(), trx_handle_commit_sig_off_kernel(), trx_in_trx_list(), trx_list_insert_ordered(), trx_lock_wait_to_suspended(), trx_prepare_for_mysql(), trx_prepare_off_kernel(), trx_purge(), trx_purge_add_update_undo_to_history(), trx_purge_free_segment(), trx_purge_rseg_get_next_history_log(), trx_purge_sys_create(), trx_purge_truncate_rseg_history(), trx_recover_for_mysql(), trx_roll_graph_build(), trx_rollback(), trx_rollback_or_clean_all_without_sess(), trx_rollback_step(), trx_rseg_create(), trx_rseg_header_create(), trx_rseg_mem_create(), trx_sig_is_compatible(), trx_sig_remove(), trx_sig_reply(), trx_sig_reply_wait_to_suspended(), trx_sig_send(), trx_sig_start_handle(), trx_start(), trx_start_low(), trx_sys_flush_max_trx_id(), trx_sys_init_at_db_start(), trx_sysf_create(), trx_sysf_rseg_find_free(), trx_undo_add_page(), trx_undo_assign_undo(), trx_undo_free_page(), and trx_undo_seg_free().
| #define SRV_AUTO_EXTEND_INCREMENT (srv_auto_extend_increment * ((1024 * 1024) / UNIV_PAGE_SIZE)) |
| #define SRV_COM 1 |
| #define SRV_FORCE_IGNORE_CORRUPT 1 |
| #define SRV_FORCE_NO_BACKGROUND 2 |
| #define SRV_FORCE_NO_IBUF_MERGE 4 |
Definition at line 277 of file srv0srv.h.
Referenced by dict_update_statistics_low(), ibuf_merge_or_delete_for_page(), and innobase_start_or_create_for_mysql().
| #define SRV_FORCE_NO_LOG_REDO 6 |
Definition at line 284 of file srv0srv.h.
Referenced by recv_recovery_from_checkpoint_finish(), and recv_recovery_from_checkpoint_start().
| #define SRV_FORCE_NO_TRX_UNDO 3 |
| #define SRV_FORCE_NO_UNDO_LOG_SCAN 5 |
| #define SRV_MASTER 7 |
Definition at line 482 of file srv0srv.h.
Referenced by logs_empty_and_mark_files_at_shutdown(), srv_active_wake_master_thread(), srv_get_n_threads(), srv_get_thread_type(), srv_init(), srv_master_thread(), srv_release_threads(), srv_suspend_thread(), srv_table_reserve_slot(), and srv_wake_master_thread().
| #define SRV_MAX_N_IO_THREADS 100 |
Definition at line 179 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), os_aio_init(), and srv_set_io_thread_op_info().
| #define SRV_NEW_RAW 1 |
Definition at line 74 of file srv0srv.h.
Referenced by open_or_create_data_files(), and srv_parse_data_file_paths_and_sizes().
| #define SRV_OLD_RAW 2 |
Definition at line 75 of file srv0srv.h.
Referenced by open_or_create_data_files(), and srv_parse_data_file_paths_and_sizes().
| #define SRV_RECOVERY 5 |
Definition at line 478 of file srv0srv.h.
Referenced by srv_release_threads(), and srv_suspend_thread().
| #define SRV_UNIX_FDATASYNC 1 |
| #define SRV_UNIX_LITTLESYNC 3 |
Definition at line 256 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), and os_file_pwrite().
| #define SRV_UNIX_NOSYNC 4 |
Definition at line 257 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), log_checkpoint(), log_io_complete(), os_file_pwrite(), trx_commit_complete_for_mysql(), trx_commit_off_kernel(), and trx_prepare_off_kernel().
| #define SRV_UNIX_O_DIRECT 5 |
Definition at line 258 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), and os_file_create().
| #define SRV_UNIX_O_DSYNC 2 |
Definition at line 255 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), log_io_complete(), log_write_up_to(), and os_file_create().
| #define SRV_WIN_IO_NORMAL 1 |
| #define SRV_WIN_IO_UNBUFFERED 2 |
Definition at line 262 of file srv0srv.h.
Referenced by innobase_start_or_create_for_mysql(), and os_file_create().
| #define SRV_WORKER 3 |
Definition at line 474 of file srv0srv.h.
Referenced by srv_get_thread_type(), srv_que_task_enqueue_low(), srv_release_threads(), and srv_suspend_thread().
| typedef struct export_var_struct export_struc |
| typedef struct srv_slot_struct srv_slot_t |
| typedef struct srv_sys_struct srv_sys_t |
| typedef srv_slot_t srv_table_t |
| void srv_active_wake_master_thread | ( | void | ) |
Definition at line 2096 of file srv0srv.c.
References kernel_mutex, mutex_enter, mutex_exit(), srv_activity_count, SRV_MASTER, srv_n_threads_active, and srv_release_threads().
Referenced by trx_general_rollback_for_mysql().
02098 { 02099 srv_activity_count++; 02100 02101 if (srv_n_threads_active[SRV_MASTER] == 0) { 02102 02103 mutex_enter(&kernel_mutex); 02104 02105 srv_release_threads(SRV_MASTER, 1); 02106 02107 mutex_exit(&kernel_mutex); 02108 } 02109 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint srv_boot | ( | void | ) |
Definition at line 1261 of file srv0srv.c.
References DB_SUCCESS, err, srv_general_init(), srv_init(), and srv_normalize_init_values().
Referenced by innobase_start_or_create_for_mysql().
01263 : DB_SUCCESS or error code */ 01264 { 01265 ulint err; 01266 01267 /* Transform the init parameter values given by MySQL to 01268 use units we use inside InnoDB: */ 01269 01270 err = srv_normalize_init_values(); 01271 01272 if (err != DB_SUCCESS) { 01273 return(err); 01274 } 01275 01276 /* Initialize synchronization primitives, memory management, and thread 01277 local storage */ 01278 01279 srv_general_init(); 01280 01281 /* Initialize this module */ 01282 01283 srv_init(); 01284 01285 return(DB_SUCCESS); 01286 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_conc_enter_innodb | ( | trx_t * | trx | ) |
Definition at line 968 of file srv0srv.c.
References trx_struct::declared_to_be_inside_innodb, FALSE, trx_struct::has_search_latch, trx_struct::n_tickets_to_enter_innodb, NULL, trx_struct::op_info, os_fast_mutex_lock(), os_fast_mutex_unlock(), OS_THREAD_MAX_N, os_thread_sleep(), srv_conc_slot_struct::reserved, srv_conc_mutex, srv_conc_n_threads, srv_conc_n_waiting_threads, SRV_FREE_TICKETS_TO_ENTER, srv_thread_concurrency, SRV_THREAD_SLEEP_DELAY, TRUE, trx_struct::trx_locks, trx_print(), UT_LIST_GET_FIRST, and ut_print_timestamp().
00970 : transaction object associated with the 00971 thread */ 00972 { 00973 ibool has_slept = FALSE; 00974 srv_conc_slot_t* slot = NULL; 00975 ulint i; 00976 00977 /* If trx has 'free tickets' to enter the engine left, then use one 00978 such ticket */ 00979 00980 if (trx->n_tickets_to_enter_innodb > 0) { 00981 trx->n_tickets_to_enter_innodb--; 00982 00983 return; 00984 } 00985 00986 os_fast_mutex_lock(&srv_conc_mutex); 00987 retry: 00988 if (trx->declared_to_be_inside_innodb) { 00989 ut_print_timestamp(stderr); 00990 fputs( 00991 " InnoDB: Error: trying to declare trx to enter InnoDB, but\n" 00992 "InnoDB: it already is declared.\n", stderr); 00993 trx_print(stderr, trx, 0); 00994 putc('\n', stderr); 00995 os_fast_mutex_unlock(&srv_conc_mutex); 00996 00997 return; 00998 } 00999 01000 if (srv_conc_n_threads < (lint)srv_thread_concurrency) { 01001 01002 srv_conc_n_threads++; 01003 trx->declared_to_be_inside_innodb = TRUE; 01004 trx->n_tickets_to_enter_innodb = SRV_FREE_TICKETS_TO_ENTER; 01005 01006 os_fast_mutex_unlock(&srv_conc_mutex); 01007 01008 return; 01009 } 01010 01011 /* If the transaction is not holding resources, 01012 let it sleep for SRV_THREAD_SLEEP_DELAY microseconds, and try again then */ 01013 01014 if (!has_slept && !trx->has_search_latch 01015 && NULL == UT_LIST_GET_FIRST(trx->trx_locks)) { 01016 01017 has_slept = TRUE; /* We let is sleep only once to avoid 01018 starvation */ 01019 01020 srv_conc_n_waiting_threads++; 01021 01022 os_fast_mutex_unlock(&srv_conc_mutex); 01023 01024 trx->op_info = "sleeping before joining InnoDB queue"; 01025 01026 /* Peter Zaitsev suggested that we take the sleep away 01027 altogether. But the sleep may be good in pathological 01028 situations of lots of thread switches. Simply put some 01029 threads aside for a while to reduce the number of thread 01030 switches. */ 01031 if (SRV_THREAD_SLEEP_DELAY > 0) { 01032 os_thread_sleep(SRV_THREAD_SLEEP_DELAY); 01033 } 01034 01035 trx->op_info = ""; 01036 01037 os_fast_mutex_lock(&srv_conc_mutex); 01038 01039 srv_conc_n_waiting_threads--; 01040 01041 goto retry; 01042 } 01043 01044 /* Too many threads inside: put the current thread to a queue */ 01045 01046 for (i = 0; i < OS_THREAD_MAX_N; i++) { 01047 slot = srv_conc_slots + i; 01048 01049 if (!slot->reserved) { 01050 01051 break; 01052 } 01053 } 01054 01055 if (i == OS_THREAD_MAX_N) { 01056 /* Could not find a free wait slot, we must let the 01057 thread enter */ 01058 01059 srv_conc_n_threads++; 01060 trx->declared_to_be_inside_innodb = TRUE; 01061 trx->n_tickets_to_enter_innodb = 0; 01062 01063 os_fast_mutex_unlock(&srv_conc_mutex); 01064 01065 return; 01066 } 01067 01068 /* Release possible search system latch this thread has */ 01069 if (trx->has_search_latch) { 01070 trx_search_latch_release_if_reserved(trx); 01071 } 01072 01073 /* Add to the queue */ 01074 slot->reserved = TRUE; 01075 slot->wait_ended = FALSE; 01076 01077 UT_LIST_ADD_LAST(srv_conc_queue, srv_conc_queue, slot); 01078 01079 os_event_reset(slot->event); 01080 01081 srv_conc_n_waiting_threads++; 01082 01083 os_fast_mutex_unlock(&srv_conc_mutex); 01084 01085 /* Go to wait for the event; when a thread leaves InnoDB it will 01086 release this thread */ 01087 01088 trx->op_info = "waiting in InnoDB queue"; 01089 01090 os_event_wait(slot->event); 01091 01092 trx->op_info = ""; 01093 01094 os_fast_mutex_lock(&srv_conc_mutex); 01095 01096 srv_conc_n_waiting_threads--; 01097 01098 /* NOTE that the thread which released this thread already 01099 incremented the thread counter on behalf of this thread */ 01100 01101 slot->reserved = FALSE; 01102 01103 UT_LIST_REMOVE(srv_conc_queue, srv_conc_queue, slot); 01104 01105 trx->declared_to_be_inside_innodb = TRUE; 01106 trx->n_tickets_to_enter_innodb = SRV_FREE_TICKETS_TO_ENTER; 01107 01108 os_fast_mutex_unlock(&srv_conc_mutex); 01109 }
Here is the call graph for this function:

| void srv_conc_exit_innodb | ( | trx_t * | trx | ) |
Definition at line 1194 of file srv0srv.c.
References trx_struct::n_tickets_to_enter_innodb, and srv_conc_force_exit_innodb().
01196 : transaction object associated with the 01197 thread */ 01198 { 01199 if (trx->n_tickets_to_enter_innodb > 0) { 01200 /* We will pretend the thread is still inside InnoDB though it 01201 now leaves the InnoDB engine. In this way we save 01202 a lot of semaphore operations. srv_conc_force_exit_innodb is 01203 used to declare the thread definitely outside InnoDB. It 01204 should be called when there is a lock wait or an SQL statement 01205 ends. */ 01206 01207 return; 01208 } 01209 01210 srv_conc_force_exit_innodb(trx); 01211 }
Here is the call graph for this function:

| void srv_conc_force_enter_innodb | ( | trx_t * | trx | ) |
Definition at line 1116 of file srv0srv.c.
References trx_struct::declared_to_be_inside_innodb, trx_struct::n_tickets_to_enter_innodb, os_fast_mutex_lock(), os_fast_mutex_unlock(), srv_conc_mutex, srv_conc_n_threads, srv_thread_concurrency, and TRUE.
Referenced by srv_suspend_mysql_thread().
01118 : transaction object associated with the 01119 thread */ 01120 { 01121 if (UNIV_LIKELY(!srv_thread_concurrency)) { 01122 01123 return; 01124 } 01125 01126 os_fast_mutex_lock(&srv_conc_mutex); 01127 01128 srv_conc_n_threads++; 01129 trx->declared_to_be_inside_innodb = TRUE; 01130 trx->n_tickets_to_enter_innodb = 0; 01131 01132 os_fast_mutex_unlock(&srv_conc_mutex); 01133 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_conc_force_exit_innodb | ( | trx_t * | trx | ) |
Definition at line 1140 of file srv0srv.c.
References trx_struct::declared_to_be_inside_innodb, srv_conc_slot_struct::event, FALSE, trx_struct::n_tickets_to_enter_innodb, NULL, os_event_set(), os_fast_mutex_lock(), os_fast_mutex_unlock(), srv_conc_mutex, srv_conc_n_threads, srv_thread_concurrency, TRUE, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and srv_conc_slot_struct::wait_ended.
Referenced by srv_conc_exit_innodb(), and srv_suspend_mysql_thread().
01142 : transaction object associated with the 01143 thread */ 01144 { 01145 srv_conc_slot_t* slot = NULL; 01146 01147 if (UNIV_LIKELY(!srv_thread_concurrency)) { 01148 01149 return; 01150 } 01151 01152 if (trx->declared_to_be_inside_innodb == FALSE) { 01153 01154 return; 01155 } 01156 01157 os_fast_mutex_lock(&srv_conc_mutex); 01158 01159 srv_conc_n_threads--; 01160 trx->declared_to_be_inside_innodb = FALSE; 01161 trx->n_tickets_to_enter_innodb = 0; 01162 01163 if (srv_conc_n_threads < (lint)srv_thread_concurrency) { 01164 /* Look for a slot where a thread is waiting and no other 01165 thread has yet released the thread */ 01166 01167 slot = UT_LIST_GET_FIRST(srv_conc_queue); 01168 01169 while (slot && slot->wait_ended == TRUE) { 01170 slot = UT_LIST_GET_NEXT(srv_conc_queue, slot); 01171 } 01172 01173 if (slot != NULL) { 01174 slot->wait_ended = TRUE; 01175 01176 /* We increment the count on behalf of the released 01177 thread */ 01178 01179 srv_conc_n_threads++; 01180 } 01181 } 01182 01183 os_fast_mutex_unlock(&srv_conc_mutex); 01184 01185 if (slot != NULL) { 01186 os_event_set(slot->event); 01187 } 01188 }
Here is the call graph for this function:

Here is the caller graph for this function:

| os_thread_ret_t srv_error_monitor_thread | ( | void * | arg | ) |
| void srv_export_innodb_status | ( | void | ) |
Definition at line 1761 of file srv0srv.c.
References buf_get_latched_pages_number(), buf_pool, buf_pool_struct::curr_size, export_vars, fil_n_log_flushes, fil_n_pending_log_flushes, fil_n_pending_tablespace_flushes, export_var_struct::innodb_buffer_pool_pages_data, export_var_struct::innodb_buffer_pool_pages_dirty, export_var_struct::innodb_buffer_pool_pages_flushed, export_var_struct::innodb_buffer_pool_pages_free, export_var_struct::innodb_buffer_pool_pages_latched, export_var_struct::innodb_buffer_pool_pages_misc, export_var_struct::innodb_buffer_pool_pages_total, export_var_struct::innodb_buffer_pool_read_ahead_rnd, export_var_struct::innodb_buffer_pool_read_ahead_seq, export_var_struct::innodb_buffer_pool_read_requests, export_var_struct::innodb_buffer_pool_reads, export_var_struct::innodb_buffer_pool_wait_free, export_var_struct::innodb_buffer_pool_write_requests, export_var_struct::innodb_data_fsyncs, export_var_struct::innodb_data_pending_fsyncs, export_var_struct::innodb_data_pending_reads, export_var_struct::innodb_data_pending_writes, export_var_struct::innodb_data_read, export_var_struct::innodb_data_reads, export_var_struct::innodb_data_writes, export_var_struct::innodb_data_written, export_var_struct::innodb_dblwr_pages_written, export_var_struct::innodb_dblwr_writes, export_var_struct::innodb_log_waits, export_var_struct::innodb_log_write_requests, export_var_struct::innodb_log_writes, export_var_struct::innodb_os_log_fsyncs, export_var_struct::innodb_os_log_pending_fsyncs, export_var_struct::innodb_os_log_pending_writes, export_var_struct::innodb_os_log_written, export_var_struct::innodb_page_size, export_var_struct::innodb_pages_created, export_var_struct::innodb_pages_read, export_var_struct::innodb_pages_written, export_var_struct::innodb_row_lock_current_waits, export_var_struct::innodb_row_lock_time, export_var_struct::innodb_row_lock_time_avg, export_var_struct::innodb_row_lock_time_max, export_var_struct::innodb_row_lock_waits, export_var_struct::innodb_rows_deleted, export_var_struct::innodb_rows_inserted, export_var_struct::innodb_rows_read, export_var_struct::innodb_rows_updated, buf_pool_struct::max_size, mutex_enter, mutex_exit(), buf_pool_struct::n_page_gets, buf_pool_struct::n_pages_created, buf_pool_struct::n_pages_read, buf_pool_struct::n_pages_written, os_n_file_reads, os_n_file_writes, os_n_fsyncs, os_n_pending_reads, os_n_pending_writes, srv_buf_pool_flushed, srv_buf_pool_reads, srv_buf_pool_wait_free, srv_buf_pool_write_requests, srv_data_read, srv_data_written, srv_dblwr_pages_written, srv_dblwr_writes, srv_log_waits, srv_log_write_requests, srv_log_writes, srv_n_rows_deleted, srv_n_rows_inserted, srv_n_rows_read, srv_n_rows_updated, srv_os_log_pending_writes, srv_os_log_written, srv_read_ahead_rnd, srv_read_ahead_seq, UNIV_PAGE_SIZE, and UT_LIST_GET_LEN.
01762 { 01763 01764 mutex_enter(&srv_innodb_monitor_mutex); 01765 export_vars.innodb_data_pending_reads= os_n_pending_reads; 01766 export_vars.innodb_data_pending_writes= os_n_pending_writes; 01767 export_vars.innodb_data_pending_fsyncs= 01768 fil_n_pending_log_flushes + fil_n_pending_tablespace_flushes; 01769 export_vars.innodb_data_fsyncs= os_n_fsyncs; 01770 export_vars.innodb_data_read= srv_data_read; 01771 export_vars.innodb_data_reads= os_n_file_reads; 01772 export_vars.innodb_data_writes= os_n_file_writes; 01773 export_vars.innodb_data_written= srv_data_written; 01774 export_vars.innodb_buffer_pool_read_requests= buf_pool->n_page_gets; 01775 export_vars.innodb_buffer_pool_write_requests= srv_buf_pool_write_requests; 01776 export_vars.innodb_buffer_pool_wait_free= srv_buf_pool_wait_free; 01777 export_vars.innodb_buffer_pool_pages_flushed= srv_buf_pool_flushed; 01778 export_vars.innodb_buffer_pool_reads= srv_buf_pool_reads; 01779 export_vars.innodb_buffer_pool_read_ahead_rnd= srv_read_ahead_rnd; 01780 export_vars.innodb_buffer_pool_read_ahead_seq= srv_read_ahead_seq; 01781 export_vars.innodb_buffer_pool_pages_data= UT_LIST_GET_LEN(buf_pool->LRU); 01782 export_vars.innodb_buffer_pool_pages_dirty= UT_LIST_GET_LEN(buf_pool->flush_list); 01783 export_vars.innodb_buffer_pool_pages_free= UT_LIST_GET_LEN(buf_pool->free); 01784 export_vars.innodb_buffer_pool_pages_latched= buf_get_latched_pages_number(); 01785 export_vars.innodb_buffer_pool_pages_total= buf_pool->curr_size; 01786 export_vars.innodb_buffer_pool_pages_misc= buf_pool->max_size - 01787 UT_LIST_GET_LEN(buf_pool->LRU) - UT_LIST_GET_LEN(buf_pool->free); 01788 export_vars.innodb_page_size= UNIV_PAGE_SIZE; 01789 export_vars.innodb_log_waits= srv_log_waits; 01790 export_vars.innodb_os_log_written= srv_os_log_written; 01791 export_vars.innodb_os_log_fsyncs= fil_n_log_flushes; 01792 export_vars.innodb_os_log_pending_fsyncs= fil_n_pending_log_flushes; 01793 export_vars.innodb_os_log_pending_writes= srv_os_log_pending_writes; 01794 export_vars.innodb_log_write_requests= srv_log_write_requests; 01795 export_vars.innodb_log_writes= srv_log_writes; 01796 export_vars.innodb_dblwr_pages_written= srv_dblwr_pages_written; 01797 export_vars.innodb_dblwr_writes= srv_dblwr_writes; 01798 export_vars.innodb_pages_created= buf_pool->n_pages_created; 01799 export_vars.innodb_pages_read= buf_pool->n_pages_read; 01800 export_vars.innodb_pages_written= buf_pool->n_pages_written; 01801 export_vars.innodb_row_lock_waits= srv_n_lock_wait_count; 01802 export_vars.innodb_row_lock_current_waits= srv_n_lock_wait_current_count; 01803 export_vars.innodb_row_lock_time= srv_n_lock_wait_time / 10000; 01804 if (srv_n_lock_wait_count > 0) { 01805 export_vars.innodb_row_lock_time_avg = (ulint) 01806 (srv_n_lock_wait_time / 10000 / srv_n_lock_wait_count); 01807 } else { 01808 export_vars.innodb_row_lock_time_avg = 0; 01809 } 01810 export_vars.innodb_row_lock_time_max= srv_n_lock_max_wait_time / 10000; 01811 export_vars.innodb_rows_read= srv_n_rows_read; 01812 export_vars.innodb_rows_inserted= srv_n_rows_inserted; 01813 export_vars.innodb_rows_updated= srv_n_rows_updated; 01814 export_vars.innodb_rows_deleted= srv_n_rows_deleted; 01815 mutex_exit(&srv_innodb_monitor_mutex); 01816 01817 }
Here is the call graph for this function:

| void srv_free | ( | void | ) |
Definition at line 938 of file srv0srv.c.
References os_fast_mutex_free(), and srv_conc_mutex.
Referenced by innobase_shutdown_for_mysql().
00940 { 00941 os_fast_mutex_free(&srv_conc_mutex); 00942 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_general_init | ( | void | ) |
Definition at line 949 of file srv0srv.c.
References mem_init(), os_sync_init(), srv_mem_pool_size, sync_init(), and thr_local_init().
Referenced by srv_boot().
00951 { 00952 os_sync_init(); 00953 sync_init(); 00954 mem_init(srv_mem_pool_size); 00955 thr_local_init(); 00956 }
Here is the call graph for this function:

Here is the caller graph for this function:

| ulint srv_get_n_threads | ( | void | ) |
Definition at line 652 of file srv0srv.c.
References kernel_mutex, mutex_enter, mutex_exit(), SRV_COM, SRV_MASTER, and srv_n_threads.
00654 { 00655 ulint i; 00656 ulint n_threads = 0; 00657 00658 mutex_enter(&kernel_mutex); 00659 00660 for (i = SRV_COM; i < SRV_MASTER + 1; i++) { 00661 00662 n_threads += srv_n_threads[i]; 00663 } 00664 00665 mutex_exit(&kernel_mutex); 00666 00667 return(n_threads); 00668 }
Here is the call graph for this function:

| ulint srv_get_thread_type | ( | void | ) |
Definition at line 816 of file srv0srv.c.
References kernel_mutex, mutex_enter, mutex_exit(), os_thread_get_curr_id(), SRV_MASTER, srv_table_get_nth_slot(), SRV_WORKER, thr_local_get_slot_no(), and ut_ad.
00818 : SRV_COM, ... */ 00819 { 00820 ulint slot_no; 00821 srv_slot_t* slot; 00822 ulint type; 00823 00824 mutex_enter(&kernel_mutex); 00825 00826 slot_no = thr_local_get_slot_no(os_thread_get_curr_id()); 00827 00828 slot = srv_table_get_nth_slot(slot_no); 00829 00830 type = slot->type; 00831 00832 ut_ad(type >= SRV_WORKER); 00833 ut_ad(type <= SRV_MASTER); 00834 00835 mutex_exit(&kernel_mutex); 00836 00837 return(type); 00838 }
Here is the call graph for this function:

| void srv_init | ( | void | ) |
Definition at line 844 of file srv0srv.c.
References dict_index_struct::cached, DATA_CHAR, DATA_ENGLISH, DATA_NOT_NULL, DICT_HDR_SPACE, dict_index_add_col(), dict_mem_index_create(), dict_mem_table_add_col(), dict_mem_table_create(), dict_table_get_nth_col(), DICT_TF_COMPACT, srv_sys_struct::dummy_ind1, srv_sys_struct::dummy_ind2, srv_conc_slot_struct::event, FALSE, kernel_mutex, kernel_mutex_temp, mem_alloc, mutex_create, NULL, os_event_create(), os_fast_mutex_init(), OS_THREAD_MAX_N, srv_conc_slot_struct::reserved, srv_conc_mutex, srv_lock_timeout_thread_event, SRV_MASTER, srv_meter, srv_meter_foreground, srv_meter_high_water, srv_meter_high_water2, srv_meter_low_water, srv_mysql_table, srv_n_threads, srv_n_threads_active, srv_sys, srv_table_get_nth_slot(), SYNC_KERNEL, SYNC_NO_ORDER_CHECK, dict_index_struct::table, srv_sys_struct::tasks, srv_sys_struct::threads, TRUE, ut_a, and UT_LIST_INIT.
Referenced by srv_boot().
00846 { 00847 srv_conc_slot_t* conc_slot; 00848 srv_slot_t* slot; 00849 dict_table_t* table; 00850 ulint i; 00851 00852 srv_sys = mem_alloc(sizeof(srv_sys_t)); 00853 00854 kernel_mutex_temp = mem_alloc(sizeof(mutex_t)); 00855 mutex_create(&kernel_mutex, SYNC_KERNEL); 00856 00857 mutex_create(&srv_innodb_monitor_mutex, SYNC_NO_ORDER_CHECK); 00858 00859 srv_sys->threads = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_slot_t)); 00860 00861 for (i = 0; i < OS_THREAD_MAX_N; i++) { 00862 slot = srv_table_get_nth_slot(i); 00863 slot->in_use = FALSE; 00864 slot->type=0; /* Avoid purify errors */ 00865 slot->event = os_event_create(NULL); 00866 ut_a(slot->event); 00867 } 00868 00869 srv_mysql_table = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_slot_t)); 00870 00871 for (i = 0; i < OS_THREAD_MAX_N; i++) { 00872 slot = srv_mysql_table + i; 00873 slot->in_use = FALSE; 00874 slot->type = 0; 00875 slot->event = os_event_create(NULL); 00876 ut_a(slot->event); 00877 } 00878 00879 srv_lock_timeout_thread_event = os_event_create(NULL); 00880 00881 for (i = 0; i < SRV_MASTER + 1; i++) { 00882 srv_n_threads_active[i] = 0; 00883 srv_n_threads[i] = 0; 00884 srv_meter[i] = 30; 00885 srv_meter_low_water[i] = 50; 00886 srv_meter_high_water[i] = 100; 00887 srv_meter_high_water2[i] = 200; 00888 srv_meter_foreground[i] = 250; 00889 } 00890 00891 UT_LIST_INIT(srv_sys->tasks); 00892 00893 /* create dummy table and index for old-style infimum and supremum */ 00894 table = dict_mem_table_create("SYS_DUMMY1", 00895 DICT_HDR_SPACE, 1, 0); 00896 dict_mem_table_add_col(table, "DUMMY", DATA_CHAR, 00897 DATA_ENGLISH | DATA_NOT_NULL, 8, 0); 00898 00899 srv_sys->dummy_ind1 = dict_mem_index_create("SYS_DUMMY1", 00900 "SYS_DUMMY1", DICT_HDR_SPACE, 0, 1); 00901 dict_index_add_col(srv_sys->dummy_ind1, 00902 dict_table_get_nth_col(table, 0), 0); 00903 srv_sys->dummy_ind1->table = table; 00904 /* create dummy table and index for new-style infimum and supremum */ 00905 table = dict_mem_table_create("SYS_DUMMY2", 00906 DICT_HDR_SPACE, 1, DICT_TF_COMPACT); 00907 dict_mem_table_add_col(table, "DUMMY", DATA_CHAR, 00908 DATA_ENGLISH | DATA_NOT_NULL, 8, 0); 00909 srv_sys->dummy_ind2 = dict_mem_index_create("SYS_DUMMY2", 00910 "SYS_DUMMY2", DICT_HDR_SPACE, 0, 1); 00911 dict_index_add_col(srv_sys->dummy_ind2, 00912 dict_table_get_nth_col(table, 0), 0); 00913 srv_sys->dummy_ind2->table = table; 00914 00915 /* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */ 00916 srv_sys->dummy_ind1->cached = srv_sys->dummy_ind2->cached = TRUE; 00917 00918 /* Init the server concurrency restriction data structures */ 00919 00920 os_fast_mutex_init(&srv_conc_mutex); 00921 00922 UT_LIST_INIT(srv_conc_queue); 00923 00924 srv_conc_slots = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_conc_slot_t)); 00925 00926 for (i = 0; i < OS_THREAD_MAX_N; i++) { 00927 conc_slot = srv_conc_slots + i; 00928 conc_slot->reserved = FALSE; 00929 conc_slot->event = os_event_create(NULL); 00930 ut_a(conc_slot->event); 00931 } 00932 }
Here is the call graph for this function:

Here is the caller graph for this function:

| os_thread_ret_t srv_lock_timeout_and_monitor_thread | ( | void * | arg | ) |
| os_thread_ret_t srv_master_thread | ( | void * | arg | ) |
Definition at line 1582 of file srv0srv.c.
References btr_cur_n_non_sea, btr_cur_n_non_sea_old, btr_cur_n_sea, btr_cur_n_sea_old, btr_search_sys, buf_print_io(), current_time(), dict_foreign_err_file, dict_foreign_err_mutex, dict_sys, fil_space_get_n_reserved_extents(), ha_print_info(), btr_search_sys_struct::hash_index, ibuf_print(), lock_print_info_all_transactions(), lock_print_info_summary(), log_print(), mem_comm_pool, mem_pool_get_reserved(), mutex_enter, mutex_exit(), NULL, os_aio_print(), dict_sys_struct::size, srv_conc_n_threads, srv_conc_n_waiting_threads, srv_main_thread_op_info, srv_n_rows_deleted, srv_n_rows_inserted, srv_n_rows_read, srv_n_rows_updated, srv_pool_size, srv_use_awe, sync_print(), trx_sys, UNIV_PAGE_SIZE, ut_copy_file(), UT_LIST_GET_LEN, ut_print_timestamp(), and ut_total_allocated_memory.
Referenced by srv_lock_timeout_and_monitor_thread().
01584 : output stream */ 01585 ulint* trx_start, /* out: file position of the start of 01586 the list of active transactions */ 01587 ulint* trx_end) /* out: file position of the end of 01588 the list of active transactions */ 01589 { 01590 double time_elapsed; 01591 time_t current_time; 01592 ulint n_reserved; 01593 01594 mutex_enter(&srv_innodb_monitor_mutex); 01595 01596 current_time = time(NULL); 01597 01598 /* We add 0.001 seconds to time_elapsed to prevent division 01599 by zero if two users happen to call SHOW INNODB STATUS at the same 01600 time */ 01601 01602 time_elapsed = difftime(current_time, srv_last_monitor_time) 01603 + 0.001; 01604 01605 srv_last_monitor_time = time(NULL); 01606 01607 fputs("\n=====================================\n", file); 01608 01609 ut_print_timestamp(file); 01610 fprintf(file, 01611 " INNODB MONITOR OUTPUT\n" 01612 "=====================================\n" 01613 "Per second averages calculated from the last %lu seconds\n", 01614 (ulong)time_elapsed); 01615 01616 fputs("----------\n" 01617 "SEMAPHORES\n" 01618 "----------\n", file); 01619 sync_print(file); 01620 01621 /* Conceptually, srv_innodb_monitor_mutex has a very high latching 01622 order level in sync0sync.h, while dict_foreign_err_mutex has a very 01623 low level 135. Therefore we can reserve the latter mutex here without 01624 a danger of a deadlock of threads. */ 01625 01626 mutex_enter(&dict_foreign_err_mutex); 01627 01628 if (ftell(dict_foreign_err_file) != 0L) { 01629 fputs("------------------------\n" 01630 "LATEST FOREIGN KEY ERROR\n" 01631 "------------------------\n", file); 01632 ut_copy_file(file, dict_foreign_err_file); 01633 } 01634 01635 mutex_exit(&dict_foreign_err_mutex); 01636 01637 lock_print_info_summary(file); 01638 if (trx_start) { 01639 long t = ftell(file); 01640 if (t < 0) { 01641 *trx_start = ULINT_UNDEFINED; 01642 } else { 01643 *trx_start = (ulint) t; 01644 } 01645 } 01646 lock_print_info_all_transactions(file); 01647 if (trx_end) { 01648 long t = ftell(file); 01649 if (t < 0) { 01650 *trx_end = ULINT_UNDEFINED; 01651 } else { 01652 *trx_end = (ulint) t; 01653 } 01654 } 01655 fputs("--------\n" 01656 "FILE I/O\n" 01657 "--------\n", file); 01658 os_aio_print(file); 01659 01660 fputs("-------------------------------------\n" 01661 "INSERT BUFFER AND ADAPTIVE HASH INDEX\n" 01662 "-------------------------------------\n", file); 01663 ibuf_print(file); 01664 01665 ha_print_info(file, btr_search_sys->hash_index); 01666 01667 fprintf(file, 01668 "%.2f hash searches/s, %.2f non-hash searches/s\n", 01669 (btr_cur_n_sea - btr_cur_n_sea_old) 01670 / time_elapsed, 01671 (btr_cur_n_non_sea - btr_cur_n_non_sea_old) 01672 / time_elapsed); 01673 btr_cur_n_sea_old = btr_cur_n_sea; 01674 btr_cur_n_non_sea_old = btr_cur_n_non_sea; 01675 01676 fputs("---\n" 01677 "LOG\n" 01678 "---\n", file); 01679 log_print(file); 01680 01681 fputs("----------------------\n" 01682 "BUFFER POOL AND MEMORY\n" 01683 "----------------------\n", file); 01684 fprintf(file, 01685 "Total memory allocated " ULINTPF 01686 "; in additional pool allocated " ULINTPF "\n", 01687 ut_total_allocated_memory, 01688 mem_pool_get_reserved(mem_comm_pool)); 01689 fprintf(file, "Dictionary memory allocated " ULINTPF "\n", 01690 dict_sys->size); 01691 01692 if (srv_use_awe) { 01693 fprintf(file, 01694 "In addition to that %lu MB of AWE memory allocated\n", 01695 (ulong) (srv_pool_size / ((1024 * 1024) / UNIV_PAGE_SIZE))); 01696 } 01697 01698 buf_print_io(file); 01699 01700 fputs("--------------\n" 01701 "ROW OPERATIONS\n" 01702 "--------------\n", file); 01703 fprintf(file, "%ld queries inside InnoDB, %lu queries in queue\n", 01704 (long) srv_conc_n_threads, 01705 (ulong) srv_conc_n_waiting_threads); 01706 01707 fprintf(file, "%lu read views open inside InnoDB\n", 01708 UT_LIST_GET_LEN(trx_sys->view_list)); 01709 01710 n_reserved = fil_space_get_n_reserved_extents(0); 01711 if (n_reserved > 0) { 01712 fprintf(file, 01713 "%lu tablespace extents now reserved for B-tree split operations\n", 01714 (ulong) n_reserved); 01715 } 01716 01717 #ifdef UNIV_LINUX 01718 fprintf(file, "Main thread process no. %lu, id %lu, state: %s\n", 01719 (ulong) srv_main_thread_process_no, 01720 (ulong) srv_main_thread_id, 01721 srv_main_thread_op_info); 01722 #else 01723 fprintf(file, "Main thread id %lu, state: %s\n", 01724 (ulong) srv_main_thread_id, 01725 srv_main_thread_op_info); 01726 #endif 01727 fprintf(file, 01728 "Number of rows inserted " ULINTPF 01729 ", updated " ULINTPF ", deleted " ULINTPF ", read " ULINTPF "\n", 01730 srv_n_rows_inserted, 01731 srv_n_rows_updated, 01732 srv_n_rows_deleted, 01733 srv_n_rows_read); 01734 fprintf(file, 01735 "%.2f inserts/s, %.2f updates/s, %.2f deletes/s, %.2f reads/s\n", 01736 (srv_n_rows_inserted - srv_n_rows_inserted_old) 01737 / time_elapsed, 01738 (srv_n_rows_updated - srv_n_rows_updated_old) 01739 / time_elapsed, 01740 (srv_n_rows_deleted - srv_n_rows_deleted_old) 01741 / time_elapsed, 01742 (srv_n_rows_read - srv_n_rows_read_old) 01743 / time_elapsed); 01744 01745 srv_n_rows_inserted_old = srv_n_rows_inserted; 01746 srv_n_rows_updated_old = srv_n_rows_updated; 01747 srv_n_rows_deleted_old = srv_n_rows_deleted; 01748 srv_n_rows_read_old = srv_n_rows_read; 01749 01750 fputs("----------------------------\n" 01751 "END OF INNODB MONITOR OUTPUT\n" 01752 "============================\n", file); 01753 mutex_exit(&srv_innodb_monitor_mutex); 01754 fflush(file); 01755 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_release_mysql_thread_if_suspended | ( | que_thr_t * | thr | ) |
Definition at line 1514 of file srv0srv.c.
References kernel_mutex, os_event_set(), OS_THREAD_MAX_N, srv_mysql_table, and ut_ad.
Referenced by que_thr_end_wait_no_next_thr().
01516 : query thread associated with the 01517 MySQL OS thread */ 01518 { 01519 #ifndef UNIV_HOTBACKUP 01520 srv_slot_t* slot; 01521 ulint i; 01522 01523 #ifdef UNIV_SYNC_DEBUG 01524 ut_ad(mutex_own(&kernel_mutex)); 01525 #endif /* UNIV_SYNC_DEBUG */ 01526 01527 for (i = 0; i < OS_THREAD_MAX_N; i++) { 01528 01529 slot = srv_mysql_table + i; 01530 01531 if (slot->in_use && slot->thr == thr) { 01532 /* Found */ 01533 01534 os_event_set(slot->event); 01535 01536 return; 01537 } 01538 } 01539 01540 /* not found */ 01541 #else /* UNIV_HOTBACKUP */ 01542 /* This function depends on MySQL code that is not included in 01543 InnoDB Hot Backup builds. Besides, this function should never 01544 be called in InnoDB Hot Backup. */ 01545 ut_error; 01546 #endif /* UNIV_HOTBACKUP */ 01547 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 763 of file srv0srv.c.
References count, FALSE, kernel_mutex, os_event_set(), OS_THREAD_MAX_N, SRV_MASTER, srv_meter, srv_n_threads_active, srv_print_thread_releases, SRV_RECOVERY, srv_table_get_nth_slot(), SRV_WORKER, and ut_ad.
Referenced by srv_active_wake_master_thread(), srv_que_task_enqueue_low(), and srv_wake_master_thread().
00765 : number of threads released: this may be 00766 < n if not enough threads were suspended at the 00767 moment */ 00768 ulint type, /* in: thread type */ 00769 ulint n) /* in: number of threads to release */ 00770 { 00771 srv_slot_t* slot; 00772 ulint i; 00773 ulint count = 0; 00774 00775 ut_ad(type >= SRV_WORKER); 00776 ut_ad(type <= SRV_MASTER); 00777 ut_ad(n > 0); 00778 #ifdef UNIV_SYNC_DEBUG 00779 ut_ad(mutex_own(&kernel_mutex)); 00780 #endif /* UNIV_SYNC_DEBUG */ 00781 00782 for (i = 0; i < OS_THREAD_MAX_N; i++) { 00783 00784 slot = srv_table_get_nth_slot(i); 00785 00786 if (slot->in_use && slot->type == type && slot->suspended) { 00787 00788 slot->suspended = FALSE; 00789 00790 srv_n_threads_active[type]++; 00791 00792 os_event_set(slot->event); 00793 00794 if (srv_print_thread_releases) { 00795 fprintf(stderr, 00796 "Releasing thread %lu type %lu from slot %lu meter %lu\n", 00797 (ulong) slot->id, (ulong) type, (ulong) i, 00798 (ulong) srv_meter[SRV_RECOVERY]); 00799 } 00800 00801 count++; 00802 00803 if (count == n) { 00804 break; 00805 } 00806 } 00807 } 00808 00809 return(count); 00810 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_set_io_thread_op_info | ( | ulint | i, | |
| const char * | str | |||
| ) |
Definition at line 621 of file srv0srv.c.
References srv_io_thread_op_info, SRV_MAX_N_IO_THREADS, and ut_a.
Referenced by fil_aio_wait(), os_aio_init(), and os_aio_simulated_handle().
00623 : the 'segment' of the i/o thread */ 00624 const char* str) /* in: constant char string describing the 00625 state */ 00626 { 00627 ut_a(i < SRV_MAX_N_IO_THREADS); 00628 00629 srv_io_thread_op_info[i] = str; 00630 }
Here is the caller graph for this function:

| void srv_suspend_mysql_thread | ( | que_thr_t * | thr | ) |
Definition at line 1357 of file srv0srv.c.
References DB_DEADLOCK, DB_LOCK_WAIT_TIMEOUT, DB_SUCCESS, trx_struct::declared_to_be_inside_innodb, trx_struct::dict_operation_lock_mode, trx_struct::error_state, FALSE, que_thr_struct::is_active, kernel_mutex, que_thr_struct::lock_state, mutex_enter, mutex_exit(), os_event_reset(), os_event_set(), os_event_wait(), QUE_THR_LOCK_ROW, QUE_THR_RUNNING, row_mysql_freeze_data_dictionary(), row_mysql_unfreeze_data_dictionary(), RW_S_LATCH, sec, srv_conc_force_enter_innodb(), srv_conc_force_exit_innodb(), srv_lock_timeout_thread_event, srv_lock_wait_timeout, srv_table_reserve_slot_for_mysql(), start_time, que_thr_struct::state, thr_get_trx(), TRUE, ut_a, ut_ad, ut_difftime(), ut_error, ut_time(), ut_usectime(), wait_time, and trx_struct::was_chosen_as_deadlock_victim.
Referenced by que_run_threads(), row_mysql_handle_errors(), and row_update_cascade_for_mysql().
01359 : query thread associated with the MySQL 01360 OS thread */ 01361 { 01362 #ifndef UNIV_HOTBACKUP 01363 srv_slot_t* slot; 01364 os_event_t event; 01365 double wait_time; 01366 trx_t* trx; 01367 ibool had_dict_lock = FALSE; 01368 ibool was_declared_inside_innodb = FALSE; 01369 ib_longlong start_time = 0; 01370 ib_longlong finish_time; 01371 ulint diff_time; 01372 ulint sec; 01373 ulint ms; 01374 01375 #ifdef UNIV_SYNC_DEBUG 01376 ut_ad(!mutex_own(&kernel_mutex)); 01377 #endif /* UNIV_SYNC_DEBUG */ 01378 01379 trx = thr_get_trx(thr); 01380 01381 os_event_set(srv_lock_timeout_thread_event); 01382 01383 mutex_enter(&kernel_mutex); 01384 01385 trx->error_state = DB_SUCCESS; 01386 01387 if (thr->state == QUE_THR_RUNNING) { 01388 01389 ut_ad(thr->is_active == TRUE); 01390 01391 /* The lock has already been released or this transaction 01392 was chosen as a deadlock victim: no need to suspend */ 01393 01394 if (trx->was_chosen_as_deadlock_victim) { 01395 01396 trx->error_state = DB_DEADLOCK; 01397 trx->was_chosen_as_deadlock_victim = FALSE; 01398 } 01399 01400 mutex_exit(&kernel_mutex); 01401 01402 return; 01403 } 01404 01405 ut_ad(thr->is_active == FALSE); 01406 01407 slot = srv_table_reserve_slot_for_mysql(); 01408 01409 event = slot->event; 01410 01411 slot->thr = thr; 01412 01413 os_event_reset(event); 01414 01415 slot->suspend_time = ut_time(); 01416 01417 if (thr->lock_state == QUE_THR_LOCK_ROW) { 01418 srv_n_lock_wait_count++; 01419 srv_n_lock_wait_current_count++; 01420 01421 ut_usectime(&sec, &ms); 01422 start_time = (ib_longlong)sec * 1000000 + ms; 01423 } 01424 /* Wake the lock timeout monitor thread, if it is suspended */ 01425 01426 os_event_set(srv_lock_timeout_thread_event); 01427 01428 mutex_exit(&kernel_mutex); 01429 01430 if (trx->declared_to_be_inside_innodb) { 01431 01432 was_declared_inside_innodb = TRUE; 01433 01434 /* We must declare this OS thread to exit InnoDB, since a 01435 possible other thread holding a lock which this thread waits 01436 for must be allowed to enter, sooner or later */ 01437 01438 srv_conc_force_exit_innodb(trx); 01439 } 01440 01441 /* Release possible foreign key check latch */ 01442 if (trx->dict_operation_lock_mode == RW_S_LATCH) { 01443 01444 had_dict_lock = TRUE; 01445 01446 row_mysql_unfreeze_data_dictionary(trx); 01447 } 01448 01449 ut_a(trx->dict_operation_lock_mode == 0); 01450 01451 /* Wait for the release */ 01452 01453 os_event_wait(event); 01454 01455 if (had_dict_lock) { 01456 01457 row_mysql_freeze_data_dictionary(trx); 01458 } 01459 01460 if (was_declared_inside_innodb) { 01461 01462 /* Return back inside InnoDB */ 01463 01464 srv_conc_force_enter_innodb(trx); 01465 } 01466 01467 mutex_enter(&kernel_mutex); 01468 01469 /* Release the slot for others to use */ 01470 01471 slot->in_use = FALSE; 01472 01473 wait_time = ut_difftime(ut_time(), slot->suspend_time); 01474 01475 if (thr->lock_state == QUE_THR_LOCK_ROW) { 01476 ut_usectime(&sec, &ms); 01477 finish_time = (ib_longlong)sec * 1000000 + ms; 01478 01479 diff_time = (ulint) (finish_time - start_time); 01480 01481 srv_n_lock_wait_current_count--; 01482 srv_n_lock_wait_time = srv_n_lock_wait_time + diff_time; 01483 if (diff_time > srv_n_lock_max_wait_time) { 01484 srv_n_lock_max_wait_time = diff_time; 01485 } 01486 } 01487 01488 if (trx->was_chosen_as_deadlock_victim) { 01489 01490 trx->error_state = DB_DEADLOCK; 01491 trx->was_chosen_as_deadlock_victim = FALSE; 01492 } 01493 01494 mutex_exit(&kernel_mutex); 01495 01496 if (srv_lock_wait_timeout < 100000000 && 01497 wait_time > (double)srv_lock_wait_timeout) { 01498 01499 trx->error_state = DB_LOCK_WAIT_TIMEOUT; 01500 } 01501 #else /* UNIV_HOTBACKUP */ 01502 /* This function depends on MySQL code that is not included in 01503 InnoDB Hot Backup builds. Besides, this function should never 01504 be called in InnoDB Hot Backup. */ 01505 ut_error; 01506 #endif /* UNIV_HOTBACKUP */ 01507 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void srv_wake_master_thread | ( | void | ) |
Definition at line 2115 of file srv0srv.c.
References kernel_mutex, mutex_enter, mutex_exit(), srv_activity_count, SRV_MASTER, and srv_release_threads().
Referenced by innobase_shutdown_for_mysql(), row_drop_table_for_mysql(), and row_truncate_table_for_mysql().
02117 { 02118 srv_activity_count++; 02119 02120 mutex_enter(&kernel_mutex); 02121 02122 srv_release_threads(SRV_MASTER, 1); 02123 02124 mutex_exit(&kernel_mutex); 02125 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 57 of file srv0srv.c.
Referenced by row_undo_step(), srv_active_wake_master_thread(), srv_master_thread(), and srv_wake_master_thread().
Definition at line 96 of file srv0srv.c.
Referenced by fsp_fill_free_list(), fsp_try_extend_data_file(), innobase_start_or_create_for_mysql(), and open_or_create_data_files().
Definition at line 163 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and srv_normalize_init_values().
Definition at line 233 of file srv0srv.c.
Referenced by buf_flush_batch(), and srv_export_innodb_status().
Definition at line 229 of file srv0srv.c.
Referenced by buf_LRU_get_free_block(), and srv_export_innodb_status().
| lint srv_conc_n_threads |
Definition at line 272 of file srv0srv.c.
Referenced by innobase_shutdown_for_mysql(), srv_conc_enter_innodb(), srv_conc_force_enter_innodb(), srv_conc_force_exit_innodb(), and srv_printf_innodb_monitor().
| ibool srv_created_new_raw |
Definition at line 111 of file srv0srv.c.
Referenced by open_or_create_data_files(), row_create_table_for_mysql(), row_drop_table_for_mysql(), row_insert_for_mysql(), row_rename_table_for_mysql(), row_truncate_table_for_mysql(), and row_update_for_mysql().
| char** srv_data_file_names |
Definition at line 94 of file srv0srv.c.
Referenced by fil_extend_space_to_desired_size(), fsp_try_extend_data_file(), innobase_start_or_create_for_mysql(), open_or_create_data_files(), and srv_normalize_init_values().
| char* srv_data_home |
| FILE* srv_dict_tmpfile |
Referenced by innobase_shutdown_for_mysql(), innobase_start_or_create_for_mysql(), and UT_LIST_BASE_NODE_T().
Referenced by innobase_shutdown_for_mysql(), innobase_start_or_create_for_mysql(), and UT_LIST_BASE_NODE_T().
Definition at line 64 of file srv0srv.c.
Referenced by row_mysql_delay_if_needed(), and trx_purge().
| ibool srv_error_monitor_active |
Definition at line 67 of file srv0srv.c.
Referenced by logs_empty_and_mark_files_at_shutdown(), and srv_error_monitor_thread().
Definition at line 60 of file srv0srv.c.
Referenced by dict_print(), row_check_table_for_mysql(), srv_error_monitor_thread(), and sync_array_print_long_waits().
| ibool srv_file_per_table |
Definition at line 84 of file srv0srv.c.
Referenced by dict_build_table_def_step(), and innobase_start_or_create_for_mysql().
Definition at line 251 of file srv0srv.c.
Referenced by buf_page_io_complete(), dict_update_statistics_low(), fil_load_single_table_tablespace(), ibuf_merge_or_delete_for_page(), innobase_start_or_create_for_mysql(), recv_recovery_from_checkpoint_finish(), recv_recovery_from_checkpoint_start(), row_insert_for_mysql(), row_rename_table_for_mysql(), row_search_for_mysql(), row_update_for_mysql(), srv_master_thread(), trx_lists_init_at_db_start(), and trx_undo_lists_init().
| ibool srv_innodb_status |
| const char* srv_io_thread_function[] |
Referenced by os_aio_init(), os_aio_print(), and UT_LIST_BASE_NODE_T().
| const char* srv_io_thread_op_info[] |
Referenced by os_aio_print(), srv_set_io_thread_op_info(), and UT_LIST_BASE_NODE_T().
Definition at line 99 of file srv0srv.c.
Referenced by fsp_try_extend_data_file(), open_or_create_data_files(), and srv_normalize_init_values().
| byte srv_latin1_ordering[256] |
Definition at line 168 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and srv_normalize_init_values().
Definition at line 66 of file srv0srv.c.
Referenced by logs_empty_and_mark_files_at_shutdown(), and srv_lock_timeout_and_monitor_thread().
Definition at line 585 of file srv0srv.c.
Referenced by buf_LRU_get_free_block(), innobase_shutdown_for_mysql(), row_create_table_for_mysql(), srv_init(), and srv_suspend_mysql_thread().
Definition at line 178 of file srv0srv.c.
Referenced by srv_lock_timeout_and_monitor_thread(), and srv_suspend_mysql_thread().
Definition at line 88 of file srv0srv.c.
Referenced by lock_rec_inherit_to_gap(), lock_rec_lock_fast(), lock_rec_lock_slow(), row_search_for_mysql(), row_sel(), row_sel_get_clust_rec(), and row_unlock_for_mysql().
Definition at line 117 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), open_or_create_log_file(), and srv_normalize_init_values().
| char** srv_log_group_home_dirs |
Definition at line 113 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and open_or_create_log_file().
Definition at line 213 of file srv0srv.c.
Referenced by log_reserve_and_open(), and srv_export_innodb_status().
Definition at line 200 of file srv0srv.c.
Referenced by log_write_low(), and srv_export_innodb_status().
Definition at line 203 of file srv0srv.c.
Referenced by log_group_write_buf(), and srv_export_innodb_status().
| const char* srv_main_thread_op_info |
Definition at line 69 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), srv_master_thread(), and srv_printf_innodb_monitor().
| FILE* srv_misc_tmpfile |
| FILE* srv_monitor_file |
| const char srv_mysql50_table_name_prefix[9] |
Definition at line 92 of file srv0srv.c.
Referenced by fil_extend_space_to_desired_size(), fsp_try_extend_data_file(), innobase_start_or_create_for_mysql(), open_or_create_data_files(), and srv_normalize_init_values().
Definition at line 170 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and os_aio_print().
Definition at line 116 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and open_or_create_log_file().
Definition at line 614 of file srv0srv.c.
Referenced by logs_empty_and_mark_files_at_shutdown(), srv_active_wake_master_thread(), srv_init(), srv_master_thread(), srv_release_threads(), and srv_suspend_thread().
Definition at line 209 of file srv0srv.c.
Referenced by log_group_file_header_flush(), log_group_write_buf(), and srv_export_innodb_status().
Definition at line 206 of file srv0srv.c.
Referenced by log_group_write_buf(), and srv_export_innodb_status().
Definition at line 159 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), srv_normalize_init_values(), and srv_printf_innodb_monitor().
| ibool srv_print_buf_io |
Referenced by UT_LIST_BASE_NODE_T().
| ibool srv_print_innodb_monitor |
| ibool srv_print_latch_waits |
Referenced by rw_lock_s_lock_spin(), rw_lock_x_lock_func(), and UT_LIST_BASE_NODE_T().
| ibool srv_print_lock_waits |
Referenced by UT_LIST_BASE_NODE_T().
| ibool srv_print_log_io |
Referenced by UT_LIST_BASE_NODE_T().
Referenced by srv_release_threads(), srv_suspend_thread(), trx_purge(), trx_purge_fetch_next_rec(), and UT_LIST_BASE_NODE_T().
| ibool srv_print_verbose_log |
| ibool srv_priority_boost |
Referenced by UT_LIST_BASE_NODE_T().
Referenced by os_thread_create(), and UT_LIST_BASE_NODE_T().
Referenced by os_thread_create(), and UT_LIST_BASE_NODE_T().
Referenced by mutex_spin_wait(), rw_lock_s_lock_spin(), rw_lock_x_lock_func(), and UT_LIST_BASE_NODE_T().
Definition at line 587 of file srv0srv.c.
Referenced by page_create(), srv_init(), srv_que_round_robin(), srv_que_task_enqueue_low(), srv_que_task_queue_check(), and srv_table_get_nth_slot().
Definition at line 181 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), log_checkpoint(), log_io_complete(), log_write_up_to(), os_file_create(), os_file_pwrite(), trx_commit_complete_for_mysql(), trx_commit_off_kernel(), and trx_prepare_off_kernel().
Referenced by btr_cur_search_to_nth_level(), innobase_start_or_create_for_mysql(), and UT_LIST_BASE_NODE_T().
| ibool srv_use_awe |
Referenced by buf_flush_try_page(), buf_LRU_add_block_low(), buf_LRU_add_block_to_end_low(), buf_LRU_block_free_non_file_page(), buf_LRU_get_free_block(), buf_LRU_remove_block(), buf_page_get_gen(), buf_pool_init(), buf_print_io(), innobase_start_or_create_for_mysql(), srv_normalize_init_values(), srv_printf_innodb_monitor(), and UT_LIST_BASE_NODE_T().
| ibool srv_use_checksums |
Referenced by buf_flush_init_for_writing(), buf_page_is_corrupted(), buf_page_print(), and UT_LIST_BASE_NODE_T().
| ibool srv_use_doublewrite_buf |
Referenced by buf_flush_buffered_writes(), buf_flush_write_block_low(), and UT_LIST_BASE_NODE_T().
Definition at line 182 of file srv0srv.c.
Referenced by innobase_start_or_create_for_mysql(), and os_file_create().
1.4.7

