Drizzled Public API Documentation

trx0i_s.h File Reference
#include "univ.i"
#include "trx0types.h"
#include "dict0types.h"
#include "ut0ut.h"

Go to the source code of this file.

Classes

struct  i_s_hash_chain_struct
struct  i_s_locks_row_struct
struct  i_s_trx_row_struct
struct  i_s_lock_waits_row_struct

Defines

#define TRX_I_S_MEM_LIMIT   16777216
#define TRX_I_S_LOCK_DATA_MAX_LEN   8192
#define TRX_I_S_TRX_QUERY_MAX_LEN   1024
#define TRX_I_S_TRX_OP_STATE_MAX_LEN   64
#define TRX_I_S_TRX_FK_ERROR_MAX_LEN   256
#define TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN   16
#define TRX_I_S_STRING_COPY(data, field, constraint, tcache)
#define TRX_I_S_LOCK_ID_MAX_LEN   (TRX_ID_MAX_LEN + 63)

Typedefs

typedef struct i_s_locks_row_struct i_s_locks_row_t
typedef struct i_s_trx_row_struct i_s_trx_row_t
typedef struct
i_s_lock_waits_row_struct 
i_s_lock_waits_row_t
typedef struct
i_s_hash_chain_struct 
i_s_hash_chain_t
typedef struct trx_i_s_cache_struct trx_i_s_cache_t

Enumerations

enum  i_s_table { I_S_INNODB_TRX, I_S_INNODB_LOCKS, I_S_INNODB_LOCK_WAITS }

Functions

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 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 char * trx_i_s_create_lock_id (const i_s_locks_row_t *row, char *lock_id, ulint lock_id_size)

Variables

trx_i_s_cache_ttrx_i_s_cache

Detailed Description

INFORMATION SCHEMA innodb_trx, innodb_locks and innodb_lock_waits tables cache structures and public functions.

Created July 17, 2007 Vasil Dimov

Definition in file trx0i_s.h.


Define Documentation

#define TRX_I_S_LOCK_DATA_MAX_LEN   8192

The maximum length of a string that can be stored in i_s_locks_row_t::lock_data

Definition at line 43 of file trx0i_s.h.

#define TRX_I_S_LOCK_ID_MAX_LEN   (TRX_ID_MAX_LEN + 63)

The maximum length of a resulting lock_id_size in trx_i_s_create_lock_id(), not including the terminating NUL. ":%lu:%lu:%lu" -> 63 chars

Definition at line 291 of file trx0i_s.h.

#define TRX_I_S_MEM_LIMIT   16777216

The maximum amount of memory that can be consumed by innodb_trx, innodb_locks and innodb_lock_waits information schema tables.

Definition at line 39 of file trx0i_s.h.

#define TRX_I_S_STRING_COPY (   data,
  field,
  constraint,
  tcache 
)
Value:
do {                \
  if (strlen(data) > constraint) {      \
    char  buff[constraint + 1];     \
    strncpy(buff, data, constraint);    \
    buff[constraint] = '\0';      \
                \
    field = static_cast<const char *>(ha_storage_put_memlim(      \
      (tcache)->storage, buff, constraint + 1,\
      MAX_ALLOWED_FOR_STORAGE(tcache)));  \
  } else {            \
    field = static_cast<const char *>(ha_storage_put_str_memlim(    \
      (tcache)->storage, data,    \
      MAX_ALLOWED_FOR_STORAGE(tcache)));  \
  }             \
} while (0)

Safely copy strings in to the INNODB_TRX table's string based columns

Definition at line 63 of file trx0i_s.h.

#define TRX_I_S_TRX_FK_ERROR_MAX_LEN   256

The maximum length of a string that can be stored in i_s_trx_row_t::trx_foreign_key_error

Definition at line 55 of file trx0i_s.h.

#define TRX_I_S_TRX_ISOLATION_LEVEL_MAX_LEN   16

The maximum length of a string that can be stored in i_s_trx_row_t::trx_isolation_level

Definition at line 59 of file trx0i_s.h.

#define TRX_I_S_TRX_OP_STATE_MAX_LEN   64

The maximum length of a string that can be stored in i_s_trx_row_t::trx_operation_state

Definition at line 51 of file trx0i_s.h.

#define TRX_I_S_TRX_QUERY_MAX_LEN   1024

The maximum length of a string that can be stored in i_s_trx_row_t::trx_query

Definition at line 47 of file trx0i_s.h.


Typedef Documentation

Objects of trx_i_s_cache_t::locks_hash

Definition at line 88 of file trx0i_s.h.

A row of INFORMATION_SCHEMA.innodb_lock_waits

Definition at line 85 of file trx0i_s.h.

A row of INFORMATION_SCHEMA.innodb_locks

Definition at line 81 of file trx0i_s.h.

A row of INFORMATION_SCHEMA.innodb_trx

Definition at line 83 of file trx0i_s.h.

Cache of INFORMATION_SCHEMA table data

Definition at line 183 of file trx0i_s.h.


Enumeration Type Documentation

enum i_s_table

Auxiliary enum used by functions that need to select one of the INFORMATION_SCHEMA tables

Enumerator:
I_S_INNODB_TRX 

INFORMATION_SCHEMA.innodb_trx

I_S_INNODB_LOCKS 

INFORMATION_SCHEMA.innodb_locks

I_S_INNODB_LOCK_WAITS 

INFORMATION_SCHEMA.innodb_lock_waits

Definition at line 187 of file trx0i_s.h.


Function Documentation

UNIV_INTERN void trx_i_s_cache_end_read ( trx_i_s_cache_t cache)

Release a shared/read lock on the tables cache. in: cache

Release a shared/read lock on the tables cache.

Parameters:
cachein: cache

Definition at line 1436 of file trx0i_s.cc.

References trx_i_s_cache_struct::last_read, trx_i_s_cache_struct::last_read_mutex, trx_i_s_cache_struct::rw_lock, trx_i_s_cache_end_read(), ut_a, and ut_time_us().

Referenced by trx_i_s_cache_end_read().

UNIV_INTERN void trx_i_s_cache_end_write ( trx_i_s_cache_t cache)

Release an exclusive/write lock on the tables cache. in: cache

Release an exclusive/write lock on the tables cache.

Parameters:
cachein: cache

Definition at line 1470 of file trx0i_s.cc.

References trx_i_s_cache_struct::rw_lock, trx_i_s_cache_end_write(), and ut_a.

Referenced by trx_i_s_cache_end_write().

UNIV_INTERN void trx_i_s_cache_free ( trx_i_s_cache_t cache)

Free the INFORMATION SCHEMA trx related cache. in/out: cache to free

Free the INFORMATION SCHEMA trx related cache.

Parameters:
cachein, own: cache to free

Definition at line 1409 of file trx0i_s.cc.

References ha_storage_free(), trx_i_s_cache_struct::innodb_lock_waits, trx_i_s_cache_struct::innodb_locks, trx_i_s_cache_struct::innodb_trx, trx_i_s_cache_struct::locks_hash, trx_i_s_cache_struct::storage, and trx_i_s_cache_free().

Referenced by srv_free(), and trx_i_s_cache_free().

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 in the cache for a given INFORMATION SCHEMA table.

Returns:
row in: row number

Retrieves the nth row (zero-based) in the cache for a given INFORMATION SCHEMA table.

Returns:
row
Parameters:
cachein: cache
tablein: which table
nin: row number

Definition at line 1539 of file trx0i_s.cc.

References i_s_mem_chunk_struct::base, i_s_table_cache_struct::chunks, i_s_mem_chunk_struct::offset, i_s_table_cache_struct::row_size, i_s_mem_chunk_struct::rows_allocd, trx_i_s_cache_get_nth_row(), and ut_a.

Referenced by trx_i_s_cache_get_nth_row().

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.

Returns:
number of rows in: which table

Retrieves the number of used rows in the cache for a given INFORMATION SCHEMA table.

Returns:
number of rows
Parameters:
cachein: cache
tablein: which table

Definition at line 1521 of file trx0i_s.cc.

References i_s_table_cache_struct::rows_used, and trx_i_s_cache_get_rows_used().

Referenced by trx_i_s_cache_get_rows_used().

UNIV_INTERN void trx_i_s_cache_init ( trx_i_s_cache_t cache)
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.

Returns:
TRUE if truncated in: cache

Returns TRUE if the data in the cache is truncated due to the memory limit posed by TRX_I_S_MEM_LIMIT.

Returns:
TRUE if truncated
Parameters:
cachein: cache

Definition at line 1357 of file trx0i_s.cc.

References trx_i_s_cache_struct::is_truncated, and trx_i_s_cache_is_truncated().

Referenced by trx_i_s_cache_is_truncated().

UNIV_INTERN void trx_i_s_cache_start_read ( trx_i_s_cache_t cache)

Issue a shared/read lock on the tables cache. in: cache

Issue a shared/read lock on the tables cache.

Parameters:
cachein: cache

Definition at line 1425 of file trx0i_s.cc.

References trx_i_s_cache_struct::rw_lock, rw_lock_s_lock, and trx_i_s_cache_start_read().

Referenced by trx_i_s_cache_start_read().

UNIV_INTERN void trx_i_s_cache_start_write ( trx_i_s_cache_t cache)

Issue an exclusive/write lock on the tables cache. in: cache

Issue an exclusive/write lock on the tables cache.

Parameters:
cachein: cache

Definition at line 1459 of file trx0i_s.cc.

References trx_i_s_cache_struct::rw_lock, and trx_i_s_cache_start_write().

Referenced by trx_i_s_cache_start_write().

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.

Returns:
resulting lock id in: size of the lock id buffer

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.

Returns:
resulting lock id
Parameters:
rowin: innodb_locks row
lock_idout: resulting lock_id
lock_id_sizein: size of the lock id buffer

Definition at line 1580 of file trx0i_s.cc.

References i_s_locks_row_struct::lock_page, i_s_locks_row_struct::lock_rec, i_s_locks_row_struct::lock_space, i_s_locks_row_struct::lock_table_id, i_s_locks_row_struct::lock_trx_id, trx_i_s_create_lock_id(), TRX_ID_FMT, ut_a, and ut_snprintf.

Referenced by trx_i_s_create_lock_id().

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.

Returns:
0 - fetched, 1 - not in/out: cache

Update the transactions cache if it has not been read for some time. Called from handler/i_s.cc.

Returns:
0 - fetched, 1 - not
Parameters:
cachein/out: cache

Definition at line 1332 of file trx0i_s.cc.

References trx_i_s_possibly_fetch_data_into_cache().

Referenced by trx_i_s_possibly_fetch_data_into_cache().


Variable Documentation

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 197 of file trx0i_s.cc.

Referenced by srv_free(), and srv_init().