summaryrefslogtreecommitdiff
path: root/storage/xtradb/include/trx0trx.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/xtradb/include/trx0trx.h')
-rw-r--r--storage/xtradb/include/trx0trx.h407
1 files changed, 209 insertions, 198 deletions
diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h
index 1bec1ff73be..da031d9d5d3 100644
--- a/storage/xtradb/include/trx0trx.h
+++ b/storage/xtradb/include/trx0trx.h
@@ -16,7 +16,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
*****************************************************************************/
-/******************************************************
+/**************************************************//**
+@file include/trx0trx.h
The transaction
Created 3/26/1996 Heikki Tuuri
@@ -27,99 +28,100 @@ Created 3/26/1996 Heikki Tuuri
#include "univ.i"
#include "trx0types.h"
+#include "dict0types.h"
+#ifndef UNIV_HOTBACKUP
#include "lock0types.h"
#include "usr0types.h"
#include "que0types.h"
#include "mem0mem.h"
#include "read0types.h"
-#include "dict0types.h"
#include "trx0xa.h"
#include "ut0vec.h"
-/* Dummy session used currently in MySQL interface */
+/** Dummy session used currently in MySQL interface */
extern sess_t* trx_dummy_sess;
-/* Number of transactions currently allocated for MySQL: protected by
+/** Number of transactions currently allocated for MySQL: protected by
the kernel mutex */
extern ulint trx_n_mysql_transactions;
-/************************************************************************
+/********************************************************************//**
Releases the search latch if trx has reserved it. */
UNIV_INTERN
void
trx_search_latch_release_if_reserved(
/*=================================*/
- trx_t* trx); /* in: transaction */
-/**********************************************************************
+ trx_t* trx); /*!< in: transaction */
+/******************************************************************//**
Set detailed error message for the transaction. */
UNIV_INTERN
void
trx_set_detailed_error(
/*===================*/
- trx_t* trx, /* in: transaction struct */
- const char* msg); /* in: detailed error message */
-/*****************************************************************
+ trx_t* trx, /*!< in: transaction struct */
+ const char* msg); /*!< in: detailed error message */
+/*************************************************************//**
Set detailed error message for the transaction from a file. Note that the
file is rewinded before reading from it. */
UNIV_INTERN
void
trx_set_detailed_error_from_file(
/*=============================*/
- trx_t* trx, /* in: transaction struct */
- FILE* file); /* in: file to read message from */
-/********************************************************************
-Retrieves the error_info field from a trx. */
+ trx_t* trx, /*!< in: transaction struct */
+ FILE* file); /*!< in: file to read message from */
+/****************************************************************//**
+Retrieves the error_info field from a trx.
+@return the error info */
UNIV_INLINE
const dict_index_t*
trx_get_error_info(
/*===============*/
- /* out: the error info */
- const trx_t* trx); /* in: trx object */
-/********************************************************************
-Creates and initializes a transaction object. */
+ const trx_t* trx); /*!< in: trx object */
+/****************************************************************//**
+Creates and initializes a transaction object.
+@return own: the transaction */
UNIV_INTERN
trx_t*
trx_create(
/*=======*/
- /* out, own: the transaction */
- sess_t* sess) /* in: session */
+ sess_t* sess) /*!< in: session */
__attribute__((nonnull));
-/************************************************************************
-Creates a transaction object for MySQL. */
+/********************************************************************//**
+Creates a transaction object for MySQL.
+@return own: transaction object */
UNIV_INTERN
trx_t*
trx_allocate_for_mysql(void);
/*========================*/
- /* out, own: transaction object */
-/************************************************************************
-Creates a transaction object for background operations by the master thread. */
+/********************************************************************//**
+Creates a transaction object for background operations by the master thread.
+@return own: transaction object */
UNIV_INTERN
trx_t*
trx_allocate_for_background(void);
/*=============================*/
- /* out, own: transaction object */
-/************************************************************************
+/********************************************************************//**
Frees a transaction object. */
UNIV_INTERN
void
trx_free(
/*=====*/
- trx_t* trx); /* in, own: trx object */
-/************************************************************************
+ trx_t* trx); /*!< in, own: trx object */
+/********************************************************************//**
Frees a transaction object for MySQL. */
UNIV_INTERN
void
trx_free_for_mysql(
/*===============*/
- trx_t* trx); /* in, own: trx object */
-/************************************************************************
+ trx_t* trx); /*!< in, own: trx object */
+/********************************************************************//**
Frees a transaction object of a background operation of the master thread. */
UNIV_INTERN
void
trx_free_for_background(
/*====================*/
- trx_t* trx); /* in, own: trx object */
-/********************************************************************
+ trx_t* trx); /*!< in, own: trx object */
+/****************************************************************//**
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
@@ -129,52 +131,52 @@ UNIV_INTERN
void
trx_lists_init_at_db_start(void);
/*============================*/
-/********************************************************************
-Starts a new transaction. */
+/****************************************************************//**
+Starts a new transaction.
+@return TRUE if success, FALSE if the rollback segment could not
+support this many transactions */
UNIV_INTERN
ibool
trx_start(
/*======*/
- /* out: TRUE if success, FALSE if the rollback
- segment could not support this many transactions */
- trx_t* trx, /* in: transaction */
- ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED
+ trx_t* trx, /*!< in: transaction */
+ ulint rseg_id);/*!< 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. */
+/****************************************************************//**
+Starts a new transaction.
+@return TRUE */
UNIV_INTERN
ibool
trx_start_low(
/*==========*/
- /* out: TRUE */
- trx_t* trx, /* in: transaction */
- ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED
+ trx_t* trx, /*!< in: transaction */
+ ulint rseg_id);/*!< in: rollback segment id; if ULINT_UNDEFINED
is passed, the system chooses the rollback segment
automatically in a round-robin fashion */
-/*****************************************************************
+/*************************************************************//**
Starts the transaction if it is not yet started. */
UNIV_INLINE
void
trx_start_if_not_started(
/*=====================*/
- trx_t* trx); /* in: transaction */
-/*****************************************************************
+ trx_t* trx); /*!< in: transaction */
+/*************************************************************//**
Starts the transaction if it is not yet started. Assumes we have reserved
the kernel mutex! */
UNIV_INLINE
void
trx_start_if_not_started_low(
/*=========================*/
- trx_t* trx); /* in: transaction */
-/********************************************************************
+ trx_t* trx); /*!< in: transaction */
+/****************************************************************//**
Commits a transaction. */
UNIV_INTERN
void
trx_commit_off_kernel(
/*==================*/
- trx_t* trx); /* in: transaction */
-/********************************************************************
+ trx_t* trx); /*!< 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, andf we cannot roll it back. */
@@ -182,69 +184,69 @@ UNIV_INTERN
void
trx_cleanup_at_db_startup(
/*======================*/
- trx_t* trx); /* in: transaction */
-/**************************************************************************
-Does the transaction commit for MySQL. */
+ trx_t* trx); /*!< in: transaction */
+/**********************************************************************//**
+Does the transaction commit for MySQL.
+@return DB_SUCCESS or error number */
UNIV_INTERN
ulint
trx_commit_for_mysql(
/*=================*/
- /* out: DB_SUCCESS or error number */
- trx_t* trx); /* in: trx handle */
-/**************************************************************************
-Does the transaction prepare for MySQL. */
+ trx_t* trx); /*!< in: trx handle */
+/**********************************************************************//**
+Does the transaction prepare for MySQL.
+@return 0 or error number */
UNIV_INTERN
ulint
trx_prepare_for_mysql(
/*==================*/
- /* out: 0 or error number */
- trx_t* trx); /* in: trx handle */
-/**************************************************************************
+ trx_t* trx); /*!< in: trx handle */
+/**********************************************************************//**
This function is used to find number of prepared transactions and
-their transaction objects for a recovery. */
+their transaction objects for a recovery.
+@return number of prepared transactions */
UNIV_INTERN
int
trx_recover_for_mysql(
/*==================*/
- /* out: number of prepared transactions */
- XID* xid_list, /* in/out: prepared transactions */
- ulint len); /* in: number of slots in xid_list */
-/***********************************************************************
+ XID* xid_list, /*!< in/out: prepared transactions */
+ ulint len); /*!< in: number of slots in xid_list */
+/*******************************************************************//**
This function is used to find one X/Open XA distributed transaction
-which is in the prepared state */
+which is in the prepared state
+@return trx or NULL */
UNIV_INTERN
trx_t *
trx_get_trx_by_xid(
/*===============*/
- /* out: trx or NULL */
- XID* xid); /* in: X/Open XA transaction identification */
-/**************************************************************************
+ XID* xid); /*!< in: X/Open XA transaction identification */
+/**********************************************************************//**
If required, flushes the log to disk if we called trx_commit_for_mysql()
-with trx->flush_log_later == TRUE. */
+with trx->flush_log_later == TRUE.
+@return 0 or error number */
UNIV_INTERN
ulint
trx_commit_complete_for_mysql(
/*==========================*/
- /* out: 0 or error number */
- trx_t* trx); /* in: trx handle */
-/**************************************************************************
+ trx_t* trx); /*!< in: trx handle */
+/**********************************************************************//**
Marks the latest SQL statement ended. */
UNIV_INTERN
void
trx_mark_sql_stat_end(
/*==================*/
- trx_t* trx); /* in: trx handle */
-/************************************************************************
+ trx_t* trx); /*!< in: trx handle */
+/********************************************************************//**
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. */
+when this function is first called for a new started transaction.
+@return consistent read view */
UNIV_INTERN
read_view_t*
trx_assign_read_view(
/*=================*/
- /* out: consistent read view */
- trx_t* trx); /* in: active transaction */
-/***************************************************************
+ trx_t* trx); /*!< in: active 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. */
@@ -252,62 +254,62 @@ UNIV_INTERN
void
trx_end_lock_wait(
/*==============*/
- trx_t* trx); /* in: transaction */
-/********************************************************************
+ trx_t* trx); /*!< in: transaction */
+/****************************************************************//**
Sends a signal to a trx object. */
UNIV_INTERN
void
trx_sig_send(
/*=========*/
- trx_t* trx, /* in: trx handle */
- ulint type, /* in: signal type */
- ulint sender, /* in: TRX_SIG_SELF or
+ trx_t* trx, /*!< in: trx handle */
+ ulint type, /*!< in: signal type */
+ ulint sender, /*!< in: TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
- que_thr_t* receiver_thr, /* in: query thread which wants the
+ que_thr_t* receiver_thr, /*!< in: query thread which wants the
reply, or NULL; if type is
TRX_SIG_END_WAIT, this must be NULL */
- trx_savept_t* savept, /* in: possible rollback savepoint, or
+ trx_savept_t* savept, /*!< in: possible rollback savepoint, or
NULL */
- que_thr_t** next_thr); /* in/out: next query thread to run;
+ que_thr_t** next_thr); /*!< 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 */
-/********************************************************************
+/****************************************************************//**
Send the reply message when a signal in the queue of the trx has
been handled. */
UNIV_INTERN
void
trx_sig_reply(
/*==========*/
- trx_sig_t* sig, /* in: signal */
- que_thr_t** next_thr); /* in/out: next query thread to run;
+ trx_sig_t* sig, /*!< in: signal */
+ que_thr_t** next_thr); /*!< 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 */
-/********************************************************************
+/****************************************************************//**
Removes the signal object from a trx signal queue. */
UNIV_INTERN
void
trx_sig_remove(
/*===========*/
- trx_t* trx, /* in: trx handle */
- trx_sig_t* sig); /* in, own: signal */
-/********************************************************************
+ trx_t* trx, /*!< in: trx handle */
+ trx_sig_t* sig); /*!< in, own: signal */
+/****************************************************************//**
Starts handling of a trx signal. */
UNIV_INTERN
void
trx_sig_start_handle(
/*=================*/
- trx_t* trx, /* in: trx handle */
- que_thr_t** next_thr); /* in/out: next query thread to run;
+ trx_t* trx, /*!< in: trx handle */
+ que_thr_t** next_thr); /*!< 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 */
-/********************************************************************
+/****************************************************************//**
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
@@ -316,25 +318,25 @@ UNIV_INTERN
void
trx_end_signal_handling(
/*====================*/
- trx_t* trx); /* in: trx */
-/*************************************************************************
-Creates a commit command node struct. */
+ trx_t* trx); /*!< in: trx */
+/*********************************************************************//**
+Creates a commit command node struct.
+@return own: commit node struct */
UNIV_INTERN
commit_node_t*
commit_node_create(
/*===============*/
- /* out, own: commit node struct */
- mem_heap_t* heap); /* in: mem heap where created */
-/***************************************************************
-Performs an execution step for a commit type node in a query graph. */
+ mem_heap_t* heap); /*!< in: mem heap where created */
+/***********************************************************//**
+Performs an execution step for a commit type node in a query graph.
+@return query thread to run next, or NULL */
UNIV_INTERN
que_thr_t*
trx_commit_step(
/*============*/
- /* out: query thread to run next, or NULL */
- que_thr_t* thr); /* in: query thread */
+ que_thr_t* thr); /*!< in: query thread */
-/**************************************************************************
+/**********************************************************************//**
Prints info about a transaction to the given file. The caller must own the
kernel mutex and must have called
innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
@@ -343,9 +345,9 @@ UNIV_INTERN
void
trx_print(
/*======*/
- FILE* f, /* in: output stream */
- trx_t* trx, /* in: transaction */
- ulint max_query_len); /* in: max query length to print, or 0 to
+ FILE* f, /*!< in: output stream */
+ trx_t* trx, /*!< in: transaction */
+ ulint max_query_len); /*!< in: max query length to print, or 0 to
use the default max length */
/** Type of data dictionary operation */
@@ -363,95 +365,95 @@ enum trx_dict_op {
TRX_DICT_OP_INDEX = 2
};
-/**************************************************************************
-Determine if a transaction is a dictionary operation. */
+/**********************************************************************//**
+Determine if a transaction is a dictionary operation.
+@return dictionary operation mode */
UNIV_INLINE
enum trx_dict_op
trx_get_dict_operation(
/*===================*/
- /* out: dictionary operation mode */
- const trx_t* trx) /* in: transaction */
+ const trx_t* trx) /*!< in: transaction */
__attribute__((pure));
-/**************************************************************************
+/**********************************************************************//**
Flag a transaction a dictionary operation. */
UNIV_INLINE
void
trx_set_dict_operation(
/*===================*/
- trx_t* trx, /* in/out: transaction */
- enum trx_dict_op op); /* in: operation, not
+ trx_t* trx, /*!< in/out: transaction */
+ enum trx_dict_op op); /*!< in: operation, not
TRX_DICT_OP_NONE */
#ifndef UNIV_HOTBACKUP
-/**************************************************************************
-Determines if the currently running transaction has been interrupted. */
+/**********************************************************************//**
+Determines if the currently running transaction has been interrupted.
+@return TRUE if interrupted */
UNIV_INTERN
ibool
trx_is_interrupted(
/*===============*/
- /* out: TRUE if interrupted */
- trx_t* trx); /* in: transaction */
+ trx_t* trx); /*!< in: transaction */
#else /* !UNIV_HOTBACKUP */
#define trx_is_interrupted(trx) FALSE
#endif /* !UNIV_HOTBACKUP */
-/***********************************************************************
+/*******************************************************************//**
Calculates the "weight" of a transaction. The weight of one transaction
is estimated as the number of altered rows + the number of locked rows.
-*/
-
+@param t transaction
+@return transaction weight */
#define TRX_WEIGHT(t) \
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
-/***********************************************************************
+/*******************************************************************//**
Compares the "weight" (or size) of two transactions. Transactions that
have edited non-transactional tables are considered heavier than ones
-that have not. */
+that have not.
+@return <0, 0 or >0; similar to strcmp(3) */
UNIV_INTERN
int
trx_weight_cmp(
/*===========*/
- /* out: <0, 0 or >0; similar to strcmp(3) */
- const trx_t* a, /* in: the first transaction to be compared */
- const trx_t* b); /* in: the second transaction to be compared */
+ const trx_t* a, /*!< in: the first transaction to be compared */
+ const trx_t* b); /*!< in: the second transaction to be compared */
-/***********************************************************************
-Retrieves transacion's id, represented as unsigned long long. */
+/*******************************************************************//**
+Retrieves transacion's id, represented as unsigned long long.
+@return transaction's id */
UNIV_INLINE
ullint
trx_get_id(
/*=======*/
- /* out: transaction's id */
- const trx_t* trx); /* in: transaction */
+ const trx_t* trx); /*!< in: transaction */
/* Maximum length of a string that can be returned by
trx_get_que_state_str(). */
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
-/***********************************************************************
+/*******************************************************************//**
Retrieves transaction's que state in a human readable string. The string
-should not be free()'d or modified. */
+should not be free()'d or modified.
+@return string in the data segment */
UNIV_INLINE
const char*
trx_get_que_state_str(
/*==================*/
- /* out: string in the data segment */
- const trx_t* trx); /* in: transaction */
+ const trx_t* trx); /*!< in: transaction */
/* Signal to a transaction */
struct trx_sig_struct{
- unsigned type:3; /* signal type */
- unsigned sender:1; /* TRX_SIG_SELF or
+ unsigned type:3; /*!< signal type */
+ unsigned sender:1; /*!< TRX_SIG_SELF or
TRX_SIG_OTHER_SESS */
- que_thr_t* receiver; /* non-NULL if the sender of the signal
+ que_thr_t* receiver; /*!< non-NULL if the sender of the signal
wants reply after the operation induced
by the signal is completed */
- trx_savept_t savept; /* possible rollback savepoint */
+ trx_savept_t savept; /*!< possible rollback savepoint */
UT_LIST_NODE_T(trx_sig_t)
- signals; /* queue of pending signals to the
+ signals; /*!< queue of pending signals to the
transaction */
UT_LIST_NODE_T(trx_sig_t)
- reply_signals; /* list of signals for which the sender
+ reply_signals; /*!< list of signals for which the sender
transaction is waiting a reply */
};
@@ -465,17 +467,17 @@ struct trx_struct{
ulint magic_n;
/* All the next fields are protected by the kernel mutex, except the
undo logs which are protected by undo_mutex */
- const char* op_info; /* English text describing the
+ const char* op_info; /*!< English text describing the
current operation, or an empty
string */
- unsigned is_purge:1; /* 0=user transaction, 1=purge */
- unsigned is_recovered:1; /* 0=normal transaction,
+ unsigned is_purge:1; /*!< 0=user transaction, 1=purge */
+ unsigned is_recovered:1; /*!< 0=normal transaction,
1=recovered, must be rolled back */
- unsigned conc_state:2; /* state of the trx from the point
+ unsigned conc_state:2; /*!< state of the trx from the point
of view of concurrency control:
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
... */
- unsigned que_state:2; /* valid when conc_state == TRX_ACTIVE:
+ unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE:
TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
... */
unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
@@ -490,15 +492,17 @@ struct trx_struct{
for secondary indexes when we decide
if we can use the insert buffer for
them, we set this FALSE */
- unsigned support_xa:1; /* normally we do the XA two-phase
+ unsigned support_xa:1; /*!< normally we do the XA two-phase
commit steps, but by setting this to
FALSE, one can save CPU time and about
150 bytes in the undo log size as then
we skip XA steps */
- unsigned flush_log_later:1;/* when we commit the transaction
- in MySQL's binlog write, we will
- flush the log to disk later in
- a separate call */
+ unsigned flush_log_later:1;/* In 2PC, we hold the
+ prepare_commit mutex across
+ both phases. In that case, we
+ defer flush of the logs to disk
+ until after we release the
+ mutex. */
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
trx_commit_off_kernel() if
flush_log_later was TRUE, and there
@@ -506,8 +510,8 @@ struct trx_struct{
in that case we must flush the log
in trx_commit_complete_for_mysql() */
unsigned dict_operation:2;/**< @see enum trx_dict_op */
- unsigned duplicates:2; /* TRX_DUP_IGNORE | TRX_DUP_REPLACE */
- unsigned active_trans:2; /* 1 - if a transaction in MySQL
+ unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
+ unsigned active_trans:2; /*!< 1 - if a transaction in MySQL
is active. 2 - if prepare_commit_mutex
was taken */
unsigned has_search_latch:1;
@@ -524,21 +528,21 @@ struct trx_struct{
/* 0, RW_S_LATCH, or RW_X_LATCH:
the latch mode trx currently holds
on dict_operation_lock */
- time_t start_time; /* time the trx object was created
+ time_t start_time; /*!< time the trx object was created
or the state last time became
TRX_ACTIVE */
- dulint id; /* transaction id */
- XID xid; /* X/Open XA transaction
+ trx_id_t id; /*!< transaction id */
+ XID xid; /*!< X/Open XA transaction
identification to identify a
transaction branch */
- dulint no; /* transaction serialization number ==
+ trx_id_t no; /*!< transaction serialization number ==
max trx id when the transaction is
moved to COMMITTED_IN_MEMORY state */
- ib_uint64_t commit_lsn; /* lsn at the time of the commit */
- dulint table_id; /* Table to drop iff dict_operation
+ ib_uint64_t commit_lsn; /*!< lsn at the time of the commit */
+ trx_id_t table_id; /*!< Table to drop iff dict_operation
is TRUE, or ut_dulint_zero. */
/*------------------------------*/
- void* mysql_thd; /* MySQL thread handle corresponding
+ void* mysql_thd; /*!< MySQL thread handle corresponding
to this trx, or NULL */
char** mysql_query_str;/* pointer to the field in mysqld_thd
which contains the pointer to the
@@ -597,48 +601,48 @@ struct trx_struct{
here is > 0, we decrement this by 1 */
/*------------------------------*/
UT_LIST_NODE_T(trx_t)
- trx_list; /* list of transactions */
+ trx_list; /*!< list of transactions */
UT_LIST_NODE_T(trx_t)
- mysql_trx_list; /* list of transactions created for
+ mysql_trx_list; /*!< list of transactions created for
MySQL */
/*------------------------------*/
- ulint error_state; /* 0 if no error, otherwise error
+ ulint error_state; /*!< 0 if no error, otherwise error
number; NOTE That ONLY the thread
doing the transaction is allowed to
set this field: this is NOT protected
by the kernel mutex */
- const dict_index_t*error_info; /* if the error number indicates a
+ const dict_index_t*error_info; /*!< if the error number indicates a
duplicate key error, a pointer to
the problematic index is stored here */
- ulint error_key_num; /* if the index creation fails to a
+ ulint error_key_num; /*!< if the index creation fails to a
duplicate key error, a mysql key
number of that index is stored here */
- sess_t* sess; /* session of the trx, NULL if none */
- que_t* graph; /* query currently run in the session,
+ sess_t* sess; /*!< session of the trx, NULL if none */
+ que_t* graph; /*!< query currently run in the session,
or NULL if none; NOTE that the query
belongs to the session, and it can
survive over a transaction commit, if
it is a stored procedure with a COMMIT
WORK statement, for instance */
- ulint n_active_thrs; /* number of active query threads */
+ ulint n_active_thrs; /*!< number of active query threads */
que_t* graph_before_signal_handling;
/* value of graph when signal handling
for this trx started: this is used to
return control to the original query
graph for error processing */
- trx_sig_t sig; /* one signal object can be allocated
+ trx_sig_t sig; /*!< one signal object can be allocated
in this space, avoiding mem_alloc */
UT_LIST_BASE_NODE_T(trx_sig_t)
- signals; /* queue of processed or pending
+ signals; /*!< queue of processed or pending
signals to the trx */
UT_LIST_BASE_NODE_T(trx_sig_t)
- reply_signals; /* list of signals sent by the query
+ reply_signals; /*!< list of signals sent by the query
threads of this trx for which a thread
is waiting for a reply; if this trx is
killed, the reply requests in the list
must be canceled */
/*------------------------------*/
- lock_t* wait_lock; /* if trx execution state is
+ lock_t* wait_lock; /*!< if trx execution state is
TRX_QUE_LOCK_WAIT, this points to
the lock request, otherwise this is
NULL */
@@ -648,21 +652,21 @@ struct trx_struct{
if another transaction chooses this
transaction as a victim in deadlock
resolution, it sets this to TRUE */
- time_t wait_started; /* lock wait started at this time */
+ time_t wait_started; /*!< lock wait started at this time */
UT_LIST_BASE_NODE_T(que_thr_t)
- wait_thrs; /* query threads belonging to this
+ wait_thrs; /*!< query threads belonging to this
trx that are in the QUE_THR_LOCK_WAIT
state */
- ulint deadlock_mark; /* a mark field used in deadlock
+ ulint deadlock_mark; /*!< a mark field used in deadlock
checking algorithm. This must be
in its own machine word, because
it can be changed by other
threads while holding kernel_mutex. */
/*------------------------------*/
- mem_heap_t* lock_heap; /* memory heap for the locks of the
+ mem_heap_t* lock_heap; /*!< memory heap for the locks of the
transaction */
UT_LIST_BASE_NODE_T(lock_t)
- trx_locks; /* locks reserved by the transaction */
+ trx_locks; /*!< locks reserved by the transaction */
/*------------------------------*/
mem_heap_t* global_read_view_heap;
/* memory heap for the global read
@@ -670,7 +674,7 @@ struct trx_struct{
read_view_t* global_read_view;
/* consistent read view associated
to a transaction or NULL */
- read_view_t* read_view; /* consistent read view used in the
+ read_view_t* read_view; /*!< consistent read view used in the
transaction or NULL, this read view
if defined can be normal read view
associated to a transaction (i.e.
@@ -678,16 +682,16 @@ struct trx_struct{
associated to a cursor */
/*------------------------------*/
UT_LIST_BASE_NODE_T(trx_named_savept_t)
- trx_savepoints; /* savepoints set with SAVEPOINT ...,
+ trx_savepoints; /*!< savepoints set with SAVEPOINT ...,
oldest first */
/*------------------------------*/
- mutex_t undo_mutex; /* mutex protecting the fields in this
+ mutex_t undo_mutex; /*!< mutex protecting the fields in this
section (down to undo_no_arr), EXCEPT
last_sql_stat_start, which can be
accessed only when we know that there
cannot be any activity in the undo
logs! */
- dulint undo_no; /* next undo log record number to
+ undo_no_t undo_no; /*!< next undo log record number to
assign; since the undo log is
private for a transaction, this
is a simple ascending sequence
@@ -699,22 +703,22 @@ struct trx_struct{
was started: in case of an error, trx
is rolled back down to this undo
number; see note at undo_mutex! */
- trx_rseg_t* rseg; /* rollback segment assigned to the
+ trx_rseg_t* rseg; /*!< rollback segment assigned to the
transaction, or NULL if not assigned
yet */
- trx_undo_t* insert_undo; /* pointer to the insert undo log, or
+ trx_undo_t* insert_undo; /*!< pointer to the insert undo log, or
NULL if no inserts performed yet */
- trx_undo_t* update_undo; /* pointer to the update undo log, or
+ trx_undo_t* update_undo; /*!< pointer to the update undo log, or
NULL if no update performed yet */
- dulint roll_limit; /* least undo number to undo during
+ undo_no_t roll_limit; /*!< least undo number to undo during
a rollback */
- ulint pages_undone; /* number of undo log pages undone
+ ulint pages_undone; /*!< number of undo log pages undone
since the last undo log truncation */
- trx_undo_arr_t* undo_no_arr; /* array of undo numbers of undo log
+ trx_undo_arr_t* undo_no_arr; /*!< array of undo numbers of undo log
records which are currently processed
by a rollback operation */
/*------------------------------*/
- ulint n_autoinc_rows; /* no. of AUTO-INC rows required for
+ ulint n_autoinc_rows; /*!< no. of AUTO-INC rows required for
an SQL statement. This is useful for
multi-row INSERTs */
ib_vector_t* autoinc_locks; /* AUTOINC locks held by this
@@ -723,7 +727,7 @@ struct trx_struct{
vector needs to be freed explicitly
when the trx_t instance is desrtoyed */
/*------------------------------*/
- char detailed_error[256]; /* detailed error message for last
+ char detailed_error[256]; /*!< detailed error message for last
error, or empty. */
};
@@ -800,19 +804,26 @@ Multiple flags can be combined with bitwise OR. */
#define TRX_SIG_OTHER_SESS 1 /* sent by another session (which
must hold rights to this) */
-/* Commit command node in a query graph */
+/** Commit node states */
+enum commit_node_state {
+ COMMIT_NODE_SEND = 1, /*!< about to send a commit signal to
+ the transaction */
+ COMMIT_NODE_WAIT /*!< commit signal sent to the transaction,
+ waiting for completion */
+};
+
+/** Commit command node in a query graph */
struct commit_node_struct{
- que_common_t common; /* node type: QUE_NODE_COMMIT */
- ulint state; /* node execution state */
+ que_common_t common; /*!< node type: QUE_NODE_COMMIT */
+ enum commit_node_state
+ state; /*!< node execution state */
};
-/* Commit node states */
-#define COMMIT_NODE_SEND 1
-#define COMMIT_NODE_WAIT 2
#ifndef UNIV_NONINL
#include "trx0trx.ic"
#endif
+#endif /* !UNIV_HOTBACKUP */
#endif