INFORMATION SCHEMA table cache

这是系统视图的cache,看样子mysql没有用buffer pool,而是专门对系统视图做了一个cache

每个表都有自已在内存中的cache, 最大为16M,分配时是按chunk进行的,初始大小是1024个行的大小,按照new = old + old/2这样的速度增加

 

 

 

 

/** Memory for each table in the intermediate buffer is allocated in separate chunks. These chunks are considered to be concatenated to represent one flat array of rows. */ typedef struct i_s_mem_chunk_struct { ulint offset; /*!< offset, in number of rows */ ulint rows_allocd; /*!< the size of this chunk, in number of rows */ void* base; /*!< start of the chunk */ } i_s_mem_chunk_t; /** This represents one table's cache. */ typedef struct i_s_table_cache_struct { ulint rows_used; /*!< number of used rows */ ulint rows_allocd; /*!< number of allocated rows */ ulint row_size; /*!< size of a single row */ i_s_mem_chunk_t chunks[MEM_CHUNKS_IN_TABLE_CACHE]; /*!< array of memory chunks that stores the rows 最多39 */ } i_s_table_cache_t; /** This structure describes the intermediate buffer */ struct trx_i_s_cache_struct { rw_lock_t rw_lock; /*!< read-write lock protecting the rest of this structure */ ullint last_read; /*!< last time the cache was read; measured in microseconds since epoch */ mutex_t last_read_mutex;/*!< mutex protecting the last_read member - it is updated inside a shared lock of the rw_lock member */ i_s_table_cache_t innodb_trx; /*!< innodb_trx table */ i_s_table_cache_t innodb_locks; /*!< innodb_locks table */ i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */ /** the hash table size is LOCKS_HASH_CELLS_NUM * sizeof(void*) bytes */ #define LOCKS_HASH_CELLS_NUM 10000 hash_table_t* locks_hash; /*!< hash table used to eliminate duplicate entries in the innodb_locks table */ /** Initial size of the cache storage */ #define CACHE_STORAGE_INITIAL_SIZE 1024 /** Number of hash cells in the cache storage */ #define CACHE_STORAGE_HASH_CELLS 2048 ha_storage_t* storage; /*!< storage for external volatile data that can possibly not be available later, when we release the kernel mutex */ ulint mem_allocd; /*!< the amount of memory allocated with mem_alloc*() */ ibool is_truncated; /*!< this is TRUE if the memory limit was hit and thus the data in the cache is truncated */ }; //存在里面的三种元组 /** This structure represents INFORMATION_SCHEMA.innodb_locks row */ struct i_s_locks_row_struct { trx_id_t lock_trx_id; /*!< transaction identifier */ const char* lock_mode; /*!< lock mode from lock_get_mode_str() */ const char* lock_type; /*!< lock type from lock_get_type_str() */ const char* lock_table; /*!< table name from lock_get_table_name() */ const char* lock_index; /*!< index name from lock_rec_get_index_name() */ /** Information for record locks. All these are ULINT_UNDEFINED for table locks. */ /* @{ */ ulint lock_space; /*!< tablespace identifier */ ulint lock_page; /*!< page number within the_space */ ulint lock_rec; /*!< heap number of the record on the page */ const char* lock_data; /*!< (some) content of the record */ /* @} */ /** The following are auxiliary and not included in the table */ /* @{ */ table_id_t lock_table_id; /*!< table identifier from lock_get_table_id */ i_s_hash_chain_t hash_chain; /*!< hash table chain node for trx_i_s_cache_t::locks_hash */ /* @} */ }; /** This structure represents INFORMATION_SCHEMA.innodb_trx row */ struct i_s_trx_row_struct { trx_id_t trx_id; /*!< transaction identifier */ const char* trx_state; /*!< transaction state from trx_get_que_state_str() */ ib_time_t trx_started; /*!< trx_struct::start_time */ const i_s_locks_row_t* requested_lock_row; /*!< pointer to a row in innodb_locks if trx is waiting, or NULL */ ib_time_t trx_wait_started; /*!< trx_struct::wait_started */ ullint trx_weight; /*!< TRX_WEIGHT() */ ulint trx_mysql_thread_id; /*!< thd_get_thread_id() */ const char* trx_query; /*!< MySQL statement being executed in the transaction */ struct charset_info_st* trx_query_cs; /*!< charset encode the MySQL statement */ const char* trx_operation_state; /*!< trx_struct::op_info */ ulint trx_tables_in_use;/*!< n_mysql_tables_in_use in trx_struct */ ulint trx_tables_locked; /*!< mysql_n_tables_locked in trx_struct */ ulint trx_lock_structs;/*!< list len of trx_locks in trx_struct */ ulint trx_lock_memory_bytes; /*!< mem_heap_get_size( trx->lock_heap) */ ulint trx_rows_locked;/*!< lock_number_of_rows_locked() */ ullint trx_rows_modified;/*!< trx_struct::undo_no */ ulint trx_concurrency_tickets; /*!< n_tickets_to_enter_innodb in trx_struct */ const char* trx_isolation_level; /*!< isolation_level in trx_struct*/ ibool trx_unique_checks; /*!< check_unique_secondary in trx_struct*/ ibool trx_foreign_key_checks; /*!< check_foreigns in trx_struct */ const char* trx_foreign_key_error; /*!< detailed_error in trx_struct */ ibool trx_has_search_latch; /*!< has_search_latch in trx_struct */ ulint trx_search_latch_timeout; /*!< search_latch_timeout in trx_struct */ }; /** This structure represents INFORMATION_SCHEMA.innodb_lock_waits row */ struct i_s_lock_waits_row_struct { const i_s_locks_row_t* requested_lock_row; /*!< requested lock */ const i_s_locks_row_t* blocking_lock_row; /*!< blocking lock */ };

 

你可能感兴趣的:(schema,struct,cache,table,search,structure)