~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "dict0types.h"
20
20
#include "trx0xa.h"
21
21
 
22
 
/* Dummy session used currently in MySQL interface */
23
 
extern sess_t*  trx_dummy_sess;
24
 
 
25
 
/* Number of transactions currently allocated for MySQL: protected by
26
 
the kernel mutex */
27
22
extern ulint    trx_n_mysql_transactions;
28
23
 
29
24
/*****************************************************************
56
51
        dict_index_t*   index); /* in: index */
57
52
/************************************************************************
58
53
Releases the search latch if trx has reserved it. */
59
 
UNIV_INTERN
 
54
 
60
55
void
61
56
trx_search_latch_release_if_reserved(
62
57
/*=================================*/
63
58
        trx_t*     trx); /* in: transaction */
64
59
/**********************************************************************
65
60
Set detailed error message for the transaction. */
66
 
UNIV_INTERN
67
61
void
68
62
trx_set_detailed_error(
69
63
/*===================*/
72
66
/*****************************************************************
73
67
Set detailed error message for the transaction from a file. Note that the
74
68
file is rewinded before reading from it. */
75
 
UNIV_INTERN
 
69
 
76
70
void
77
71
trx_set_detailed_error_from_file(
78
72
/*=============================*/
80
74
        FILE*   file);  /* in: file to read message from */
81
75
/********************************************************************
82
76
Retrieves the error_info field from a trx. */
83
 
UNIV_INLINE
84
 
const dict_index_t*
 
77
 
 
78
void*
85
79
trx_get_error_info(
86
80
/*===============*/
87
 
                                /* out: the error info */
88
 
        const trx_t*    trx);   /* in: trx object */
 
81
                        /* out: the error info */
 
82
        trx_t*  trx);   /* in: trx object */
89
83
/********************************************************************
90
84
Creates and initializes a transaction object. */
91
 
UNIV_INTERN
 
85
 
92
86
trx_t*
93
87
trx_create(
94
88
/*=======*/
95
89
                        /* out, own: the transaction */
96
 
        sess_t* sess)   /* in: session */
97
 
        __attribute__((nonnull));
 
90
        sess_t* sess);  /* in: session or NULL */
98
91
/************************************************************************
99
92
Creates a transaction object for MySQL. */
100
 
UNIV_INTERN
 
93
 
101
94
trx_t*
102
95
trx_allocate_for_mysql(void);
103
96
/*========================*/
104
97
                                /* out, own: transaction object */
105
98
/************************************************************************
106
99
Creates a transaction object for background operations by the master thread. */
107
 
UNIV_INTERN
 
100
 
108
101
trx_t*
109
102
trx_allocate_for_background(void);
110
103
/*=============================*/
111
104
                                /* out, own: transaction object */
112
105
/************************************************************************
113
106
Frees a transaction object. */
114
 
UNIV_INTERN
 
107
 
115
108
void
116
109
trx_free(
117
110
/*=====*/
118
111
        trx_t*  trx);   /* in, own: trx object */
119
112
/************************************************************************
120
113
Frees a transaction object for MySQL. */
121
 
UNIV_INTERN
 
114
 
122
115
void
123
116
trx_free_for_mysql(
124
117
/*===============*/
125
118
        trx_t*  trx);   /* in, own: trx object */
126
119
/************************************************************************
127
120
Frees a transaction object of a background operation of the master thread. */
128
 
UNIV_INTERN
 
121
 
129
122
void
130
123
trx_free_for_background(
131
124
/*====================*/
136
129
already exist when this function is called, because the lists of
137
130
transactions to be rolled back or cleaned up are built based on the
138
131
undo log lists. */
139
 
UNIV_INTERN
 
132
 
140
133
void
141
134
trx_lists_init_at_db_start(void);
142
135
/*============================*/
143
136
/********************************************************************
144
137
Starts a new transaction. */
145
 
UNIV_INTERN
 
138
 
146
139
ibool
147
140
trx_start(
148
141
/*======*/
154
147
                        automatically in a round-robin fashion */
155
148
/********************************************************************
156
149
Starts a new transaction. */
157
 
UNIV_INTERN
 
150
 
158
151
ibool
159
152
trx_start_low(
160
153
/*==========*/
178
171
trx_start_if_not_started_low(
179
172
/*=========================*/
180
173
        trx_t*  trx);   /* in: transaction */
 
174
/*****************************************************************
 
175
Starts the transaction if it is not yet started. */
 
176
 
 
177
void
 
178
trx_start_if_not_started_noninline(
 
179
/*===============================*/
 
180
        trx_t*  trx);   /* in: transaction */
181
181
/********************************************************************
182
182
Commits a transaction. */
183
 
UNIV_INTERN
 
183
 
184
184
void
185
185
trx_commit_off_kernel(
186
186
/*==================*/
189
189
Cleans up a transaction at database startup. The cleanup is needed if
190
190
the transaction already got to the middle of a commit when the database
191
191
crashed, andf we cannot roll it back. */
192
 
UNIV_INTERN
 
192
 
193
193
void
194
194
trx_cleanup_at_db_startup(
195
195
/*======================*/
196
196
        trx_t*  trx);   /* in: transaction */
197
197
/**************************************************************************
198
198
Does the transaction commit for MySQL. */
199
 
UNIV_INTERN
 
199
 
200
200
ulint
201
201
trx_commit_for_mysql(
202
202
/*=================*/
203
 
                        /* out: DB_SUCCESS or error number */
 
203
                        /* out: 0 or error number */
204
204
        trx_t*  trx);   /* in: trx handle */
205
205
/**************************************************************************
206
206
Does the transaction prepare for MySQL. */
207
 
UNIV_INTERN
 
207
 
208
208
ulint
209
209
trx_prepare_for_mysql(
210
210
/*==================*/
213
213
/**************************************************************************
214
214
This function is used to find number of prepared transactions and
215
215
their transaction objects for a recovery. */
216
 
UNIV_INTERN
 
216
 
217
217
int
218
218
trx_recover_for_mysql(
219
219
/*==================*/
223
223
/***********************************************************************
224
224
This function is used to find one X/Open XA distributed transaction
225
225
which is in the prepared state */
226
 
UNIV_INTERN
227
226
trx_t *
228
227
trx_get_trx_by_xid(
229
228
/*===============*/
232
231
/**************************************************************************
233
232
If required, flushes the log to disk if we called trx_commit_for_mysql()
234
233
with trx->flush_log_later == TRUE. */
235
 
UNIV_INTERN
 
234
 
236
235
ulint
237
236
trx_commit_complete_for_mysql(
238
237
/*==========================*/
240
239
        trx_t*  trx);   /* in: trx handle */
241
240
/**************************************************************************
242
241
Marks the latest SQL statement ended. */
243
 
UNIV_INTERN
 
242
 
244
243
void
245
244
trx_mark_sql_stat_end(
246
245
/*==================*/
249
248
Assigns a read view for a consistent read query. All the consistent reads
250
249
within the same transaction will get the same read view, which is created
251
250
when this function is first called for a new started transaction. */
252
 
UNIV_INTERN
 
251
 
253
252
read_view_t*
254
253
trx_assign_read_view(
255
254
/*=================*/
259
258
The transaction must be in the TRX_QUE_LOCK_WAIT state. Puts it to
260
259
the TRX_QUE_RUNNING state and releases query threads which were
261
260
waiting for a lock in the wait_thrs list. */
262
 
UNIV_INTERN
 
261
 
263
262
void
264
263
trx_end_lock_wait(
265
264
/*==============*/
266
265
        trx_t*  trx);   /* in: transaction */
267
266
/********************************************************************
268
267
Sends a signal to a trx object. */
269
 
UNIV_INTERN
 
268
 
270
269
void
271
270
trx_sig_send(
272
271
/*=========*/
288
287
/********************************************************************
289
288
Send the reply message when a signal in the queue of the trx has
290
289
been handled. */
291
 
UNIV_INTERN
 
290
 
292
291
void
293
292
trx_sig_reply(
294
293
/*==========*/
300
299
                                        a new query thread */
301
300
/********************************************************************
302
301
Removes the signal object from a trx signal queue. */
303
 
UNIV_INTERN
 
302
 
304
303
void
305
304
trx_sig_remove(
306
305
/*===========*/
308
307
        trx_sig_t*      sig);   /* in, own: signal */
309
308
/********************************************************************
310
309
Starts handling of a trx signal. */
311
 
UNIV_INTERN
 
310
 
312
311
void
313
312
trx_sig_start_handle(
314
313
/*=================*/
323
322
trx->graph_before_signal_handling != NULL, returns control to the error
324
323
handling routine of the graph (currently only returns the control to the
325
324
graph root which then sends an error message to the client). */
326
 
UNIV_INTERN
 
325
 
327
326
void
328
327
trx_end_signal_handling(
329
328
/*====================*/
330
329
        trx_t*  trx);   /* in: trx */
331
330
/*************************************************************************
332
331
Creates a commit command node struct. */
333
 
UNIV_INTERN
 
332
 
334
333
commit_node_t*
335
334
commit_node_create(
336
335
/*===============*/
338
337
        mem_heap_t*     heap);  /* in: mem heap where created */
339
338
/***************************************************************
340
339
Performs an execution step for a commit type node in a query graph. */
341
 
UNIV_INTERN
 
340
 
342
341
que_thr_t*
343
342
trx_commit_step(
344
343
/*============*/
350
349
kernel mutex and must have called
351
350
innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
352
351
or InnoDB cannot meanwhile change the info printed here. */
353
 
UNIV_INTERN
 
352
 
354
353
void
355
354
trx_print(
356
355
/*======*/
359
358
        ulint   max_query_len); /* in: max query length to print, or 0 to
360
359
                                   use the default max length */
361
360
 
362
 
/** Type of data dictionary operation */
363
 
enum trx_dict_op {
364
 
        /** The transaction is not modifying the data dictionary. */
365
 
        TRX_DICT_OP_NONE = 0,
366
 
        /** The transaction is creating a table or an index, or
367
 
        dropping a table.  The table must be dropped in crash
368
 
        recovery.  This and TRX_DICT_OP_NONE are the only possible
369
 
        operation modes in crash recovery. */
370
 
        TRX_DICT_OP_TABLE = 1,
371
 
        /** The transaction is creating or dropping an index in an
372
 
        existing table.  In crash recovery, the the data dictionary
373
 
        must be locked, but the table must not be dropped. */
374
 
        TRX_DICT_OP_INDEX = 2
375
 
};
376
 
 
377
 
/**************************************************************************
378
 
Determine if a transaction is a dictionary operation. */
379
 
UNIV_INLINE
380
 
enum trx_dict_op
381
 
trx_get_dict_operation(
382
 
/*===================*/
383
 
                                /* out: dictionary operation mode */
384
 
        const trx_t*    trx)    /* in: transaction */
385
 
        __attribute__((pure));
386
 
/**************************************************************************
387
 
Flag a transaction a dictionary operation. */
388
 
UNIV_INLINE
389
 
void
390
 
trx_set_dict_operation(
391
 
/*===================*/
392
 
        trx_t*                  trx,    /* in/out: transaction */
393
 
        enum trx_dict_op        op);    /* in: operation, not
394
 
                                        TRX_DICT_OP_NONE */
395
 
 
396
361
#ifndef UNIV_HOTBACKUP
397
362
/**************************************************************************
398
363
Determines if the currently running transaction has been interrupted. */
399
 
UNIV_INTERN
 
364
 
400
365
ibool
401
366
trx_is_interrupted(
402
367
/*===============*/
407
372
#endif /* !UNIV_HOTBACKUP */
408
373
 
409
374
/***********************************************************************
410
 
Calculates the "weight" of a transaction. The weight of one transaction
411
 
is estimated as the number of altered rows + the number of locked rows.
412
 
*/
413
 
 
414
 
#define TRX_WEIGHT(t)   \
415
 
        ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
416
 
 
417
 
/***********************************************************************
418
 
Compares the "weight" (or size) of two transactions. Transactions that
419
 
have edited non-transactional tables are considered heavier than ones
420
 
that have not. */
421
 
UNIV_INTERN
 
375
Compares the "weight" (or size) of two transactions. The weight of one
 
376
transaction is estimated as the number of altered rows + the number of
 
377
locked rows. Transactions that have edited non-transactional tables are
 
378
considered heavier than ones that have not. */
 
379
 
422
380
int
423
381
trx_weight_cmp(
424
382
/*===========*/
425
 
                                /* out: <0, 0 or >0; similar to strcmp(3) */
426
 
        const trx_t*    a,      /* in: the first transaction to be compared */
427
 
        const trx_t*    b);     /* in: the second transaction to be compared */
428
 
 
429
 
/***********************************************************************
430
 
Retrieves transacion's id, represented as unsigned long long. */
431
 
UNIV_INLINE
432
 
ullint
433
 
trx_get_id(
434
 
/*=======*/
435
 
                                /* out: transaction's id */
436
 
        const trx_t*    trx);   /* in: transaction */
437
 
 
438
 
/* Maximum length of a string that can be returned by
439
 
trx_get_que_state_str(). */
440
 
#define TRX_QUE_STATE_STR_MAX_LEN       12 /* "ROLLING BACK" */
441
 
 
442
 
/***********************************************************************
443
 
Retrieves transaction's que state in a human readable string. The string
444
 
should not be free()'d or modified. */
445
 
UNIV_INLINE
446
 
const char*
447
 
trx_get_que_state_str(
448
 
/*==================*/
449
 
                                /* out: string in the data segment */
450
 
        const trx_t*    trx);   /* in: transaction */
 
383
                        /* out: <0, 0 or >0; similar to strcmp(3) */
 
384
        trx_t*  a,      /* in: the first transaction to be compared */
 
385
        trx_t*  b);     /* in: the second transaction to be compared */
451
386
 
452
387
/* Signal to a transaction */
453
388
struct trx_sig_struct{
454
 
        unsigned        type:3;         /* signal type */
455
 
        unsigned        sender:1;       /* TRX_SIG_SELF or
 
389
        ulint           type;           /* signal type */
 
390
        ulint           sender;         /* TRX_SIG_SELF or
456
391
                                        TRX_SIG_OTHER_SESS */
457
392
        que_thr_t*      receiver;       /* non-NULL if the sender of the signal
458
393
                                        wants reply after the operation induced
480
415
                                        current operation, or an empty
481
416
                                        string */
482
417
        unsigned        is_purge:1;     /* 0=user transaction, 1=purge */
483
 
        unsigned        is_recovered:1; /* 0=normal transaction,
484
 
                                        1=recovered, must be rolled back */
485
 
        unsigned        conc_state:2;   /* state of the trx from the point
 
418
        ulint           conc_state;     /* state of the trx from the point
486
419
                                        of view of concurrency control:
487
420
                                        TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
488
421
                                        ... */
489
 
        unsigned        que_state:2;    /* valid when conc_state == TRX_ACTIVE:
490
 
                                        TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
491
 
                                        ... */
492
 
        unsigned        isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
493
 
        unsigned        check_foreigns:1;/* normally TRUE, but if the user
 
422
        time_t          start_time;     /* time the trx object was created
 
423
                                        or the state last time became
 
424
                                        TRX_ACTIVE */
 
425
        ulint           isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
 
426
        ibool           check_foreigns; /* normally TRUE, but if the user
494
427
                                        wants to suppress foreign key checks,
495
428
                                        (in table imports, for example) we
496
429
                                        set this FALSE */
497
 
        unsigned        check_unique_secondary:1;
 
430
        ibool           check_unique_secondary;
498
431
                                        /* normally TRUE, but if the user
499
432
                                        wants to speed up inserts by
500
433
                                        suppressing unique key checks
501
434
                                        for secondary indexes when we decide
502
435
                                        if we can use the insert buffer for
503
436
                                        them, we set this FALSE */
504
 
        unsigned        support_xa:1;   /* normally we do the XA two-phase
 
437
        dulint          id;             /* transaction id */
 
438
        XID             xid;            /* X/Open XA transaction
 
439
                                        identification to identify a
 
440
                                        transaction branch */
 
441
        ibool           support_xa;     /* normally we do the XA two-phase
505
442
                                        commit steps, but by setting this to
506
443
                                        FALSE, one can save CPU time and about
507
444
                                        150 bytes in the undo log size as then
508
445
                                        we skip XA steps */
509
 
        unsigned        flush_log_later:1;/* when we commit the transaction
 
446
        dulint          no;             /* transaction serialization number ==
 
447
                                        max trx id when the transaction is
 
448
                                        moved to COMMITTED_IN_MEMORY state */
 
449
        ibool           flush_log_later;/* when we commit the transaction
510
450
                                        in MySQL's binlog write, we will
511
451
                                        flush the log to disk later in
512
452
                                        a separate call */
513
 
        unsigned        must_flush_log_later:1;/* this flag is set to TRUE in
 
453
        ibool           must_flush_log_later;/* this flag is set to TRUE in
514
454
                                        trx_commit_off_kernel() if
515
455
                                        flush_log_later was TRUE, and there
516
456
                                        were modifications by the transaction;
517
457
                                        in that case we must flush the log
518
458
                                        in trx_commit_complete_for_mysql() */
519
 
        unsigned        dict_operation:2;/**< @see enum trx_dict_op */
 
459
        dulint          commit_lsn;     /* lsn at the time of the commit */
 
460
        ibool           dict_operation; /* TRUE if the trx is used to create
 
461
                                        a table, create an index, or drop a
 
462
                                        table.  This is a hint that the table
 
463
                                        may need to be dropped in crash
 
464
                                        recovery. */
 
465
        dulint          table_id;       /* table id if the preceding field is
 
466
                                        TRUE */
 
467
        /*------------------------------*/
520
468
        unsigned        duplicates:2;   /* TRX_DUP_IGNORE | TRX_DUP_REPLACE */
521
469
        unsigned        active_trans:2; /* 1 - if a transaction in MySQL
522
470
                                        is active. 2 - if prepare_commit_mutex
523
471
                                        was taken */
524
 
        unsigned        has_search_latch:1;
525
 
                                        /* TRUE if this trx has latched the
526
 
                                        search system latch in S-mode */
527
 
        unsigned        declared_to_be_inside_innodb:1;
528
 
                                        /* this is TRUE if we have declared
529
 
                                        this transaction in
530
 
                                        srv_conc_enter_innodb to be inside the
531
 
                                        InnoDB engine */
532
 
        unsigned        handling_signals:1;/* this is TRUE as long as the trx
533
 
                                        is handling signals */
534
 
        unsigned        dict_operation_lock_mode:2;
535
 
                                        /* 0, RW_S_LATCH, or RW_X_LATCH:
536
 
                                        the latch mode trx currently holds
537
 
                                        on dict_operation_lock */
538
 
        time_t          start_time;     /* time the trx object was created
539
 
                                        or the state last time became
540
 
                                        TRX_ACTIVE */
541
 
        dulint          id;             /* transaction id */
542
 
        XID             xid;            /* X/Open XA transaction
543
 
                                        identification to identify a
544
 
                                        transaction branch */
545
 
        dulint          no;             /* transaction serialization number ==
546
 
                                        max trx id when the transaction is
547
 
                                        moved to COMMITTED_IN_MEMORY state */
548
 
        ib_uint64_t     commit_lsn;     /* lsn at the time of the commit */
549
 
        dulint          table_id;       /* Table to drop iff dict_operation
550
 
                                        is TRUE, or ut_dulint_zero. */
551
 
        /*------------------------------*/
552
472
        void*           mysql_thd;      /* MySQL thread handle corresponding
553
473
                                        to this trx, or NULL */
554
474
        char**          mysql_query_str;/* pointer to the field in mysqld_thd
559
479
                                        contains a pointer to the latest file
560
480
                                        name; this is NULL if binlog is not
561
481
                                        used */
562
 
        ib_int64_t      mysql_log_offset;/* if MySQL binlog is used, this field
 
482
        ib_longlong     mysql_log_offset;/* if MySQL binlog is used, this field
563
483
                                        contains the end offset of the binlog
564
484
                                        entry */
565
485
        os_thread_id_t  mysql_thread_id;/* id of the MySQL thread associated
575
495
                                        /* how many tables the current SQL
576
496
                                        statement uses, except those
577
497
                                        in consistent read */
 
498
        ibool           dict_operation_lock_mode;
 
499
                                        /* 0, RW_S_LATCH, or RW_X_LATCH:
 
500
                                        the latch mode trx currently holds
 
501
                                        on dict_operation_lock */
 
502
        ibool           has_search_latch;
 
503
                                        /* TRUE if this trx has latched the
 
504
                                        search system latch in S-mode */
578
505
        ulint           search_latch_timeout;
579
506
                                        /* If we notice that someone is
580
507
                                        waiting for our S-lock on the search
586
513
                                        to reduce contention on the search
587
514
                                        latch */
588
515
        /*------------------------------*/
 
516
        ibool           declared_to_be_inside_innodb;
 
517
                                        /* this is TRUE if we have declared
 
518
                                        this transaction in
 
519
                                        srv_conc_enter_innodb to be inside the
 
520
                                        InnoDB engine */
589
521
        ulint           n_tickets_to_enter_innodb;
590
522
                                        /* this can be > 0 only when
591
523
                                        declared_to_... is TRUE; when we come
620
552
                                        doing the transaction is allowed to
621
553
                                        set this field: this is NOT protected
622
554
                                        by the kernel mutex */
623
 
        const dict_index_t*error_info;  /* if the error number indicates a
 
555
        void*           error_info;     /* if the error number indicates a
624
556
                                        duplicate key error, a pointer to
625
557
                                        the problematic index is stored here */
626
 
        ulint           error_key_num;  /* if the index creation fails to a
627
 
                                        duplicate key error, a mysql key
628
 
                                        number of that index is stored here */
629
558
        sess_t*         sess;           /* session of the trx, NULL if none */
 
559
        ulint           que_state;      /* TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
 
560
                                        ... */
630
561
        que_t*          graph;          /* query currently run in the session,
631
562
                                        or NULL if none; NOTE that the query
632
563
                                        belongs to the session, and it can
634
565
                                        it is a stored procedure with a COMMIT
635
566
                                        WORK statement, for instance */
636
567
        ulint           n_active_thrs;  /* number of active query threads */
 
568
        ibool           handling_signals;/* this is TRUE as long as the trx
 
569
                                        is handling signals */
637
570
        que_t*          graph_before_signal_handling;
638
571
                                        /* value of graph when signal handling
639
572
                                        for this trx started: this is used to
667
600
                                        trx that are in the QUE_THR_LOCK_WAIT
668
601
                                        state */
669
602
        ulint           deadlock_mark;  /* a mark field used in deadlock
670
 
                                        checking algorithm.  This must be
671
 
                                        in its own machine word, because
672
 
                                        it can be changed by other
673
 
                                        threads while holding kernel_mutex. */
 
603
                                        checking algorithm */
674
604
        /*------------------------------*/
675
605
        mem_heap_t*     lock_heap;      /* memory heap for the locks of the
676
606
                                        transaction */
740
670
                                        transaction, e.g., a parallel
741
671
                                        query */
742
672
/* Transaction concurrency states (trx->conc_state) */
743
 
#define TRX_NOT_STARTED         0
744
 
#define TRX_ACTIVE              1
745
 
#define TRX_COMMITTED_IN_MEMORY 2
746
 
#define TRX_PREPARED            3       /* Support for 2PC/XA */
 
673
#define TRX_NOT_STARTED         1
 
674
#define TRX_ACTIVE              2
 
675
#define TRX_COMMITTED_IN_MEMORY 3
 
676
#define TRX_PREPARED            4       /* Support for 2PC/XA */
747
677
 
748
678
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
749
 
#define TRX_QUE_RUNNING         0       /* transaction is running */
750
 
#define TRX_QUE_LOCK_WAIT       1       /* transaction is waiting for a lock */
751
 
#define TRX_QUE_ROLLING_BACK    2       /* transaction is rolling back */
752
 
#define TRX_QUE_COMMITTING      3       /* transaction is committing */
 
679
#define TRX_QUE_RUNNING         1       /* transaction is running */
 
680
#define TRX_QUE_LOCK_WAIT       2       /* transaction is waiting for a lock */
 
681
#define TRX_QUE_ROLLING_BACK    3       /* transaction is rolling back */
 
682
#define TRX_QUE_COMMITTING      4       /* transaction is committing */
753
683
 
754
684
/* Transaction isolation levels (trx->isolation_level) */
755
 
#define TRX_ISO_READ_UNCOMMITTED        0       /* dirty read: non-locking
 
685
#define TRX_ISO_READ_UNCOMMITTED        1       /* dirty read: non-locking
756
686
                                                SELECTs are performed so that
757
687
                                                we do not look at a possible
758
688
                                                earlier version of a record;
761
691
                                                level; otherwise like level
762
692
                                                2 */
763
693
 
764
 
#define TRX_ISO_READ_COMMITTED          1       /* somewhat Oracle-like
 
694
#define TRX_ISO_READ_COMMITTED          2       /* somewhat Oracle-like
765
695
                                                isolation, except that in
766
696
                                                range UPDATE and DELETE we
767
697
                                                must block phantom rows
774
704
                                                each consistent read reads its
775
705
                                                own snapshot */
776
706
 
777
 
#define TRX_ISO_REPEATABLE_READ         2       /* this is the default;
 
707
#define TRX_ISO_REPEATABLE_READ         3       /* this is the default;
778
708
                                                all consistent reads in the
779
709
                                                same trx read the same
780
710
                                                snapshot;
782
712
                                                in locking reads to block
783
713
                                                insertions into gaps */
784
714
 
785
 
#define TRX_ISO_SERIALIZABLE            3       /* all plain SELECTs are
 
715
#define TRX_ISO_SERIALIZABLE            4       /* all plain SELECTs are
786
716
                                                converted to LOCK IN SHARE
787
717
                                                MODE reads */
788
718
 
793
723
 
794
724
 
795
725
/* Types of a trx signal */
796
 
#define TRX_SIG_NO_SIGNAL               0
 
726
#define TRX_SIG_NO_SIGNAL               100
797
727
#define TRX_SIG_TOTAL_ROLLBACK          1
798
728
#define TRX_SIG_ROLLBACK_TO_SAVEPT      2
799
729
#define TRX_SIG_COMMIT                  3
801
731
#define TRX_SIG_BREAK_EXECUTION         5
802
732
 
803
733
/* Sender types of a signal */
804
 
#define TRX_SIG_SELF            0       /* sent by the session itself, or
 
734
#define TRX_SIG_SELF            1       /* sent by the session itself, or
805
735
                                        by an error occurring within this
806
736
                                        session */
807
 
#define TRX_SIG_OTHER_SESS      1       /* sent by another session (which
 
737
#define TRX_SIG_OTHER_SESS      2       /* sent by another session (which
808
738
                                        must hold rights to this) */
809
739
 
810
740
/* Commit command node in a query graph */