~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2009-04-14 19:16:51 UTC
  • mto: (997.2.5 mordred)
  • mto: This revision was merged to the branch mainline in revision 994.
  • Revision ID: mordred@inaugust.com-20090414191651-ltbww6hpqks8k7qk
Clarified instructions in README.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
*****************************************************************************/
18
18
 
19
 
/**************************************************//**
20
 
@file include/trx0trx.ic
 
19
/******************************************************
21
20
The transaction
22
21
 
23
22
Created 3/26/1996 Heikki Tuuri
24
23
*******************************************************/
25
24
 
26
 
/*************************************************************//**
 
25
/*****************************************************************
27
26
Starts the transaction if it is not yet started. */
28
27
UNIV_INLINE
29
28
void
30
29
trx_start_if_not_started(
31
30
/*=====================*/
32
 
        trx_t*  trx)    /*!< in: transaction */
 
31
        trx_t*  trx)    /* in: transaction */
33
32
{
34
33
        ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
35
34
 
39
38
        }
40
39
}
41
40
 
42
 
/*************************************************************//**
 
41
/*****************************************************************
43
42
Starts the transaction if it is not yet started. Assumes we have reserved
44
43
the kernel mutex! */
45
44
UNIV_INLINE
46
45
void
47
46
trx_start_if_not_started_low(
48
47
/*=========================*/
49
 
        trx_t*  trx)    /*!< in: transaction */
 
48
        trx_t*  trx)    /* in: transaction */
50
49
{
51
50
        ut_ad(trx->conc_state != TRX_COMMITTED_IN_MEMORY);
52
51
 
56
55
        }
57
56
}
58
57
 
59
 
/****************************************************************//**
60
 
Retrieves the error_info field from a trx.
61
 
@return the error info */
 
58
/*****************************************************************
 
59
Resets the new record lock info in a transaction struct. */
 
60
UNIV_INLINE
 
61
void
 
62
trx_reset_new_rec_lock_info(
 
63
/*========================*/
 
64
        trx_t*  trx)    /* in: transaction struct */
 
65
{
 
66
        trx->new_rec_locks[0] = NULL;
 
67
        trx->new_rec_locks[1] = NULL;
 
68
}
 
69
 
 
70
/*****************************************************************
 
71
Registers that we have set a new record lock on an index. We only have space
 
72
to store 2 indexes! If this is called to store more than 2 indexes after
 
73
trx_reset_new_rec_lock_info(), then this function does nothing. */
 
74
UNIV_INLINE
 
75
void
 
76
trx_register_new_rec_lock(
 
77
/*======================*/
 
78
        trx_t*          trx,    /* in: transaction struct */
 
79
        dict_index_t*   index)  /* in: trx sets a new record lock on this
 
80
                                index */
 
81
{
 
82
        if (trx->new_rec_locks[0] == NULL) {
 
83
                trx->new_rec_locks[0] = index;
 
84
 
 
85
                return;
 
86
        }
 
87
 
 
88
        if (trx->new_rec_locks[0] == index) {
 
89
 
 
90
                return;
 
91
        }
 
92
 
 
93
        if (trx->new_rec_locks[1] != NULL) {
 
94
 
 
95
                return;
 
96
        }
 
97
 
 
98
        trx->new_rec_locks[1] = index;
 
99
}
 
100
 
 
101
/*****************************************************************
 
102
Checks if trx has set a new record lock on an index. */
 
103
UNIV_INLINE
 
104
ibool
 
105
trx_new_rec_locks_contain(
 
106
/*======================*/
 
107
                                /* out: TRUE if trx has set a new record lock
 
108
                                on index */
 
109
        trx_t*          trx,    /* in: transaction struct */
 
110
        dict_index_t*   index)  /* in: index */
 
111
{
 
112
        return(trx->new_rec_locks[0] == index
 
113
               || trx->new_rec_locks[1] == index);
 
114
}
 
115
 
 
116
/********************************************************************
 
117
Retrieves the error_info field from a trx. */
62
118
UNIV_INLINE
63
119
const dict_index_t*
64
120
trx_get_error_info(
65
121
/*===============*/
66
 
        const trx_t*    trx)    /*!< in: trx object */
 
122
                                /* out: the error info */
 
123
        const trx_t*    trx)    /* in: trx object */
67
124
{
68
125
        return(trx->error_info);
69
126
}
70
127
 
71
 
/*******************************************************************//**
72
 
Retrieves transacion's id, represented as unsigned long long.
73
 
@return transaction's id */
 
128
/***********************************************************************
 
129
Retrieves transacion's id, represented as unsigned long long. */
74
130
UNIV_INLINE
75
131
ullint
76
132
trx_get_id(
77
133
/*=======*/
78
 
        const trx_t*    trx)    /*!< in: transaction */
 
134
                                /* out: transaction's id */
 
135
        const trx_t*    trx)    /* in: transaction */
79
136
{
80
137
        return((ullint)ut_conv_dulint_to_longlong(trx->id));
81
138
}
82
139
 
83
 
/*******************************************************************//**
 
140
/***********************************************************************
84
141
Retrieves transaction's que state in a human readable string. The string
85
 
should not be free()'d or modified.
86
 
@return string in the data segment */
 
142
should not be free()'d or modified. */
87
143
UNIV_INLINE
88
144
const char*
89
145
trx_get_que_state_str(
90
146
/*==================*/
91
 
        const trx_t*    trx)    /*!< in: transaction */
 
147
                                /* out: string in the data segment */
 
148
        const trx_t*    trx)    /* in: transaction */
92
149
{
93
150
        /* be sure to adjust TRX_QUE_STATE_STR_MAX_LEN if you change this */
94
151
        switch (trx->que_state) {
105
162
        }
106
163
}
107
164
 
108
 
/**********************************************************************//**
109
 
Determine if a transaction is a dictionary operation.
110
 
@return dictionary operation mode */
 
165
/**************************************************************************
 
166
Determine if a transaction is a dictionary operation. */
111
167
UNIV_INLINE
112
168
enum trx_dict_op
113
169
trx_get_dict_operation(
114
170
/*===================*/
115
 
        const trx_t*    trx)    /*!< in: transaction */
 
171
                                /* out: dictionary operation mode */
 
172
        const trx_t*    trx)    /* in: transaction */
116
173
{
117
174
        enum trx_dict_op op = (enum trx_dict_op) trx->dict_operation;
118
175
 
127
184
#endif /* UNIV_DEBUG */
128
185
        return((enum trx_dict_op) UNIV_EXPECT(op, TRX_DICT_OP_NONE));
129
186
}
130
 
/**********************************************************************//**
 
187
/**************************************************************************
131
188
Flag a transaction a dictionary operation. */
132
189
UNIV_INLINE
133
190
void
134
191
trx_set_dict_operation(
135
192
/*===================*/
136
 
        trx_t*                  trx,    /*!< in/out: transaction */
137
 
        enum trx_dict_op        op)     /*!< in: operation, not
 
193
        trx_t*                  trx,    /* in/out: transaction */
 
194
        enum trx_dict_op        op)     /* in: operation, not
138
195
                                        TRX_DICT_OP_NONE */
139
196
{
140
197
#ifdef UNIV_DEBUG