~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/innobase/trx/trx0trx.c

Tags: innodb-plugin-1.0.2
InnoDB Plugin 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
the kernel mutex */
35
35
UNIV_INTERN ulint       trx_n_mysql_transactions = 0;
36
36
 
 
37
/**************************************************************************
 
38
Determines if the currently running transaction is in innodb_strict_mode. */
 
39
UNIV_INTERN
 
40
ibool
 
41
trx_is_strict(
 
42
/*==========*/
 
43
                        /* out: TRUE if strict */
 
44
        trx_t*  trx)    /* in: transaction */
 
45
{
 
46
#ifndef UNIV_HOTBACKUP
 
47
        return(trx && trx->mysql_thd && thd_is_strict(trx->mysql_thd));
 
48
#else /* UNIV_HOTBACKUP */
 
49
        return(FALSE);
 
50
#endif /* UNIV_HOTBACKUP */
 
51
}
 
52
 
37
53
/*****************************************************************
38
54
Set detailed error message for the transaction. */
39
55
UNIV_INTERN
153
169
        trx->declared_to_be_inside_innodb = FALSE;
154
170
        trx->n_tickets_to_enter_innodb = 0;
155
171
 
156
 
        trx->auto_inc_lock = NULL;
157
 
 
158
172
        trx->global_read_view_heap = mem_heap_create(256);
159
173
        trx->global_read_view = NULL;
160
174
        trx->read_view = NULL;
165
179
 
166
180
        trx->n_autoinc_rows = 0;
167
181
 
 
182
        /* Remember to free the vector explicitly. */
 
183
        trx->autoinc_locks = ib_vector_create(
 
184
                mem_heap_create(sizeof(ib_vector_t) + sizeof(void*) * 4), 4);
 
185
 
168
186
        trx_reset_new_rec_lock_info(trx);
169
187
 
170
188
        return(trx);
264
282
                trx_print(stderr, trx, 600);
265
283
 
266
284
                ut_print_buf(stderr, trx, sizeof(trx_t));
 
285
                putc('\n', stderr);
267
286
        }
268
287
 
269
288
        ut_a(trx->magic_n == TRX_MAGIC_N);
288
307
        ut_a(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
289
308
 
290
309
        ut_a(!trx->has_search_latch);
291
 
        ut_a(!trx->auto_inc_lock);
292
310
 
293
311
        ut_a(trx->dict_operation_lock_mode == 0);
294
312
 
306
324
 
307
325
        ut_a(trx->read_view == NULL);
308
326
 
 
327
        ut_a(ib_vector_is_empty(trx->autoinc_locks));
 
328
        /* We allocated a dedicated heap for the vector. */
 
329
        ib_vector_free(trx->autoinc_locks);
 
330
 
309
331
        mem_free(trx);
310
332
}
311
333
 
805
827
        trx->conc_state = TRX_COMMITTED_IN_MEMORY;
806
828
        /*--------------------------------------*/
807
829
 
 
830
        /* If we release kernel_mutex below and we are still doing
 
831
        recovery i.e.: back ground rollback thread is still active
 
832
        then there is a chance that the rollback thread may see
 
833
        this trx as COMMITTED_IN_MEMORY and goes adhead to clean it
 
834
        up calling trx_cleanup_at_db_startup(). This can happen 
 
835
        in the case we are committing a trx here that is left in
 
836
        PREPARED state during the crash. Note that commit of the
 
837
        rollback of a PREPARED trx happens in the recovery thread
 
838
        while the rollback of other transactions happen in the
 
839
        background thread. To avoid this race we unconditionally
 
840
        unset the is_recovered flag from the trx. */
 
841
 
 
842
        trx->is_recovered = FALSE;
 
843
 
808
844
        lock_release_off_kernel(trx);
809
845
 
810
846
        if (trx->global_read_view) {