MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
trx0sys.cc File Reference
#include "trx0sys.h"
#include "fsp0fsp.h"
#include "mtr0log.h"
#include "trx0trx.h"
#include "trx0rseg.h"
#include "trx0undo.h"
#include "srv0srv.h"
#include "srv0start.h"
#include "trx0purge.h"
#include "log0log.h"
#include "log0recv.h"
#include "os0file.h"
#include "read0read.h"
Include dependency graph for trx0sys.cc:

Go to the source code of this file.

Classes

struct  file_format_t

Functions

UNIV_INTERN void trx_sys_flush_max_trx_id (void)
UNIV_INTERN void trx_sys_update_mysql_binlog_offset (const char *file_name, ib_int64_t offset, ulint field, mtr_t *mtr)
UNIV_INTERN void trx_sys_print_mysql_binlog_offset (void)
UNIV_INTERN void trx_sys_print_mysql_master_log_pos (void)
UNIV_INTERN ulint trx_sysf_rseg_find_free (mtr_t *mtr)
UNIV_INTERN ib_bh_ttrx_sys_init_at_db_start (void)
UNIV_INTERN void trx_sys_create (void)
UNIV_INTERN void trx_sys_create_sys_pages (void)
UNIV_INTERN const char * trx_sys_file_format_id_to_name (const ulint id)
UNIV_INTERN dberr_t trx_sys_file_format_max_check (ulint max_format_id)
UNIV_INTERN ibool trx_sys_file_format_max_set (ulint format_id, const char **name)
UNIV_INTERN void trx_sys_file_format_tag_init (void)
UNIV_INTERN ibool trx_sys_file_format_max_upgrade (const char **name, ulint format_id)
UNIV_INTERN const char * trx_sys_file_format_max_get (void)
UNIV_INTERN void trx_sys_file_format_init (void)
UNIV_INTERN void trx_sys_file_format_close (void)
UNIV_INTERN ulint trx_sys_create_rsegs (ulint n_spaces, ulint n_rsegs)
UNIV_INTERN void trx_sys_close (void)
UNIV_INTERN ulint trx_sys_any_active_transactions (void)

Variables

UNIV_INTERN trx_sys_ttrx_sys = NULL
UNIV_INTERN char trx_sys_mysql_master_log_name [TRX_SYS_MYSQL_LOG_NAME_LEN]
UNIV_INTERN ib_int64_t trx_sys_mysql_master_log_pos = -1
UNIV_INTERN char trx_sys_mysql_bin_log_name [TRX_SYS_MYSQL_LOG_NAME_LEN]
UNIV_INTERN ib_int64_t trx_sys_mysql_bin_log_pos = -1

Detailed Description

Transaction system

Created 3/26/1996 Heikki Tuuri

Definition in file trx0sys.cc.

Function Documentation

UNIV_INTERN void trx_sys_close ( void  )

Shutdown/Close the transaction system.

Definition at line 1157 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN void trx_sys_create ( void  )

Creates the trx_sys instance and initializes ib_bh and mutex.

Definition at line 587 of file trx0sys.cc.

UNIV_INTERN ulint trx_sys_create_rsegs ( ulint  n_spaces,
ulint  n_rsegs 
)

number of rollback segments to create

Parameters
n_spacesnumber of tablespaces for UNDO logs
n_rsegsnumber of rollback segments to create

Definition at line 874 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN void trx_sys_create_sys_pages ( void  )

Creates and initializes the transaction system at the database creation.

Definition at line 601 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN void trx_sys_file_format_close ( void  )

Closes the tablespace tag system.

Definition at line 863 of file trx0sys.cc.

UNIV_INTERN const char* trx_sys_file_format_id_to_name ( const ulint  id)

Get the name representation of the file format from its id.

Returns
pointer to the name
Parameters
idin: id of the file format

Definition at line 692 of file trx0sys.cc.

Here is the caller graph for this function:

UNIV_INTERN void trx_sys_file_format_init ( void  )

Initializes the tablespace tag system.

Definition at line 845 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN dberr_t trx_sys_file_format_max_check ( ulint  max_format_id)

Check for the max file format tag stored on disk. Note: If max_format_id is == UNIV_FORMAT_MAX + 1 then we only print a warning.

Returns
DB_SUCCESS or error code
Parameters
max_format_idin: max format id to check

Definition at line 707 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN const char* trx_sys_file_format_max_get ( void  )

Get the name representation of the file format from its id.

Returns
pointer to the max format name

Definition at line 835 of file trx0sys.cc.

UNIV_INTERN ibool trx_sys_file_format_max_set ( ulint  format_id,
const char **  name 
)

Set the file format id unconditionally except if it's already the same value.

Returns
TRUE if value updated
Parameters
format_idin: file format id
nameout: max file format name or NULL if not needed.

Definition at line 758 of file trx0sys.cc.

Here is the caller graph for this function:

UNIV_INTERN ibool trx_sys_file_format_max_upgrade ( const char **  name,
ulint  format_id 
)

Update the file format tag in the system tablespace only if the given format id is greater than the known max id.

Returns
TRUE if format_id was bigger than the known max id
Parameters
nameout: max file format name
format_idin: file format identifier

Definition at line 807 of file trx0sys.cc.

Here is the caller graph for this function:

UNIV_INTERN void trx_sys_file_format_tag_init ( void  )

Tags the system table space with minimum format id if it has not been tagged yet. WARNING: This function is only called during the startup and AFTER the redo log application during recovery has finished.

Definition at line 788 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN void trx_sys_flush_max_trx_id ( void  )

Writes the value of max_trx_id to the file based trx system header.

Definition at line 171 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN ib_bh_t* trx_sys_init_at_db_start ( void  )

Creates and initializes the central memory structures for the transaction system. This is called when the database is started.

Returns
min binary heap of rsegs to purge

Definition at line 490 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN void trx_sys_print_mysql_binlog_offset ( void  )

Stores the MySQL binlog offset info in the trx system header if the magic number shows it valid, and print the info to stderr

Definition at line 258 of file trx0sys.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void trx_sys_print_mysql_master_log_pos ( void  )

Prints to stderr the MySQL master log offset info in the trx system header if the magic number shows it valid.

Definition at line 308 of file trx0sys.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

UNIV_INTERN void trx_sys_update_mysql_binlog_offset ( const char *  file_name,
ib_int64_t  offset,
ulint  field,
mtr_t mtr 
)

Updates the offset information about the end of the MySQL binlog entry which corresponds to the transaction just being committed. In a MySQL replication slave updates the latest master binlog position up to which replication has proceeded.

Parameters
file_namein: MySQL log file name
offsetin: position in that log file
fieldin: offset of the MySQL log info field in the trx sys header
mtrin: mtr

Definition at line 199 of file trx0sys.cc.

Here is the call graph for this function:

UNIV_INTERN ulint trx_sysf_rseg_find_free ( mtr_t mtr)

Looks for a free slot for a rollback segment in the trx system file copy.

Returns
slot index or ULINT_UNDEFINED if not found
Parameters
mtrin: mtr

Definition at line 362 of file trx0sys.cc.

Here is the call graph for this function:

Here is the caller graph for this function:

Variable Documentation

UNIV_INTERN trx_sys_t* trx_sys = NULL

The transaction system

Definition at line 57 of file trx0sys.cc.

UNIV_INTERN char trx_sys_mysql_bin_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN]
If this MySQL server uses binary logging, after InnoDB has been inited

and if it has done a crash recovery, we store the binlog file name and position here. Binlog file name

Definition at line 75 of file trx0sys.cc.

UNIV_INTERN ib_int64_t trx_sys_mysql_bin_log_pos = -1

Binlog file position, or -1 if unknown

Definition at line 77 of file trx0sys.cc.

UNIV_INTERN char trx_sys_mysql_master_log_name[TRX_SYS_MYSQL_LOG_NAME_LEN]
In a MySQL replication slave, in crash recovery we store the master log

file name and position here. Master binlog file name

Definition at line 63 of file trx0sys.cc.

UNIV_INTERN ib_int64_t trx_sys_mysql_master_log_pos = -1
Master binlog file position.  We have successfully got the updates

up to this position. -1 means that no crash recovery was needed, or there was no master log position info inside InnoDB.

Definition at line 67 of file trx0sys.cc.