MySQL 5.6.14 Source Code Document
|
#include "univ.i"
#include <mysql/plugin.h>
#include "buf0buf.h"
#include "dict0dict.h"
#include "ha0storage.h"
#include "ha_prototypes.h"
#include "hash0hash.h"
#include "lock0iter.h"
#include "lock0lock.h"
#include "mem0mem.h"
#include "page0page.h"
#include "rem0rec.h"
#include "row0row.h"
#include "srv0srv.h"
#include "sync0rw.h"
#include "sync0sync.h"
#include "sync0types.h"
#include "trx0i_s.h"
#include "trx0sys.h"
#include "trx0trx.h"
#include "ut0mem.h"
#include "ut0ut.h"
Go to the source code of this file.
Classes | |
struct | i_s_mem_chunk_t |
struct | i_s_table_cache_t |
struct | trx_i_s_cache_t |
Macros | |
#define | TABLE_CACHE_INITIAL_ROWSNUM 1024 |
#define | MEM_CHUNKS_IN_TABLE_CACHE 39 |
The maximum number of chunks to allocate for a table cache. | |
#define | MAX_ALLOWED_FOR_STORAGE(cache) |
#define | MAX_ALLOWED_FOR_ALLOC(cache) |
#define | LOCKS_HASH_CELLS_NUM 10000 |
#define | CACHE_STORAGE_INITIAL_SIZE 1024 |
#define | CACHE_STORAGE_HASH_CELLS 2048 |
#define | CACHE_MIN_IDLE_TIME_US 100000 /* 0.1 sec */ |
Functions | |
UNIV_INTERN int | trx_i_s_possibly_fetch_data_into_cache (trx_i_s_cache_t *cache) |
UNIV_INTERN ibool | trx_i_s_cache_is_truncated (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_init (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_free (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_start_read (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_end_read (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_start_write (trx_i_s_cache_t *cache) |
UNIV_INTERN void | trx_i_s_cache_end_write (trx_i_s_cache_t *cache) |
UNIV_INTERN ulint | trx_i_s_cache_get_rows_used (trx_i_s_cache_t *cache, enum i_s_table table) |
UNIV_INTERN void * | trx_i_s_cache_get_nth_row (trx_i_s_cache_t *cache, enum i_s_table table, ulint n) |
UNIV_INTERN char * | trx_i_s_create_lock_id (const i_s_locks_row_t *row, char *lock_id, ulint lock_id_size) |
Variables | |
UNIV_INTERN trx_i_s_cache_t * | trx_i_s_cache = &trx_i_s_cache_static |
INFORMATION SCHEMA innodb_trx, innodb_locks and innodb_lock_waits tables fetch code.
The code below fetches information needed to fill those 3 dynamic tables and uploads it into a "transactions table cache" for later retrieval.
Created July 17, 2007 Vasil Dimov
Definition in file trx0i_s.cc.
#define CACHE_MIN_IDLE_TIME_US 100000 /* 0.1 sec */ |
The minimum time that a cache must not be updated after it has been
read for the last time; measured in microseconds. We use this technique to ensure that SELECTs which join several INFORMATION SCHEMA tables read the same version of the cache.
Definition at line 1225 of file trx0i_s.cc.
#define CACHE_STORAGE_HASH_CELLS 2048 |
Number of hash cells in the cache storage
Definition at line 173 of file trx0i_s.cc.
#define CACHE_STORAGE_INITIAL_SIZE 1024 |
Initial size of the cache storage
Definition at line 171 of file trx0i_s.cc.
#define LOCKS_HASH_CELLS_NUM 10000 |
the hash table size is LOCKS_HASH_CELLS_NUM * sizeof(void*) bytes
Definition at line 166 of file trx0i_s.cc.
#define MAX_ALLOWED_FOR_ALLOC | ( | cache | ) |
Memory limit in table_cache_create_empty_row().
cache | hash storage |
Definition at line 126 of file trx0i_s.cc.
#define MAX_ALLOWED_FOR_STORAGE | ( | cache | ) |
The following are some testing auxiliary macros. Do not enable them
in a production environment. Memory limit passed to ha_storage_put_memlim().
cache | hash storage |
Definition at line 119 of file trx0i_s.cc.
#define MEM_CHUNKS_IN_TABLE_CACHE 39 |
The maximum number of chunks to allocate for a table cache.
The rows of a table cache are stored in a set of chunks. When a new row is added a new chunk is allocated if necessary. Assuming that the first one is 1024 rows (TABLE_CACHE_INITIAL_ROWSNUM) and each subsequent is N/2 where N is the number of rows we have allocated till now, then 39th chunk would accommodate 1677416425 rows and all chunks would accommodate 3354832851 rows.
Definition at line 73 of file trx0i_s.cc.
#define TABLE_CACHE_INITIAL_ROWSNUM 1024 |
Initial number of rows in the table cache
Definition at line 63 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_end_read | ( | trx_i_s_cache_t * | cache | ) |
Release a shared/read lock on the tables cache.
cache | in: cache |
Definition at line 1492 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_end_write | ( | trx_i_s_cache_t * | cache | ) |
Release an exclusive/write lock on the tables cache.
cache | in: cache |
Definition at line 1526 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_free | ( | trx_i_s_cache_t * | cache | ) |
Free the INFORMATION SCHEMA trx related cache.
cache | in, own: cache to free |
Definition at line 1465 of file trx0i_s.cc.
UNIV_INTERN void* trx_i_s_cache_get_nth_row | ( | trx_i_s_cache_t * | cache, |
enum i_s_table | table, | ||
ulint | n | ||
) |
Retrieves the nth row (zero-based) in the cache for a given INFORMATION SCHEMA table.
cache | in: cache |
table | in: which table |
n | in: row number |
Definition at line 1595 of file trx0i_s.cc.
UNIV_INTERN ulint trx_i_s_cache_get_rows_used | ( | trx_i_s_cache_t * | cache, |
enum i_s_table | table | ||
) |
Retrieves the number of used rows in the cache for a given INFORMATION SCHEMA table.
cache | in: cache |
table | in: which table |
Definition at line 1577 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_init | ( | trx_i_s_cache_t * | cache | ) |
Initialize INFORMATION SCHEMA trx related cache.
cache | out: cache to init |
Definition at line 1424 of file trx0i_s.cc.
UNIV_INTERN ibool trx_i_s_cache_is_truncated | ( | trx_i_s_cache_t * | cache | ) |
Returns TRUE if the data in the cache is truncated due to the memory limit posed by TRX_I_S_MEM_LIMIT.
cache | in: cache |
Definition at line 1413 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_start_read | ( | trx_i_s_cache_t * | cache | ) |
Issue a shared/read lock on the tables cache.
cache | in: cache |
Definition at line 1481 of file trx0i_s.cc.
UNIV_INTERN void trx_i_s_cache_start_write | ( | trx_i_s_cache_t * | cache | ) |
Issue an exclusive/write lock on the tables cache.
cache | in: cache |
Definition at line 1515 of file trx0i_s.cc.
UNIV_INTERN char* trx_i_s_create_lock_id | ( | const i_s_locks_row_t * | row, |
char * | lock_id, | ||
ulint | lock_id_size | ||
) |
Crafts a lock id string from a i_s_locks_row_t object. Returns its second argument. This function aborts if there is not enough space in lock_id. Be sure to provide at least TRX_I_S_LOCK_ID_MAX_LEN + 1 if you want to be 100% sure that it will not abort.
row | in: innodb_locks row |
lock_id | out: resulting lock_id |
lock_id_size | in: size of the lock id buffer |
Definition at line 1636 of file trx0i_s.cc.
UNIV_INTERN int trx_i_s_possibly_fetch_data_into_cache | ( | trx_i_s_cache_t * | cache | ) |
Update the transactions cache if it has not been read for some time. Called from handler/i_s.cc.
cache | in/out: cache |
Definition at line 1383 of file trx0i_s.cc.
UNIV_INTERN trx_i_s_cache_t* trx_i_s_cache = &trx_i_s_cache_static |
This is the intermediate buffer where data needed to fill the
INFORMATION SCHEMA tables is fetched and later retrieved by the C++ code in handler/i_s.cc.
Definition at line 192 of file trx0i_s.cc.