Drizzled Public API Documentation

trx0trx.h File Reference
#include "univ.i"
#include "trx0types.h"
#include "dict0types.h"
#include "lock0types.h"
#include "usr0types.h"
#include "que0types.h"
#include "mem0mem.h"
#include "read0types.h"
#include "trx0xa.h"
#include "ut0vec.h"

Go to the source code of this file.

Classes

struct  trx_sig_struct
struct  trx_struct
struct  commit_node_struct

Namespaces

namespace  drizzled
 TODO: Rename this file - func.h is stupid.

Macros

#define trx0trx_h
#define TRX_WEIGHT(t)   ((t)->undo_no + UT_LIST_GET_LEN((t)->trx_locks))
#define TRX_QUE_STATE_STR_MAX_LEN   12 /* "ROLLING BACK" */
#define TRX_MAGIC_N   91118598
#define TRX_MAX_N_THREADS
#define TRX_NOT_STARTED   0
#define TRX_ACTIVE   1
#define TRX_COMMITTED_IN_MEMORY   2
#define TRX_PREPARED   3 /* Support for 2PC/XA */
#define TRX_QUE_RUNNING   0 /* transaction is running */
#define TRX_QUE_LOCK_WAIT   1 /* transaction is waiting for a lock */
#define TRX_QUE_ROLLING_BACK   2 /* transaction is rolling back */
#define TRX_QUE_COMMITTING   3 /* transaction is committing */
#define TRX_ISO_READ_UNCOMMITTED
#define TRX_ISO_READ_COMMITTED
#define TRX_ISO_REPEATABLE_READ
#define TRX_ISO_SERIALIZABLE
#define TRX_DUP_IGNORE   1 /* duplicate rows are to be updated */
#define TRX_DUP_REPLACE   2 /* duplicate rows are to be replaced */
#define TRX_SIG_NO_SIGNAL   0
#define TRX_SIG_TOTAL_ROLLBACK   1
#define TRX_SIG_ROLLBACK_TO_SAVEPT   2
#define TRX_SIG_COMMIT   3
#define TRX_SIG_ERROR_OCCURRED   4
#define TRX_SIG_BREAK_EXECUTION   5
#define TRX_SIG_SELF
#define TRX_SIG_OTHER_SESS

Typedefs

typedef enum trx_dict_op trx_dict_op_t

Enumerations

enum  trx_dict_op { TRX_DICT_OP_NONE = 0, TRX_DICT_OP_TABLE = 1, TRX_DICT_OP_INDEX = 2 }
enum  commit_node_state { COMMIT_NODE_SEND = 1, COMMIT_NODE_WAIT }

Functions

UNIV_INTERN void trx_search_latch_release_if_reserved (trx_t *trx)
UNIV_INTERN void trx_set_detailed_error (trx_t *trx, const char *msg)
UNIV_INTERN void trx_set_detailed_error_from_file (trx_t *trx, FILE *file)
UNIV_INLINE ibool trx_log_commit_id (const trx_t *trx)
UNIV_INLINE const dict_index_ttrx_get_error_info (const trx_t *trx)
UNIV_INTERN trx_ttrx_create (sess_t *sess) __attribute__((nonnull))
UNIV_INTERN trx_ttrx_allocate_for_mysql (void)
UNIV_INTERN trx_ttrx_allocate_for_background (void)
UNIV_INTERN void trx_free (trx_t *trx)
UNIV_INTERN void trx_free_for_mysql (trx_t *trx)
UNIV_INTERN void trx_free_for_background (trx_t *trx)
UNIV_INTERN void trx_lists_init_at_db_start (void)
UNIV_INTERN ibool trx_start (trx_t *trx, ulint rseg_id)
UNIV_INTERN ibool trx_start_low (trx_t *trx, ulint rseg_id)
UNIV_INLINE void trx_start_if_not_started (trx_t *trx)
UNIV_INLINE void trx_start_if_not_started_low (trx_t *trx)
UNIV_INTERN void trx_commit_off_kernel (trx_t *trx)
UNIV_INTERN void trx_cleanup_at_db_startup (trx_t *trx)
UNIV_INTERN ulint trx_commit_for_mysql (trx_t *trx)
UNIV_INTERN ulint trx_prepare_for_mysql (trx_t *trx)
UNIV_INTERN int trx_recover_for_mysql (XID *xid_list, ulint len)
UNIV_INTERN trx_ttrx_get_trx_by_xid (XID *xid)
UNIV_INTERN ulint trx_commit_complete_for_mysql (trx_t *trx)
UNIV_INTERN void trx_mark_sql_stat_end (trx_t *trx)
UNIV_INTERN read_view_ttrx_assign_read_view (trx_t *trx)
UNIV_INTERN void trx_end_lock_wait (trx_t *trx)
UNIV_INTERN void trx_sig_send (trx_t *trx, ulint type, ulint sender, que_thr_t *receiver_thr, trx_savept_t *savept, que_thr_t **next_thr)
UNIV_INTERN void trx_sig_reply (trx_sig_t *sig, que_thr_t **next_thr)
UNIV_INTERN void trx_sig_remove (trx_t *trx, trx_sig_t *sig)
UNIV_INTERN void trx_sig_start_handle (trx_t *trx, que_thr_t **next_thr)
UNIV_INTERN void trx_end_signal_handling (trx_t *trx)
UNIV_INTERN commit_node_tcommit_node_create (mem_heap_t *heap)
UNIV_INTERN que_thr_ttrx_commit_step (que_thr_t *thr)
UNIV_INTERN void trx_print (FILE *f, trx_t *trx, ulint max_query_len)
UNIV_INLINE enum trx_dict_op trx_get_dict_operation (const trx_t *trx) __attribute__((pure))
UNIV_INLINE void trx_set_dict_operation (trx_t *trx, enum trx_dict_op op)
UNIV_INTERN ibool trx_is_interrupted (trx_t *trx)
UNIV_INTERN ibool trx_is_strict (trx_t *trx)
UNIV_INTERN ibool trx_weight_ge (const trx_t *a, const trx_t *b)
UNIV_INLINE const char * trx_get_que_state_str (const trx_t *trx)

Variables

sess_ttrx_dummy_sess
ulint trx_n_mysql_transactions

Detailed Description

The transaction

Created 3/26/1996 Heikki Tuuri

Definition in file trx0trx.h.

Macro Definition Documentation

#define TRX_ISO_READ_COMMITTED
Value:
1 /* somewhat Oracle-like
isolation, except that in
range UPDATE and DELETE we
must block phantom rows
with next-key locks;
SELECT ... FOR UPDATE and ...
LOCK IN SHARE MODE only lock
the index records, NOT the
gaps before them, and thus
allow free inserting;
each consistent read reads its
own snapshot */

Definition at line 748 of file trx0trx.h.

#define TRX_ISO_READ_UNCOMMITTED
Value:
0 /* dirty read: non-locking
SELECTs are performed so that
we do not look at a possible
earlier version of a record;
thus they are not 'consistent'
reads under this isolation
level; otherwise like level
2 */

Definition at line 746 of file trx0trx.h.

#define TRX_ISO_REPEATABLE_READ
Value:
2 /* this is the default;
all consistent reads in the
same trx read the same
snapshot;
full next-key locking used
in locking reads to block
insertions into gaps */

Definition at line 750 of file trx0trx.h.

#define TRX_ISO_SERIALIZABLE
Value:
3 /* all plain SELECTs are
converted to LOCK IN SHARE
MODE reads */

Definition at line 752 of file trx0trx.h.

#define TRX_MAX_N_THREADS
Value:
32 /* maximum number of
concurrent threads running a
single operation of a
transaction, e.g., a parallel
query */

Definition at line 732 of file trx0trx.h.

#define TRX_SIG_OTHER_SESS
Value:
1 /* sent by another session (which
must hold rights to this) */

Definition at line 770 of file trx0trx.h.

#define TRX_SIG_SELF
Value:
0 /* sent by the session itself, or
by an error occurring within this
session */

Definition at line 769 of file trx0trx.h.

#define TRX_WEIGHT (   t)    ((t)->undo_no + UT_LIST_GET_LEN((t)->trx_locks))

Calculates the "weight" of a transaction. The weight of one transaction is estimated as the number of altered rows + the number of locked rows.

Parameters
ttransaction
Returns
transaction weight

Definition at line 422 of file trx0trx.h.

Referenced by trx_weight_ge().

Typedef Documentation

typedef enum trx_dict_op trx_dict_op_t

Type of data dictionary operation

Enumeration Type Documentation

Commit node states

Enumerator:
COMMIT_NODE_SEND 

about to send a commit signal to the transaction

COMMIT_NODE_WAIT 

commit signal sent to the transaction, waiting for completion

Definition at line 773 of file trx0trx.h.

Type of data dictionary operation

Enumerator:
TRX_DICT_OP_NONE 

The transaction is not modifying the data dictionary.

TRX_DICT_OP_TABLE 

The transaction is creating a table or an index, or dropping a table. The table must be dropped in crash recovery. This and TRX_DICT_OP_NONE are the only possible operation modes in crash recovery.

TRX_DICT_OP_INDEX 

The transaction is creating or dropping an index in an existing table. In crash recovery, the the data dictionary must be locked, but the table must not be dropped.

Definition at line 363 of file trx0trx.h.

Function Documentation

UNIV_INTERN commit_node_t* commit_node_create ( mem_heap_t heap)

Creates a commit command node struct.

Returns
own: commit node struct in: mem heap where created

Creates a commit command node struct.

Returns
own: commit node struct
Parameters
heapin: mem heap where created

Definition at line 1474 of file trx0trx.cc.

References commit_node_create(), COMMIT_NODE_SEND, commit_node_struct::common, mem_heap_alloc(), commit_node_struct::state, and que_common_struct::type.

Referenced by commit_node_create(), ind_create_graph_create(), pars_commit_statement(), and tab_create_graph_create().

UNIV_INTERN trx_t* trx_allocate_for_background ( void  )

Creates a transaction object for background operations by the master thread.

Returns
own: transaction object

Definition at line 226 of file trx0trx.cc.

References trx_allocate_for_background(), trx_create(), and trx_dummy_sess.

Referenced by row_mysql_drop_temp_tables(), and trx_allocate_for_background().

UNIV_INTERN trx_t* trx_allocate_for_mysql ( void  )
UNIV_INTERN read_view_t* trx_assign_read_view ( trx_t trx)

Assigns a read view for a consistent read query. All the consistent reads within the same transaction will get the same read view, which is created when this function is first called for a new started transaction.

Returns
consistent read view in: active transaction

Assigns a read view for a consistent read query. All the consistent reads within the same transaction will get the same read view, which is created when this function is first called for a new started transaction.

Returns
consistent read view
Parameters
trxin: active transaction

Definition at line 972 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::id, trx_struct::read_view, read_view_open_now(), trx_assign_read_view(), and ut_ad.

Referenced by InnobaseEngine::doStartTransaction(), row_search_for_mysql(), row_sel_step(), and trx_assign_read_view().

UNIV_INTERN void trx_cleanup_at_db_startup ( trx_t trx)

Cleans up a transaction at database startup. The cleanup is needed if the transaction already got to the middle of a commit when the database crashed, and we cannot roll it back. in: transaction

Cleans up a transaction at database startup. The cleanup is needed if the transaction already got to the middle of a commit when the database crashed, and we cannot roll it back.

Parameters
trxin: transaction

Definition at line 948 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::insert_undo, trx_savept_struct::least_undo_no, trx_struct::rseg, trx_cleanup_at_db_startup(), trx_sys, trx_undo_insert_cleanup(), trx_struct::undo_no, and UT_LIST_REMOVE.

Referenced by trx_cleanup_at_db_startup(), and trx_rollback_or_clean_recovered().

UNIV_INTERN ulint trx_commit_complete_for_mysql ( trx_t trx)

If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE.

Returns
0 or error number in: trx handle

If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE.

Returns
0 or error number
Parameters
trxin: trx handle

Definition at line 1571 of file trx0trx.cc.

References trx_struct::commit_lsn, log_write_up_to(), trx_struct::op_info, SRV_UNIX_NOSYNC, trx_commit_complete_for_mysql(), ut_a, and ut_error.

Referenced by InnobaseEngine::doCommit(), and trx_commit_complete_for_mysql().

UNIV_INTERN que_thr_t* trx_commit_step ( que_thr_t thr)

Performs an execution step for a commit type node in a query graph.

Returns
query thread to run next, or NULL in: query thread

Performs an execution step for a commit type node in a query graph.

Returns
query thread to run next, or NULL
Parameters
thrin: query thread

Definition at line 1492 of file trx0trx.cc.

References COMMIT_NODE_SEND, COMMIT_NODE_WAIT, que_thr_struct::prev_node, que_node_get_parent(), que_node_get_type(), que_thr_struct::run_node, que_thr_struct::state, commit_node_struct::state, thr_get_trx(), trx_commit_step(), trx_sig_send(), and ut_ad.

Referenced by trx_commit_step().

UNIV_INTERN void trx_end_lock_wait ( trx_t trx)

The transaction must be in the TRX_QUE_LOCK_WAIT state. Puts it to the TRX_QUE_RUNNING state and releases query threads which were waiting for a lock in the wait_thrs list. in: transaction

The transaction must be in the TRX_QUE_LOCK_WAIT state. Puts it to the TRX_QUE_RUNNING state and releases query threads which were waiting for a lock in the wait_thrs list.

Parameters
trxin: transaction

Definition at line 1045 of file trx0trx.cc.

References trx_struct::que_state, que_thr_end_wait_no_next_thr(), trx_end_lock_wait(), ut_ad, UT_LIST_GET_FIRST, UT_LIST_REMOVE, and trx_struct::wait_thrs.

Referenced by lock_cancel_waiting_and_release(), and trx_end_lock_wait().

UNIV_INTERN void trx_end_signal_handling ( trx_t trx)

Ends signal handling. If the session is in the error state, and trx->graph_before_signal_handling != NULL, returns control to the error handling routine of the graph (currently only returns the control to the graph root which then sends an error message to the client). in: trx

Ends signal handling. If the session is in the error state, and trx->graph_before_signal_handling != NULL, then returns control to the error handling routine of the graph (currently just returns the control to the graph root which then will send an error message to the client).

Parameters
trxin: trx

Definition at line 1290 of file trx0trx.cc.

References trx_struct::graph, que_fork_error_handle(), trx_struct::sess, sess_struct::state, trx_end_signal_handling(), and ut_ad.

Referenced by trx_end_signal_handling(), and trx_sig_start_handle().

UNIV_INTERN void trx_free_for_background ( trx_t trx)

Frees a transaction object of a background operation of the master thread. in, own: trx object

Frees a transaction object of a background operation of the master thread.

Parameters
trxin, own: trx object

Definition at line 363 of file trx0trx.cc.

References trx_free(), and trx_free_for_background().

Referenced by row_mysql_drop_temp_tables(), sess_close(), and trx_free_for_background().

UNIV_INTERN void trx_free_for_mysql ( trx_t trx)

Frees a transaction object for MySQL. in, own: trx object

Frees a transaction object for MySQL.

Parameters
trxin, own: trx object

Definition at line 342 of file trx0trx.cc.

References trx_free(), trx_free_for_mysql(), trx_n_mysql_transactions, trx_sys, ut_a, and UT_LIST_REMOVE.

Referenced by InnobaseEngine::close_connection(), dict_create_or_check_foreign_constraint_tables(), InnobaseEngine::doCreateTable(), InnobaseEngine::doDropSchema(), InnobaseEngine::doDropTable(), InnobaseEngine::doRenameTable(), and trx_free_for_mysql().

UNIV_INLINE enum trx_dict_op trx_get_dict_operation ( const trx_t trx)

Determine if a transaction is a dictionary operation.

Returns
dictionary operation mode
Parameters
trxin: transaction

Referenced by trx_rollback_or_clean_recovered(), and trx_undo_assign_undo().

UNIV_INLINE const dict_index_t* trx_get_error_info ( const trx_t trx)

Retrieves the error_info field from a trx.

Returns
the error info in: trx object

Referenced by ha_innobase::info().

UNIV_INLINE const char* trx_get_que_state_str ( const trx_t trx)

Retrieves transaction's que state in a human readable string. The string should not be free()'d or modified.

Returns
string in the data segment in: transaction
UNIV_INTERN trx_t* trx_get_trx_by_xid ( XID xid)

This function is used to find one X/Open XA distributed transaction which is in the prepared state

Returns
trx or NULL in: X/Open XA transaction identification

This function is used to find one X/Open XA distributed transaction which is in the prepared state

Returns
trx or NULL
Parameters
xidin: X/Open XA transaction identification

Definition at line 2000 of file trx0trx.cc.

References xid_t::bqual_length, trx_struct::conc_state, xid_t::data, xid_t::gtrid_length, trx_get_trx_by_xid(), trx_sys, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, and trx_struct::xid.

Referenced by InnobaseEngine::doXaCommitXid(), InnobaseEngine::doXaRollbackXid(), and trx_get_trx_by_xid().

UNIV_INTERN ibool trx_is_interrupted ( trx_t trx)

Determines if the currently running transaction has been interrupted.

Returns
TRUE if interrupted in: transaction

Determines if the currently running transaction has been interrupted.

Returns
TRUE if interrupted
Parameters
trxin: transaction

Definition at line 1844 of file ha_innodb.cc.

References trx_struct::mysql_thd.

Referenced by btr_validate_index(), row_check_index_for_mysql(), srv_lock_timeout_thread(), and srv_suspend_mysql_thread().

UNIV_INTERN ibool trx_is_strict ( trx_t trx)

Determines if the currently running transaction is in strict mode.

Returns
TRUE if strict in: transaction

Determines if the currently running transaction is in strict mode.

Returns
TRUE if strict
Parameters
trxin: transaction

Definition at line 1856 of file ha_innodb.cc.

References trx_struct::mysql_thd.

Referenced by dict_create_index_step().

UNIV_INTERN void trx_lists_init_at_db_start ( void  )

Creates trx objects for transactions and initializes the trx list of trx_sys at database start. Rollback segment and undo log lists must already exist when this function is called, because the lists of transactions to be rolled back or cleaned up are built based on the undo log lists.

Definition at line 422 of file trx0trx.cc.

References trx_struct::conc_state, trx_undo_struct::dict_operation, trx_undo_struct::empty, trx_struct::id, trx_struct::insert_undo, trx_struct::is_recovered, trx_struct::no, trx_struct::rseg, trx_undo_struct::state, trx_undo_struct::table_id, trx_struct::table_id, trx_undo_struct::top_undo_no, trx_create(), TRX_DICT_OP_TABLE, trx_dummy_sess, trx_get_on_id(), trx_undo_struct::trx_id, TRX_ID_FMT, trx_lists_init_at_db_start(), trx_set_dict_operation(), trx_sys, trx_struct::undo_no, trx_struct::update_undo, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, UT_LIST_INIT, trx_undo_struct::xid, and trx_struct::xid.

Referenced by trx_lists_init_at_db_start(), and trx_sys_init_at_db_start().

UNIV_INLINE ibool trx_log_commit_id ( const trx_t trx)

Checks if the commit id should be logged to the sys header file

Returns
TRUE if the commit id should be logged in: trx object

Referenced by trx_commit_off_kernel().

UNIV_INTERN void trx_mark_sql_stat_end ( trx_t trx)

Marks the latest SQL statement ended. in: trx handle

Marks the latest SQL statement ended.

Parameters
trxin: trx handle

Definition at line 1616 of file trx0trx.cc.

References trx_struct::conc_state, trx_savept_struct::least_undo_no, trx_mark_sql_stat_end(), trx_struct::undo_no, and ut_a.

Referenced by InnobaseEngine::doCommit(), InnobaseEngine::doXaPrepare(), trx_mark_sql_stat_end(), trx_rollback_last_sql_stat_for_mysql(), and trx_rollback_to_savepoint_for_mysql().

UNIV_INTERN ulint trx_prepare_for_mysql ( trx_t trx)

Does the transaction prepare for MySQL.

Returns
0 or error number in: trx handle

Does the transaction prepare for MySQL.

Returns
0 or error number
Parameters
trxin: trx handle

Definition at line 1899 of file trx0trx.cc.

References trx_struct::op_info, trx_prepare_for_mysql(), trx_start_if_not_started(), and ut_a.

Referenced by InnobaseEngine::doXaPrepare(), and trx_prepare_for_mysql().

UNIV_INTERN void trx_print ( FILE *  f,
trx_t trx,
ulint  max_query_len 
)

Prints info about a transaction to the given file. The caller must own the kernel mutex. in: max query length to print, or 0 to use the default max length

Prints info about a transaction to the given file. The caller must own the kernel mutex.

Parameters
fin: output stream
trxin: transaction
max_query_lenin: max query length to print, or 0 to use the default max length

Definition at line 1634 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::id, innobase_mysql_print_thd(), trx_struct::is_purge, trx_struct::is_recovered, trx_struct::lock_heap, lock_number_of_rows_locked(), mem_heap_get_size(), trx_struct::mysql_thd, trx_struct::op_info, os_thread_pf(), trx_struct::que_state, trx_struct::start_time, TRX_ID_FMT, trx_struct::trx_locks, trx_print(), trx_struct::undo_no, and UT_LIST_GET_LEN.

Referenced by btr_pcur_restore_position_func(), lock_print_info_all_transactions(), row_ins_check_foreign_constraint(), row_search_for_mysql(), srv_conc_enter_innodb(), trx_free(), and trx_print().

UNIV_INTERN int trx_recover_for_mysql ( XID xid_list,
ulint  len 
)

This function is used to find number of prepared transactions and their transaction objects for a recovery.

Returns
number of prepared transactions in: number of slots in xid_list

This function is used to find number of prepared transactions and their transaction objects for a recovery.

Returns
number of prepared transactions stored in xid_list
Parameters
xid_listin/out: prepared transactions
lenin: number of slots in xid_list

Definition at line 1930 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::id, TRX_ID_FMT, trx_recover_for_mysql(), trx_sys, trx_struct::undo_no, ut_ad, UT_LIST_GET_FIRST, UT_LIST_GET_NEXT, ut_print_timestamp(), and trx_struct::xid.

Referenced by InnobaseEngine::doXaRecover(), and trx_recover_for_mysql().

UNIV_INTERN void trx_set_detailed_error ( trx_t trx,
const char *  msg 
)

Set detailed error message for the transaction. in: detailed error message

Set detailed error message for the transaction.

Parameters
trxin: transaction struct
msgin: detailed error message

Definition at line 63 of file trx0trx.cc.

References trx_struct::detailed_error, trx_set_detailed_error(), and ut_strlcpy().

Referenced by trx_set_detailed_error().

UNIV_INTERN void trx_set_detailed_error_from_file ( trx_t trx,
FILE *  file 
)

Set detailed error message for the transaction from a file. Note that the file is rewinded before reading from it. in: file to read message from

Set detailed error message for the transaction from a file. Note that the file is rewinded before reading from it.

Parameters
trxin: transaction struct
filein: file to read message from

Definition at line 76 of file trx0trx.cc.

References trx_struct::detailed_error, os_file_read_string(), and trx_set_detailed_error_from_file().

Referenced by trx_set_detailed_error_from_file().

UNIV_INLINE void trx_set_dict_operation ( trx_t trx,
enum trx_dict_op  op 
)

Flag a transaction a dictionary operation. in: operation, not TRX_DICT_OP_NONE

Parameters
trxin/out: transaction

Referenced by row_create_index_for_mysql(), row_create_table_for_mysql(), row_drop_table_for_mysql(), row_table_add_foreign_constraints(), and trx_lists_init_at_db_start().

UNIV_INTERN void trx_sig_remove ( trx_t trx,
trx_sig_t sig 
)

Removes the signal object from a trx signal queue. in, own: signal

Removes a signal object from the trx signal queue.

Parameters
trxin: trx handle
sigin, own: signal

Definition at line 1451 of file trx0trx.cc.

References mem_free, trx_sig_struct::receiver, trx_struct::sig, trx_struct::signals, trx_sig_remove(), trx_sig_struct::type, ut_ad, and UT_LIST_REMOVE.

Referenced by trx_finish_rollback_off_kernel(), trx_sig_remove(), and trx_sig_start_handle().

UNIV_INTERN void trx_sig_reply ( trx_sig_t sig,
que_thr_t **  next_thr 
)

Send the reply message when a signal in the queue of the trx has been handled. in/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread

Send the reply message when a signal in the queue of the trx has been handled.

Parameters
sigin: signal
next_thrin/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread

Definition at line 1417 of file trx0trx.cc.

References que_thr_end_wait(), trx_sig_struct::receiver, trx_struct::reply_signals, trx_struct::sess, sess_struct::state, thr_get_trx(), trx_sig_reply(), ut_ad, and UT_LIST_REMOVE.

Referenced by trx_finish_rollback_off_kernel(), trx_sig_reply(), and trx_sig_start_handle().

UNIV_INTERN void trx_sig_send ( trx_t trx,
ulint  type,
ulint  sender,
que_thr_t receiver_thr,
trx_savept_t savept,
que_thr_t **  next_thr 
)

Sends a signal to a trx object. in/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread; if the parameter is NULL, it is ignored

Sends a signal to a trx object.

Parameters
trxin: trx handle
typein: signal type
senderin: TRX_SIG_SELF or TRX_SIG_OTHER_SESS
receiver_thrin: query thread which wants the reply, or NULL; if type is TRX_SIG_END_WAIT, this must be NULL
saveptin: possible rollback savepoint, or NULL
next_thrin/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread; if the parameter is NULL, it is ignored

Definition at line 1203 of file trx0trx.cc.

References trx_sig_struct::receiver, trx_struct::reply_signals, trx_sig_struct::savept, trx_sig_struct::sender, trx_struct::sess, trx_struct::sig, trx_struct::signals, sess_struct::state, thr_get_trx(), trx_sig_send(), trx_sig_start_handle(), trx_sig_struct::type, ut_ad, ut_error, UT_LIST_ADD_LAST, UT_LIST_GET_FIRST, and UT_LIST_GET_LEN.

Referenced by trx_commit_step(), trx_rollback_step(), and trx_sig_send().

UNIV_INTERN void trx_sig_start_handle ( trx_t trx,
que_thr_t **  next_thr 
)

Starts handling of a trx signal. in/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread

Starts handling of a trx signal.

Parameters
trxin: trx handle
next_thrin/out: next query thread to run; if the value which is passed in is a pointer to a NULL pointer, then the calling function can start running a new query thread; if the parameter is NULL, it is ignored

Definition at line 1311 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::graph, trx_struct::n_active_thrs, trx_struct::que_state, trx_struct::sess, trx_struct::signals, sess_struct::state, trx_end_signal_handling(), trx_rollback(), trx_sig_remove(), trx_sig_reply(), trx_sig_start_handle(), trx_start_low(), trx_sig_struct::type, ut_ad, ut_error, UT_LIST_GET_FIRST, and UT_LIST_GET_LEN.

Referenced by trx_sig_send(), and trx_sig_start_handle().

UNIV_INTERN ibool trx_start ( trx_t trx,
ulint  rseg_id 
)

Starts a new transaction.

Returns
TRUE if success, FALSE if the rollback segment could not support this many transactions in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion

Starts a new transaction.

Returns
TRUE
Parameters
trxin: transaction
rseg_idin: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion

Definition at line 689 of file trx0trx.cc.

References trx_struct::mysql_thd, trx_struct::support_xa, thd_supports_xa(), trx_start(), and trx_start_low().

Referenced by trx_start().

UNIV_INLINE void trx_start_if_not_started_low ( trx_t trx)

Starts the transaction if it is not yet started. Assumes we have reserved the kernel mutex! in: transaction

Referenced by row_search_check_if_query_cache_permitted().

UNIV_INTERN ibool trx_start_low ( trx_t trx,
ulint  rseg_id 
)

Starts a new transaction.

Returns
TRUE in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion

Starts a new transaction.

Returns
TRUE
Parameters
trxin: transaction
rseg_idin: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion

Definition at line 638 of file trx0trx.cc.

References trx_struct::conc_state, trx_struct::id, trx_struct::is_purge, trx_struct::no, trx_struct::rseg, trx_struct::start_time, trx_start_low(), trx_sys, trx_sys_get_new_trx_id(), trx_sys_get_nth_rseg(), ut_ad, and UT_LIST_ADD_FIRST.

Referenced by trx_purge_sys_create(), trx_sig_start_handle(), trx_start(), and trx_start_low().

UNIV_INTERN ibool trx_weight_ge ( const trx_t a,
const trx_t b 
)

Compares the "weight" (or size) of two transactions. Transactions that have edited non-transactional tables are considered heavier than ones that have not.

Returns
TRUE if weight(a) >= weight(b) in: the second transaction to be compared

Compares the "weight" (or size) of two transactions. Transactions that have edited non-transactional tables are considered heavier than ones that have not.

Returns
TRUE if weight(a) >= weight(b)
Parameters
ain: the first transaction to be compared
bin: the second transaction to be compared

Definition at line 1748 of file trx0trx.cc.

References trx_struct::mysql_thd, thd_has_edited_nontrans_tables(), trx_struct::trx_locks, TRX_WEIGHT, trx_weight_ge(), trx_struct::undo_no, and UT_LIST_GET_LEN.

Referenced by trx_weight_ge().

Variable Documentation

sess_t* trx_dummy_sess

Dummy session used currently in MySQL interface

Definition at line 48 of file trx0trx.cc.

Referenced by trx_allocate_for_background(), trx_allocate_for_mysql(), trx_lists_init_at_db_start(), trx_sys_close(), and trx_sys_init_at_db_start().

ulint trx_n_mysql_transactions
Number of transactions currently allocated for MySQL: protected by

the kernel mutex

Definition at line 52 of file trx0trx.cc.

Referenced by logs_empty_and_mark_files_at_shutdown(), trx_allocate_for_mysql(), and trx_free_for_mysql().