1
/*****************************************************************************
3
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
5
This program is free software; you can redistribute it and/or modify it under
6
the terms of the GNU General Public License as published by the Free Software
7
Foundation; version 2 of the License.
9
This program is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/trx0trx.ic
23
Created 3/26/1996 Heikki Tuuri
24
*******************************************************/
26
/*************************************************************//**
27
Starts the transaction if it is not yet started. */
30
trx_start_if_not_started(
31
/*=====================*/
32
trx_t* trx) /*!< in: transaction */
34
ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
36
if (trx->conc_state == TRX_NOT_STARTED) {
38
trx_start(trx, ULINT_UNDEFINED);
42
/*************************************************************//**
43
Starts the transaction if it is not yet started. Assumes we have reserved
47
trx_start_if_not_started_low(
48
/*=========================*/
49
trx_t* trx) /*!< in: transaction */
51
ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
53
if (trx->conc_state == TRX_NOT_STARTED) {
55
trx_start_low(trx, ULINT_UNDEFINED);
59
/******************************************************************//**
60
Checks if the commit id should be logged to the sys header file
61
@return TRUE if the commit id should be logged */
64
trx_log_commit_id(const trx_t* trx)
67
return (trx->log_commit_id);
70
/****************************************************************//**
71
Retrieves the error_info field from a trx.
72
@return the error info */
77
const trx_t* trx) /*!< in: trx object */
79
return(trx->error_info);
82
/*******************************************************************//**
83
Retrieves transaction's que state in a human readable string. The string
84
should not be free()'d or modified.
85
@return string in the data segment */
88
trx_get_que_state_str(
89
/*==================*/
90
const trx_t* trx) /*!< in: transaction */
92
/* be sure to adjust TRX_QUE_STATE_STR_MAX_LEN if you change this */
93
switch (trx->que_state) {
96
case TRX_QUE_LOCK_WAIT:
98
case TRX_QUE_ROLLING_BACK:
99
return("ROLLING BACK");
100
case TRX_QUE_COMMITTING:
101
return("COMMITTING");
107
/**********************************************************************//**
108
Determine if a transaction is a dictionary operation.
109
@return dictionary operation mode */
112
trx_get_dict_operation(
113
/*===================*/
114
const trx_t* trx) /*!< in: transaction */
116
enum trx_dict_op op = (enum trx_dict_op) trx->dict_operation;
120
case TRX_DICT_OP_NONE:
121
case TRX_DICT_OP_TABLE:
122
case TRX_DICT_OP_INDEX:
126
#endif /* UNIV_DEBUG */
127
return((enum trx_dict_op) UNIV_EXPECT(op, TRX_DICT_OP_NONE));
129
/**********************************************************************//**
130
Flag a transaction a dictionary operation. */
133
trx_set_dict_operation(
134
/*===================*/
135
trx_t* trx, /*!< in/out: transaction */
136
enum trx_dict_op op) /*!< in: operation, not
140
enum trx_dict_op old_op = trx_get_dict_operation(trx);
143
case TRX_DICT_OP_NONE:
146
case TRX_DICT_OP_TABLE:
148
case TRX_DICT_OP_NONE:
149
case TRX_DICT_OP_INDEX:
150
case TRX_DICT_OP_TABLE:
155
case TRX_DICT_OP_INDEX:
156
ut_ad(old_op == TRX_DICT_OP_NONE);
160
#endif /* UNIV_DEBUG */
162
trx->dict_operation = op;