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., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
17
*****************************************************************************/
19
/**************************************************//**
20
@file include/trx0trx.h
23
Created 3/26/1996 Heikki Tuuri
24
*******************************************************/
30
#include "trx0types.h"
31
#include "dict0types.h"
32
#ifndef UNIV_HOTBACKUP
33
#include "lock0types.h"
34
#include "usr0types.h"
35
#include "que0types.h"
37
#include "read0types.h"
41
/** Dummy session used currently in MySQL interface */
42
extern sess_t* trx_dummy_sess;
44
/** Number of transactions currently allocated for MySQL: protected by
46
extern ulint trx_n_mysql_transactions;
48
/********************************************************************//**
49
Releases the search latch if trx has reserved it. */
52
trx_search_latch_release_if_reserved(
53
/*=================================*/
54
trx_t* trx); /*!< in: transaction */
55
/******************************************************************//**
56
Set detailed error message for the transaction. */
59
trx_set_detailed_error(
60
/*===================*/
61
trx_t* trx, /*!< in: transaction struct */
62
const char* msg); /*!< in: detailed error message */
63
/*************************************************************//**
64
Set detailed error message for the transaction from a file. Note that the
65
file is rewinded before reading from it. */
68
trx_set_detailed_error_from_file(
69
/*=============================*/
70
trx_t* trx, /*!< in: transaction struct */
71
FILE* file); /*!< in: file to read message from */
72
/****************************************************************//**
73
Retrieves the error_info field from a trx.
74
@return the error info */
79
const trx_t* trx); /*!< in: trx object */
80
/****************************************************************//**
81
Creates and initializes a transaction object.
82
@return own: the transaction */
87
sess_t* sess) /*!< in: session */
88
__attribute__((nonnull));
89
/********************************************************************//**
90
Creates a transaction object for MySQL.
91
@return own: transaction object */
94
trx_allocate_for_mysql(void);
95
/*========================*/
96
/********************************************************************//**
97
Creates a transaction object for background operations by the master thread.
98
@return own: transaction object */
101
trx_allocate_for_background(void);
102
/*=============================*/
103
/********************************************************************//**
104
Frees a transaction object. */
109
trx_t* trx); /*!< in, own: trx object */
110
/********************************************************************//**
111
Frees a transaction object for MySQL. */
116
trx_t* trx); /*!< in, own: trx object */
117
/********************************************************************//**
118
Frees a transaction object of a background operation of the master thread. */
121
trx_free_for_background(
122
/*====================*/
123
trx_t* trx); /*!< in, own: trx object */
124
/****************************************************************//**
125
Creates trx objects for transactions and initializes the trx list of
126
trx_sys at database start. Rollback segment and undo log lists must
127
already exist when this function is called, because the lists of
128
transactions to be rolled back or cleaned up are built based on the
132
trx_lists_init_at_db_start(void);
133
/*============================*/
134
/****************************************************************//**
135
Starts a new transaction.
136
@return TRUE if success, FALSE if the rollback segment could not
137
support this many transactions */
142
trx_t* trx, /*!< in: transaction */
143
ulint rseg_id);/*!< in: rollback segment id; if ULINT_UNDEFINED
144
is passed, the system chooses the rollback segment
145
automatically in a round-robin fashion */
146
/****************************************************************//**
147
Starts a new transaction.
153
trx_t* trx, /*!< in: transaction */
154
ulint rseg_id);/*!< in: rollback segment id; if ULINT_UNDEFINED
155
is passed, the system chooses the rollback segment
156
automatically in a round-robin fashion */
157
/*************************************************************//**
158
Starts the transaction if it is not yet started. */
161
trx_start_if_not_started(
162
/*=====================*/
163
trx_t* trx); /*!< in: transaction */
164
/*************************************************************//**
165
Starts the transaction if it is not yet started. Assumes we have reserved
169
trx_start_if_not_started_low(
170
/*=========================*/
171
trx_t* trx); /*!< in: transaction */
172
/****************************************************************//**
173
Commits a transaction. */
176
trx_commit_off_kernel(
177
/*==================*/
178
trx_t* trx); /*!< in: transaction */
179
/****************************************************************//**
180
Cleans up a transaction at database startup. The cleanup is needed if
181
the transaction already got to the middle of a commit when the database
182
crashed, andf we cannot roll it back. */
185
trx_cleanup_at_db_startup(
186
/*======================*/
187
trx_t* trx); /*!< in: transaction */
188
/**********************************************************************//**
189
Does the transaction commit for MySQL.
190
@return DB_SUCCESS or error number */
193
trx_commit_for_mysql(
194
/*=================*/
195
trx_t* trx); /*!< in: trx handle */
196
/**********************************************************************//**
197
Does the transaction prepare for MySQL.
198
@return 0 or error number */
201
trx_prepare_for_mysql(
202
/*==================*/
203
trx_t* trx); /*!< in: trx handle */
204
/**********************************************************************//**
205
This function is used to find number of prepared transactions and
206
their transaction objects for a recovery.
207
@return number of prepared transactions */
210
trx_recover_for_mysql(
211
/*==================*/
212
XID* xid_list, /*!< in/out: prepared transactions */
213
ulint len); /*!< in: number of slots in xid_list */
214
/*******************************************************************//**
215
This function is used to find one X/Open XA distributed transaction
216
which is in the prepared state
217
@return trx or NULL */
222
XID* xid); /*!< in: X/Open XA transaction identification */
223
/**********************************************************************//**
224
If required, flushes the log to disk if we called trx_commit_for_mysql()
225
with trx->flush_log_later == TRUE.
226
@return 0 or error number */
229
trx_commit_complete_for_mysql(
230
/*==========================*/
231
trx_t* trx); /*!< in: trx handle */
232
/**********************************************************************//**
233
Marks the latest SQL statement ended. */
236
trx_mark_sql_stat_end(
237
/*==================*/
238
trx_t* trx); /*!< in: trx handle */
239
/********************************************************************//**
240
Assigns a read view for a consistent read query. All the consistent reads
241
within the same transaction will get the same read view, which is created
242
when this function is first called for a new started transaction.
243
@return consistent read view */
246
trx_assign_read_view(
247
/*=================*/
248
trx_t* trx); /*!< in: active transaction */
249
/***********************************************************//**
250
The transaction must be in the TRX_QUE_LOCK_WAIT state. Puts it to
251
the TRX_QUE_RUNNING state and releases query threads which were
252
waiting for a lock in the wait_thrs list. */
257
trx_t* trx); /*!< in: transaction */
258
/****************************************************************//**
259
Sends a signal to a trx object. */
264
trx_t* trx, /*!< in: trx handle */
265
ulint type, /*!< in: signal type */
266
ulint sender, /*!< in: TRX_SIG_SELF or
267
TRX_SIG_OTHER_SESS */
268
que_thr_t* receiver_thr, /*!< in: query thread which wants the
269
reply, or NULL; if type is
270
TRX_SIG_END_WAIT, this must be NULL */
271
trx_savept_t* savept, /*!< in: possible rollback savepoint, or
273
que_thr_t** next_thr); /*!< in/out: next query thread to run;
274
if the value which is passed in is
275
a pointer to a NULL pointer, then the
276
calling function can start running
277
a new query thread; if the parameter
278
is NULL, it is ignored */
279
/****************************************************************//**
280
Send the reply message when a signal in the queue of the trx has
286
trx_sig_t* sig, /*!< in: signal */
287
que_thr_t** next_thr); /*!< in/out: next query thread to run;
288
if the value which is passed in is
289
a pointer to a NULL pointer, then the
290
calling function can start running
291
a new query thread */
292
/****************************************************************//**
293
Removes the signal object from a trx signal queue. */
298
trx_t* trx, /*!< in: trx handle */
299
trx_sig_t* sig); /*!< in, own: signal */
300
/****************************************************************//**
301
Starts handling of a trx signal. */
304
trx_sig_start_handle(
305
/*=================*/
306
trx_t* trx, /*!< in: trx handle */
307
que_thr_t** next_thr); /*!< in/out: next query thread to run;
308
if the value which is passed in is
309
a pointer to a NULL pointer, then the
310
calling function can start running
311
a new query thread */
312
/****************************************************************//**
313
Ends signal handling. If the session is in the error state, and
314
trx->graph_before_signal_handling != NULL, returns control to the error
315
handling routine of the graph (currently only returns the control to the
316
graph root which then sends an error message to the client). */
319
trx_end_signal_handling(
320
/*====================*/
321
trx_t* trx); /*!< in: trx */
322
/*********************************************************************//**
323
Creates a commit command node struct.
324
@return own: commit node struct */
329
mem_heap_t* heap); /*!< in: mem heap where created */
330
/***********************************************************//**
331
Performs an execution step for a commit type node in a query graph.
332
@return query thread to run next, or NULL */
337
que_thr_t* thr); /*!< in: query thread */
339
/**********************************************************************//**
340
Prints info about a transaction to the given file. The caller must own the
341
kernel mutex and must have called
342
innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
343
or InnoDB cannot meanwhile change the info printed here. */
348
FILE* f, /*!< in: output stream */
349
trx_t* trx, /*!< in: transaction */
350
ulint max_query_len); /*!< in: max query length to print, or 0 to
351
use the default max length */
353
/** Type of data dictionary operation */
355
/** The transaction is not modifying the data dictionary. */
356
TRX_DICT_OP_NONE = 0,
357
/** The transaction is creating a table or an index, or
358
dropping a table. The table must be dropped in crash
359
recovery. This and TRX_DICT_OP_NONE are the only possible
360
operation modes in crash recovery. */
361
TRX_DICT_OP_TABLE = 1,
362
/** The transaction is creating or dropping an index in an
363
existing table. In crash recovery, the the data dictionary
364
must be locked, but the table must not be dropped. */
365
TRX_DICT_OP_INDEX = 2
368
/**********************************************************************//**
369
Determine if a transaction is a dictionary operation.
370
@return dictionary operation mode */
373
trx_get_dict_operation(
374
/*===================*/
375
const trx_t* trx) /*!< in: transaction */
376
__attribute__((pure));
377
/**********************************************************************//**
378
Flag a transaction a dictionary operation. */
381
trx_set_dict_operation(
382
/*===================*/
383
trx_t* trx, /*!< in/out: transaction */
384
enum trx_dict_op op); /*!< in: operation, not
387
#ifndef UNIV_HOTBACKUP
388
/**********************************************************************//**
389
Determines if the currently running transaction has been interrupted.
390
@return TRUE if interrupted */
395
trx_t* trx); /*!< in: transaction */
396
#else /* !UNIV_HOTBACKUP */
397
#define trx_is_interrupted(trx) FALSE
398
#endif /* !UNIV_HOTBACKUP */
400
/*******************************************************************//**
401
Calculates the "weight" of a transaction. The weight of one transaction
402
is estimated as the number of altered rows + the number of locked rows.
404
@return transaction weight */
405
#define TRX_WEIGHT(t) \
406
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
408
/*******************************************************************//**
409
Compares the "weight" (or size) of two transactions. Transactions that
410
have edited non-transactional tables are considered heavier than ones
412
@return <0, 0 or >0; similar to strcmp(3) */
417
const trx_t* a, /*!< in: the first transaction to be compared */
418
const trx_t* b); /*!< in: the second transaction to be compared */
420
/*******************************************************************//**
421
Retrieves transacion's id, represented as unsigned long long.
422
@return transaction's id */
427
const trx_t* trx); /*!< in: transaction */
429
/* Maximum length of a string that can be returned by
430
trx_get_que_state_str(). */
431
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
433
/*******************************************************************//**
434
Retrieves transaction's que state in a human readable string. The string
435
should not be free()'d or modified.
436
@return string in the data segment */
439
trx_get_que_state_str(
440
/*==================*/
441
const trx_t* trx); /*!< in: transaction */
443
/* Signal to a transaction */
444
struct trx_sig_struct{
445
unsigned type:3; /*!< signal type */
446
unsigned sender:1; /*!< TRX_SIG_SELF or
447
TRX_SIG_OTHER_SESS */
448
que_thr_t* receiver; /*!< non-NULL if the sender of the signal
449
wants reply after the operation induced
450
by the signal is completed */
451
trx_savept_t savept; /*!< possible rollback savepoint */
452
UT_LIST_NODE_T(trx_sig_t)
453
signals; /*!< queue of pending signals to the
455
UT_LIST_NODE_T(trx_sig_t)
456
reply_signals; /*!< list of signals for which the sender
457
transaction is waiting a reply */
460
#define TRX_MAGIC_N 91118598
462
/* The transaction handle; every session has a trx object which is freed only
463
when the session is freed; in addition there may be session-less transactions
464
rolling back after a database recovery */
468
/* All the next fields are protected by the kernel mutex, except the
469
undo logs which are protected by undo_mutex */
470
const char* op_info; /*!< English text describing the
471
current operation, or an empty
473
unsigned is_purge:1; /*!< 0=user transaction, 1=purge */
474
unsigned is_recovered:1; /*!< 0=normal transaction,
475
1=recovered, must be rolled back */
476
unsigned conc_state:2; /*!< state of the trx from the point
477
of view of concurrency control:
478
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
480
unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE:
481
TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
483
unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
484
unsigned check_foreigns:1;/* normally TRUE, but if the user
485
wants to suppress foreign key checks,
486
(in table imports, for example) we
488
unsigned check_unique_secondary:1;
489
/* normally TRUE, but if the user
490
wants to speed up inserts by
491
suppressing unique key checks
492
for secondary indexes when we decide
493
if we can use the insert buffer for
494
them, we set this FALSE */
495
unsigned support_xa:1; /*!< normally we do the XA two-phase
496
commit steps, but by setting this to
497
FALSE, one can save CPU time and about
498
150 bytes in the undo log size as then
500
unsigned flush_log_later:1;/* In 2PC, we hold the
501
prepare_commit mutex across
502
both phases. In that case, we
503
defer flush of the logs to disk
504
until after we release the
506
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
507
trx_commit_off_kernel() if
508
flush_log_later was TRUE, and there
509
were modifications by the transaction;
510
in that case we must flush the log
511
in trx_commit_complete_for_mysql() */
512
unsigned dict_operation:2;/**< @see enum trx_dict_op */
513
unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
514
unsigned has_search_latch:1;
515
/* TRUE if this trx has latched the
516
search system latch in S-mode */
517
unsigned declared_to_be_inside_innodb:1;
518
/* this is TRUE if we have declared
520
srv_conc_enter_innodb to be inside the
522
unsigned handling_signals:1;/* this is TRUE as long as the trx
523
is handling signals */
524
unsigned dict_operation_lock_mode:2;
525
/* 0, RW_S_LATCH, or RW_X_LATCH:
526
the latch mode trx currently holds
527
on dict_operation_lock */
528
time_t start_time; /*!< time the trx object was created
529
or the state last time became
531
trx_id_t id; /*!< transaction id */
532
XID xid; /*!< X/Open XA transaction
533
identification to identify a
534
transaction branch */
535
trx_id_t no; /*!< transaction serialization number ==
536
max trx id when the transaction is
537
moved to COMMITTED_IN_MEMORY state */
538
ib_uint64_t commit_lsn; /*!< lsn at the time of the commit */
539
trx_id_t table_id; /*!< Table to drop iff dict_operation
540
is TRUE, or ut_dulint_zero. */
541
/*------------------------------*/
542
void* mysql_thd; /*!< MySQL thread handle corresponding
543
to this trx, or NULL */
544
const char* mysql_query_str;/* pointer to the field in mysqld_thd
545
which contains the pointer to the
546
current SQL query string */
547
const char* mysql_log_file_name;
548
/* if MySQL binlog is used, this field
549
contains a pointer to the latest file
550
name; this is NULL if binlog is not
552
ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
553
contains the end offset of the binlog
555
os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
556
with this transaction object */
557
ulint mysql_process_no;/* since in Linux, 'top' reports
558
process id's and not thread id's, we
559
store the process number too */
560
ulint mysql_n_tables_locked;
561
/* how many tables the current SQL
562
statement uses, except those
563
in consistent read */
564
ulint search_latch_timeout;
565
/* If we notice that someone is
566
waiting for our S-lock on the search
567
latch to be released, we wait in
568
row0sel.c for BTR_SEA_TIMEOUT new
569
searches until we try to keep
570
the search latch again over
571
calls from MySQL; this is intended
572
to reduce contention on the search
574
/*------------------------------*/
575
ulint n_tickets_to_enter_innodb;
576
/* this can be > 0 only when
577
declared_to_... is TRUE; when we come
578
to srv_conc_innodb_enter, if the value
579
here is > 0, we decrement this by 1 */
580
/*------------------------------*/
581
UT_LIST_NODE_T(trx_t)
582
trx_list; /*!< list of transactions */
583
UT_LIST_NODE_T(trx_t)
584
mysql_trx_list; /*!< list of transactions created for
586
/*------------------------------*/
587
ulint error_state; /*!< 0 if no error, otherwise error
588
number; NOTE That ONLY the thread
589
doing the transaction is allowed to
590
set this field: this is NOT protected
591
by the kernel mutex */
592
const dict_index_t*error_info; /*!< if the error number indicates a
593
duplicate key error, a pointer to
594
the problematic index is stored here */
595
ulint error_key_num; /*!< if the index creation fails to a
596
duplicate key error, a mysql key
597
number of that index is stored here */
598
sess_t* sess; /*!< session of the trx, NULL if none */
599
que_t* graph; /*!< query currently run in the session,
600
or NULL if none; NOTE that the query
601
belongs to the session, and it can
602
survive over a transaction commit, if
603
it is a stored procedure with a COMMIT
604
WORK statement, for instance */
605
ulint n_active_thrs; /*!< number of active query threads */
606
que_t* graph_before_signal_handling;
607
/* value of graph when signal handling
608
for this trx started: this is used to
609
return control to the original query
610
graph for error processing */
611
trx_sig_t sig; /*!< one signal object can be allocated
612
in this space, avoiding mem_alloc */
613
UT_LIST_BASE_NODE_T(trx_sig_t)
614
signals; /*!< queue of processed or pending
615
signals to the trx */
616
UT_LIST_BASE_NODE_T(trx_sig_t)
617
reply_signals; /*!< list of signals sent by the query
618
threads of this trx for which a thread
619
is waiting for a reply; if this trx is
620
killed, the reply requests in the list
622
/*------------------------------*/
623
lock_t* wait_lock; /*!< if trx execution state is
624
TRX_QUE_LOCK_WAIT, this points to
625
the lock request, otherwise this is
627
ibool was_chosen_as_deadlock_victim;
628
/* when the transaction decides to wait
629
for a lock, it sets this to FALSE;
630
if another transaction chooses this
631
transaction as a victim in deadlock
632
resolution, it sets this to TRUE */
633
time_t wait_started; /*!< lock wait started at this time */
634
UT_LIST_BASE_NODE_T(que_thr_t)
635
wait_thrs; /*!< query threads belonging to this
636
trx that are in the QUE_THR_LOCK_WAIT
638
ulint deadlock_mark; /*!< a mark field used in deadlock
639
checking algorithm. This must be
640
in its own machine word, because
641
it can be changed by other
642
threads while holding kernel_mutex. */
643
/*------------------------------*/
644
mem_heap_t* lock_heap; /*!< memory heap for the locks of the
646
UT_LIST_BASE_NODE_T(lock_t)
647
trx_locks; /*!< locks reserved by the transaction */
648
/*------------------------------*/
649
mem_heap_t* global_read_view_heap;
650
/* memory heap for the global read
652
read_view_t* global_read_view;
653
/* consistent read view associated
654
to a transaction or NULL */
655
read_view_t* read_view; /*!< consistent read view used in the
656
transaction or NULL, this read view
657
if defined can be normal read view
658
associated to a transaction (i.e.
659
same as global_read_view) or read view
660
associated to a cursor */
661
/*------------------------------*/
662
UT_LIST_BASE_NODE_T(trx_named_savept_t)
663
trx_savepoints; /*!< savepoints set with SAVEPOINT ...,
665
/*------------------------------*/
666
mutex_t undo_mutex; /*!< mutex protecting the fields in this
667
section (down to undo_no_arr), EXCEPT
668
last_sql_stat_start, which can be
669
accessed only when we know that there
670
cannot be any activity in the undo
672
undo_no_t undo_no; /*!< next undo log record number to
673
assign; since the undo log is
674
private for a transaction, this
675
is a simple ascending sequence
676
with no gaps; thus it represents
677
the number of modified/inserted
678
rows in a transaction */
679
trx_savept_t last_sql_stat_start;
680
/* undo_no when the last sql statement
681
was started: in case of an error, trx
682
is rolled back down to this undo
683
number; see note at undo_mutex! */
684
trx_rseg_t* rseg; /*!< rollback segment assigned to the
685
transaction, or NULL if not assigned
687
trx_undo_t* insert_undo; /*!< pointer to the insert undo log, or
688
NULL if no inserts performed yet */
689
trx_undo_t* update_undo; /*!< pointer to the update undo log, or
690
NULL if no update performed yet */
691
undo_no_t roll_limit; /*!< least undo number to undo during
693
ulint pages_undone; /*!< number of undo log pages undone
694
since the last undo log truncation */
695
trx_undo_arr_t* undo_no_arr; /*!< array of undo numbers of undo log
696
records which are currently processed
697
by a rollback operation */
698
/*------------------------------*/
699
ulint n_autoinc_rows; /*!< no. of AUTO-INC rows required for
700
an SQL statement. This is useful for
702
ib_vector_t* autoinc_locks; /* AUTOINC locks held by this
703
transaction. Note that these are
704
also in the lock list trx_locks. This
705
vector needs to be freed explicitly
706
when the trx_t instance is desrtoyed */
707
/*------------------------------*/
708
char detailed_error[256]; /*!< detailed error message for last
712
#define TRX_MAX_N_THREADS 32 /* maximum number of
713
concurrent threads running a
714
single operation of a
715
transaction, e.g., a parallel
717
/* Transaction concurrency states (trx->conc_state) */
718
#define TRX_NOT_STARTED 0
720
#define TRX_COMMITTED_IN_MEMORY 2
721
#define TRX_PREPARED 3 /* Support for 2PC/XA */
723
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
724
#define TRX_QUE_RUNNING 0 /* transaction is running */
725
#define TRX_QUE_LOCK_WAIT 1 /* transaction is waiting for a lock */
726
#define TRX_QUE_ROLLING_BACK 2 /* transaction is rolling back */
727
#define TRX_QUE_COMMITTING 3 /* transaction is committing */
729
/* Transaction isolation levels (trx->isolation_level) */
730
#define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking
731
SELECTs are performed so that
732
we do not look at a possible
733
earlier version of a record;
734
thus they are not 'consistent'
735
reads under this isolation
736
level; otherwise like level
739
#define TRX_ISO_READ_COMMITTED 1 /* somewhat Oracle-like
740
isolation, except that in
741
range UPDATE and DELETE we
742
must block phantom rows
744
SELECT ... FOR UPDATE and ...
745
LOCK IN SHARE MODE only lock
746
the index records, NOT the
747
gaps before them, and thus
748
allow free inserting;
749
each consistent read reads its
752
#define TRX_ISO_REPEATABLE_READ 2 /* this is the default;
753
all consistent reads in the
754
same trx read the same
756
full next-key locking used
757
in locking reads to block
758
insertions into gaps */
760
#define TRX_ISO_SERIALIZABLE 3 /* all plain SELECTs are
761
converted to LOCK IN SHARE
764
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
765
Multiple flags can be combined with bitwise OR. */
766
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
767
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
770
/* Types of a trx signal */
771
#define TRX_SIG_NO_SIGNAL 0
772
#define TRX_SIG_TOTAL_ROLLBACK 1
773
#define TRX_SIG_ROLLBACK_TO_SAVEPT 2
774
#define TRX_SIG_COMMIT 3
775
#define TRX_SIG_ERROR_OCCURRED 4
776
#define TRX_SIG_BREAK_EXECUTION 5
778
/* Sender types of a signal */
779
#define TRX_SIG_SELF 0 /* sent by the session itself, or
780
by an error occurring within this
782
#define TRX_SIG_OTHER_SESS 1 /* sent by another session (which
783
must hold rights to this) */
785
/** Commit node states */
786
enum commit_node_state {
787
COMMIT_NODE_SEND = 1, /*!< about to send a commit signal to
789
COMMIT_NODE_WAIT /*!< commit signal sent to the transaction,
790
waiting for completion */
793
/** Commit command node in a query graph */
794
struct commit_node_struct{
795
que_common_t common; /*!< node type: QUE_NODE_COMMIT */
796
enum commit_node_state
797
state; /*!< node execution state */
803
#include "trx0trx.ic"
805
#endif /* !UNIV_HOTBACKUP */