|
drizzle
C++ MySQL-protocol-compatible database server
|
#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) |
| #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_t * | trx_get_error_info (const trx_t *trx) |
| UNIV_INTERN trx_t * | trx_create (sess_t *sess) __attribute__((nonnull)) |
| UNIV_INTERN trx_t * | trx_allocate_for_mysql (void) |
| UNIV_INTERN trx_t * | trx_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_t * | trx_get_trx_by_xid (const 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_t * | trx_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_t * | commit_node_create (mem_heap_t *heap) |
| UNIV_INTERN que_thr_t * | trx_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_t * | trx_dummy_sess |
| ulint | trx_n_mysql_transactions |
| #define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */ |
| #define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */ |
| #define TRX_ISO_READ_COMMITTED |
| #define TRX_ISO_READ_UNCOMMITTED |
| #define TRX_ISO_REPEATABLE_READ |
| #define TRX_ISO_SERIALIZABLE |
| #define TRX_MAX_N_THREADS |
| #define TRX_QUE_COMMITTING 3 /* transaction is committing */ |
| #define TRX_QUE_LOCK_WAIT 1 /* transaction is waiting for a lock */ |
| #define TRX_QUE_ROLLING_BACK 2 /* transaction is rolling back */ |
| #define TRX_SIG_OTHER_SESS |
| #define TRX_SIG_SELF |
| #define TRX_WEIGHT | ( | t | ) |
Calculates the "weight" of a transaction. The weight of one transaction is estimated as the number of altered rows + the number of locked rows.
| t | transaction |
| typedef enum trx_dict_op trx_dict_op_t |
Type of data dictionary operation
| enum commit_node_state |
| enum trx_dict_op |
Type of data dictionary operation
| UNIV_INTERN commit_node_t * commit_node_create | ( | mem_heap_t * | heap | ) |
Creates a commit command node struct.
Creates a commit command node struct.
| heap | in: mem heap where created |
Definition at line 1530 of file trx0trx.cc.
| UNIV_INTERN trx_t * trx_allocate_for_background | ( | void | ) |
Creates a transaction object for background operations by the master thread.
Definition at line 226 of file trx0trx.cc.
| UNIV_INTERN trx_t * trx_allocate_for_mysql | ( | void | ) |
Creates a transaction object for MySQL.
Definition at line 199 of file trx0trx.cc.
| 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.
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.
| trx | in: active transaction |
Definition at line 1028 of file trx0trx.cc.
| 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.
| trx | in: transaction |
Definition at line 1004 of file trx0trx.cc.
| 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.
If required, flushes the log to disk if we called trx_commit_for_mysql() with trx->flush_log_later == TRUE.
| trx | in: trx handle |
Definition at line 1627 of file trx0trx.cc.
| UNIV_INTERN ulint trx_commit_for_mysql | ( | trx_t * | trx | ) |
Does the transaction commit for MySQL.
Does the transaction commit for MySQL.
| trx | in: trx handle |
Definition at line 1596 of file trx0trx.cc.
| UNIV_INTERN void trx_commit_off_kernel | ( | trx_t * | trx | ) |
Commits a transaction. in: transaction
Commits a transaction.
| trx | in: transaction |
Definition at line 846 of file trx0trx.cc.
| 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.
Performs an execution step for a commit type node in a query graph.
| thr | in: query thread |
Definition at line 1548 of file trx0trx.cc.
| UNIV_INTERN trx_t * trx_create | ( | sess_t * | sess | ) |
Creates and initializes a transaction object.
| sess | in: session |
Definition at line 90 of file trx0trx.cc.
| 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.
| trx | in: transaction |
Definition at line 1101 of file trx0trx.cc.
| 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).
| trx | in: trx |
Definition at line 1346 of file trx0trx.cc.
| UNIV_INTERN void trx_free | ( | trx_t * | trx | ) |
Frees a transaction object. in, own: trx object
Frees a transaction object.
| trx | in, own: trx object |
Definition at line 259 of file trx0trx.cc.
| 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.
| trx | in, own: trx object |
Definition at line 363 of file trx0trx.cc.
| 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.
| trx | in, own: trx object |
Definition at line 342 of file trx0trx.cc.
| UNIV_INLINE enum trx_dict_op trx_get_dict_operation | ( | const trx_t * | trx | ) |
Determine if a transaction is a dictionary operation.
| trx | in: transaction |
| UNIV_INLINE const dict_index_t * trx_get_error_info | ( | const trx_t * | trx | ) |
Retrieves the error_info field from a trx.
| 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.
| UNIV_INTERN trx_t * trx_get_trx_by_xid | ( | const XID * | xid | ) |
This function is used to find one X/Open XA distributed transaction which is in the prepared state
This function is used to find one X/Open XA distributed transaction which is in the prepared state
| xid | in: X/Open XA transaction identifier |
Definition at line 2056 of file trx0trx.cc.
| UNIV_INTERN ibool trx_is_interrupted | ( | trx_t * | trx | ) |
Determines if the currently running transaction has been interrupted.
Determines if the currently running transaction has been interrupted.
| trx | in: transaction |
Definition at line 1880 of file ha_innodb.cc.
| UNIV_INTERN ibool trx_is_strict | ( | trx_t * | trx | ) |
Determines if the currently running transaction is in strict mode.
Determines if the currently running transaction is in strict mode.
| trx | in: transaction |
Definition at line 1892 of file ha_innodb.cc.
| 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.
| UNIV_INLINE ibool trx_log_commit_id | ( | const trx_t * | trx | ) |
Checks if the commit id should be logged to the sys header file
| 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.
| trx | in: trx handle |
Definition at line 1672 of file trx0trx.cc.
| UNIV_INTERN ulint trx_prepare_for_mysql | ( | trx_t * | trx | ) |
Does the transaction prepare for MySQL.
Does the transaction prepare for MySQL.
| trx | in: trx handle |
Definition at line 1955 of file trx0trx.cc.
| 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.
| f | in: output stream |
| trx | in: transaction |
| max_query_len | in: max query length to print, or 0 to use the default max length |
Definition at line 1690 of file trx0trx.cc.
| 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.
This function is used to find number of prepared transactions and their transaction objects for a recovery.
| xid_list | in/out: prepared transactions |
| len | in: number of slots in xid_list |
Definition at line 1986 of file trx0trx.cc.
| UNIV_INTERN void trx_search_latch_release_if_reserved | ( | trx_t * | trx | ) |
Releases the search latch if trx has reserved it. in: transaction
Releases the search latch if trx has reserved it.
| trx | in: transaction |
Definition at line 244 of file trx0trx.cc.
| 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.
| trx | in: transaction struct |
| msg | in: detailed error message |
Definition at line 63 of file trx0trx.cc.
| 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.
| trx | in: transaction struct |
| file | in: file to read message from |
Definition at line 76 of file trx0trx.cc.
| 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
| trx | in/out: transaction |
| 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.
| trx | in: trx handle |
| sig | in, own: signal |
Definition at line 1507 of file trx0trx.cc.
| 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.
| sig | in: signal |
| 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 |
Definition at line 1473 of file trx0trx.cc.
| 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.
| trx | in: trx handle |
| type | in: signal type |
| sender | in: TRX_SIG_SELF or TRX_SIG_OTHER_SESS |
| receiver_thr | in: query thread which wants the reply, or NULL; if type is TRX_SIG_END_WAIT, this must be NULL |
| savept | in: possible rollback savepoint, or NULL |
| 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 |
Definition at line 1259 of file trx0trx.cc.
| 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.
| trx | in: trx handle |
| 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 |
Definition at line 1367 of file trx0trx.cc.
| UNIV_INTERN ibool trx_start | ( | trx_t * | trx, |
| ulint | rseg_id ) |
Starts a new transaction.
Starts a new transaction.
| trx | in: transaction |
| rseg_id | in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion |
Definition at line 676 of file trx0trx.cc.
| UNIV_INLINE void trx_start_if_not_started | ( | trx_t * | trx | ) |
Starts the transaction if it is not yet started. in: transaction
| 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
| UNIV_INTERN ibool trx_start_low | ( | trx_t * | trx, |
| ulint | rseg_id ) |
Starts a new transaction.
Starts a new transaction.
| trx | in: transaction |
| rseg_id | in: rollback segment id; if ULINT_UNDEFINED is passed, the system chooses the rollback segment automatically in a round-robin fashion |
Definition at line 628 of file trx0trx.cc.
| 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.
Compares the "weight" (or size) of two transactions. Transactions that have edited non-transactional tables are considered heavier than ones that have not.
| a | in: the first transaction to be compared |
| b | in: the second transaction to be compared |
Definition at line 1804 of file trx0trx.cc.
|
extern |
Dummy session used currently in MySQL interface
Definition at line 48 of file trx0trx.cc.
|
extern |
Number of transactions currently allocated for MySQL: protected by the kernel mutex
Definition at line 52 of file trx0trx.cc.