~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/trx0trx.ic

  • Committer: Monty Taylor
  • Date: 2010-04-22 02:46:23 UTC
  • mto: (1497.3.4 enable-dtrace)
  • mto: This revision was merged to the branch mainline in revision 1527.
  • Revision ID: mordred@inaugust.com-20100422024623-4urw8fi8eraci08p
Don't overwrite the pandora_vc_revinfo file if we don't have new
authoratative information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
4
 
 
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.
8
 
 
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.
12
 
 
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
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/trx0trx.ic
21
 
The transaction
22
 
 
23
 
Created 3/26/1996 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
/*************************************************************//**
27
 
Starts the transaction if it is not yet started. */
28
 
UNIV_INLINE
29
 
void
30
 
trx_start_if_not_started(
31
 
/*=====================*/
32
 
        trx_t*  trx)    /*!< in: transaction */
33
 
{
34
 
        ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
35
 
 
36
 
        if (trx->conc_state == TRX_NOT_STARTED) {
37
 
 
38
 
                trx_start(trx, ULINT_UNDEFINED);
39
 
        }
40
 
}
41
 
 
42
 
/*************************************************************//**
43
 
Starts the transaction if it is not yet started. Assumes we have reserved
44
 
the kernel mutex! */
45
 
UNIV_INLINE
46
 
void
47
 
trx_start_if_not_started_low(
48
 
/*=========================*/
49
 
        trx_t*  trx)    /*!< in: transaction */
50
 
{
51
 
        ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
52
 
 
53
 
        if (trx->conc_state == TRX_NOT_STARTED) {
54
 
 
55
 
                trx_start_low(trx, ULINT_UNDEFINED);
56
 
        }
57
 
}
58
 
 
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 */
62
 
UNIV_INLINE
63
 
ibool
64
 
trx_log_commit_id(const trx_t*  trx)
65
 
/*===============*/
66
 
{
67
 
        return (trx->log_commit_id);
68
 
}
69
 
 
70
 
/****************************************************************//**
71
 
Retrieves the error_info field from a trx.
72
 
@return the error info */
73
 
UNIV_INLINE
74
 
const dict_index_t*
75
 
trx_get_error_info(
76
 
/*===============*/
77
 
        const trx_t*    trx)    /*!< in: trx object */
78
 
{
79
 
        return(trx->error_info);
80
 
}
81
 
 
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 */
86
 
UNIV_INLINE
87
 
const char*
88
 
trx_get_que_state_str(
89
 
/*==================*/
90
 
        const trx_t*    trx)    /*!< in: transaction */
91
 
{
92
 
        /* be sure to adjust TRX_QUE_STATE_STR_MAX_LEN if you change this */
93
 
        switch (trx->que_state) {
94
 
        case TRX_QUE_RUNNING:
95
 
                return("RUNNING");
96
 
        case TRX_QUE_LOCK_WAIT:
97
 
                return("LOCK WAIT");
98
 
        case TRX_QUE_ROLLING_BACK:
99
 
                return("ROLLING BACK");
100
 
        case TRX_QUE_COMMITTING:
101
 
                return("COMMITTING");
102
 
        default:
103
 
                return("UNKNOWN");
104
 
        }
105
 
}
106
 
 
107
 
/**********************************************************************//**
108
 
Determine if a transaction is a dictionary operation.
109
 
@return dictionary operation mode */
110
 
UNIV_INLINE
111
 
enum trx_dict_op
112
 
trx_get_dict_operation(
113
 
/*===================*/
114
 
        const trx_t*    trx)    /*!< in: transaction */
115
 
{
116
 
        enum trx_dict_op op = (enum trx_dict_op) trx->dict_operation;
117
 
 
118
 
#ifdef UNIV_DEBUG
119
 
        switch (op) {
120
 
        case TRX_DICT_OP_NONE:
121
 
        case TRX_DICT_OP_TABLE:
122
 
        case TRX_DICT_OP_INDEX:
123
 
                return(op);
124
 
        }
125
 
        ut_error;
126
 
#endif /* UNIV_DEBUG */
127
 
        return((enum trx_dict_op) UNIV_EXPECT(op, TRX_DICT_OP_NONE));
128
 
}
129
 
/**********************************************************************//**
130
 
Flag a transaction a dictionary operation. */
131
 
UNIV_INLINE
132
 
void
133
 
trx_set_dict_operation(
134
 
/*===================*/
135
 
        trx_t*                  trx,    /*!< in/out: transaction */
136
 
        enum trx_dict_op        op)     /*!< in: operation, not
137
 
                                        TRX_DICT_OP_NONE */
138
 
{
139
 
#ifdef UNIV_DEBUG
140
 
        enum trx_dict_op        old_op = trx_get_dict_operation(trx);
141
 
 
142
 
        switch (op) {
143
 
        case TRX_DICT_OP_NONE:
144
 
                ut_error;
145
 
                break;
146
 
        case TRX_DICT_OP_TABLE:
147
 
                switch (old_op) {
148
 
                case TRX_DICT_OP_NONE:
149
 
                case TRX_DICT_OP_INDEX:
150
 
                case TRX_DICT_OP_TABLE:
151
 
                        goto ok;
152
 
                }
153
 
                ut_error;
154
 
                break;
155
 
        case TRX_DICT_OP_INDEX:
156
 
                ut_ad(old_op == TRX_DICT_OP_NONE);
157
 
                break;
158
 
        }
159
 
ok:
160
 
#endif /* UNIV_DEBUG */
161
 
 
162
 
        trx->dict_operation = op;
163
 
}