1
/*****************************************************************************
3
Copyright (C) 1996, 2010, 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., 51 Franklin
15
St, Fifth Floor, Boston, MA 02110-1301 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, and 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
346
FILE* f, /*!< in: output stream */
347
trx_t* trx, /*!< in: transaction */
348
ulint max_query_len); /*!< in: max query length to print, or 0 to
349
use the default max length */
351
/** Type of data dictionary operation */
352
typedef enum trx_dict_op {
353
/** The transaction is not modifying the data dictionary. */
354
TRX_DICT_OP_NONE = 0,
355
/** The transaction is creating a table or an index, or
356
dropping a table. The table must be dropped in crash
357
recovery. This and TRX_DICT_OP_NONE are the only possible
358
operation modes in crash recovery. */
359
TRX_DICT_OP_TABLE = 1,
360
/** The transaction is creating or dropping an index in an
361
existing table. In crash recovery, the the data dictionary
362
must be locked, but the table must not be dropped. */
363
TRX_DICT_OP_INDEX = 2
366
/**********************************************************************//**
367
Determine if a transaction is a dictionary operation.
368
@return dictionary operation mode */
371
trx_get_dict_operation(
372
/*===================*/
373
const trx_t* trx) /*!< in: transaction */
374
__attribute__((pure));
375
/**********************************************************************//**
376
Flag a transaction a dictionary operation. */
379
trx_set_dict_operation(
380
/*===================*/
381
trx_t* trx, /*!< in/out: transaction */
382
enum trx_dict_op op); /*!< in: operation, not
385
#ifndef UNIV_HOTBACKUP
386
/**********************************************************************//**
387
Determines if the currently running transaction has been interrupted.
388
@return TRUE if interrupted */
393
trx_t* trx); /*!< in: transaction */
394
/**********************************************************************//**
395
Determines if the currently running transaction is in strict mode.
396
@return TRUE if strict */
401
trx_t* trx); /*!< in: transaction */
402
#else /* !UNIV_HOTBACKUP */
403
#define trx_is_interrupted(trx) FALSE
404
#endif /* !UNIV_HOTBACKUP */
406
/*******************************************************************//**
407
Calculates the "weight" of a transaction. The weight of one transaction
408
is estimated as the number of altered rows + the number of locked rows.
410
@return transaction weight */
411
#define TRX_WEIGHT(t) ((t)->undo_no + UT_LIST_GET_LEN((t)->trx_locks))
413
/*******************************************************************//**
414
Compares the "weight" (or size) of two transactions. Transactions that
415
have edited non-transactional tables are considered heavier than ones
417
@return TRUE if weight(a) >= weight(b) */
422
const trx_t* a, /*!< in: the first transaction to be compared */
423
const trx_t* b); /*!< in: the second transaction to be compared */
425
/* Maximum length of a string that can be returned by
426
trx_get_que_state_str(). */
427
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
429
/*******************************************************************//**
430
Retrieves transaction's que state in a human readable string. The string
431
should not be free()'d or modified.
432
@return string in the data segment */
435
trx_get_que_state_str(
436
/*==================*/
437
const trx_t* trx); /*!< in: transaction */
439
/* Signal to a transaction */
440
struct trx_sig_struct{
441
unsigned type:3; /*!< signal type */
442
unsigned sender:1; /*!< TRX_SIG_SELF or
443
TRX_SIG_OTHER_SESS */
444
que_thr_t* receiver; /*!< non-NULL if the sender of the signal
445
wants reply after the operation induced
446
by the signal is completed */
447
trx_savept_t savept; /*!< possible rollback savepoint */
448
UT_LIST_NODE_T(trx_sig_t)
449
signals; /*!< queue of pending signals to the
451
UT_LIST_NODE_T(trx_sig_t)
452
reply_signals; /*!< list of signals for which the sender
453
transaction is waiting a reply */
456
#define TRX_MAGIC_N 91118598
458
/* The transaction handle; every session has a trx object which is freed only
459
when the session is freed; in addition there may be session-less transactions
460
rolling back after a database recovery */
465
/* These fields are not protected by any mutex. */
466
const char* op_info; /*!< English text describing the
467
current operation, or an empty
469
ulint conc_state; /*!< state of the trx from the point
470
of view of concurrency control:
471
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
473
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
474
ulint check_foreigns; /* normally TRUE, but if the user
475
wants to suppress foreign key checks,
476
(in table imports, for example) we
478
unsigned check_unique_secondary;
479
/* normally TRUE, but if the user
480
wants to speed up inserts by
481
suppressing unique key checks
482
for secondary indexes when we decide
483
if we can use the insert buffer for
484
them, we set this FALSE */
485
unsigned support_xa; /*!< normally we do the XA two-phase
486
commit steps, but by setting this to
487
FALSE, one can save CPU time and about
488
150 bytes in the undo log size as then
490
unsigned flush_log_later;/* In 2PC, we hold the
491
prepare_commit mutex across
492
both phases. In that case, we
493
defer flush of the logs to disk
494
until after we release the
496
unsigned must_flush_log_later;/* this flag is set to TRUE in
497
trx_commit_off_kernel() if
498
flush_log_later was TRUE, and there
499
were modifications by the transaction;
500
in that case we must flush the log
501
in trx_commit_complete_for_mysql() */
502
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
503
ulint active_trans; /*!< 1 - if a transaction in MySQL
504
is active. 2 - if prepare_commit_mutex
506
unsigned has_search_latch;
507
/* TRUE if this trx has latched the
508
search system latch in S-mode */
509
ulint deadlock_mark; /*!< a mark field used in deadlock
510
checking algorithm. */
511
trx_dict_op_t dict_operation; /**< @see enum trx_dict_op */
513
/* Fields protected by the srv_conc_mutex. */
514
ulint declared_to_be_inside_innodb;
515
/* this is TRUE if we have declared
517
srv_conc_enter_innodb to be inside the
520
/* Fields protected by dict_operation_lock. The very latch
521
it is used to track. */
522
ulint dict_operation_lock_mode;
523
/*!< 0, RW_S_LATCH, or RW_X_LATCH:
524
the latch mode trx currently holds
525
on dict_operation_lock */
527
/* All the next fields are protected by the kernel mutex, except the
528
undo logs which are protected by undo_mutex */
529
ulint is_purge; /*!< 0=user transaction, 1=purge */
530
ulint is_recovered; /*!< 0=normal transaction,
531
1=recovered, must be rolled back */
532
ulint que_state; /*!< valid when conc_state
533
== TRX_ACTIVE: TRX_QUE_RUNNING,
534
TRX_QUE_LOCK_WAIT, ... */
535
ulint handling_signals;/* this is TRUE as long as the trx
536
is handling signals */
537
time_t start_time; /*!< time the trx object was created
538
or the state last time became
540
trx_id_t id; /*!< transaction id */
541
XID xid; /*!< X/Open XA transaction
542
identification to identify a
543
transaction branch */
544
trx_id_t no; /*!< transaction serialization number ==
545
max trx id when the transaction is
546
moved to COMMITTED_IN_MEMORY state */
547
ib_uint64_t commit_lsn; /*!< lsn at the time of the commit */
548
table_id_t table_id; /*!< Table to drop iff dict_operation
550
/*------------------------------*/
551
void* mysql_thd; /*!< MySQL thread handle corresponding
552
to this trx, or NULL */
553
const char* mysql_log_file_name;
554
/* if MySQL binlog is used, this field
555
contains a pointer to the latest file
556
name; this is NULL if binlog is not
558
ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
559
contains the end offset of the binlog
561
os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
562
with this transaction object */
563
ulint mysql_process_no;/* since in Linux, 'top' reports
564
process id's and not thread id's, we
565
store the process number too */
566
ulint mysql_n_tables_locked;
567
/* how many tables the current SQL
568
statement uses, except those
569
in consistent read */
570
ulint search_latch_timeout;
571
/* If we notice that someone is
572
waiting for our S-lock on the search
573
latch to be released, we wait in
574
row0sel.c for BTR_SEA_TIMEOUT new
575
searches until we try to keep
576
the search latch again over
577
calls from MySQL; this is intended
578
to reduce contention on the search
580
/*------------------------------*/
581
ulint n_tickets_to_enter_innodb;
582
/* this can be > 0 only when
583
declared_to_... is TRUE; when we come
584
to srv_conc_innodb_enter, if the value
585
here is > 0, we decrement this by 1 */
586
/*------------------------------*/
587
UT_LIST_NODE_T(trx_t)
588
trx_list; /*!< list of transactions */
589
UT_LIST_NODE_T(trx_t)
590
mysql_trx_list; /*!< list of transactions created for
592
/*------------------------------*/
593
ulint error_state; /*!< 0 if no error, otherwise error
594
number; NOTE That ONLY the thread
595
doing the transaction is allowed to
596
set this field: this is NOT protected
597
by the kernel mutex */
598
const dict_index_t*error_info; /*!< if the error number indicates a
599
duplicate key error, a pointer to
600
the problematic index is stored here */
601
ulint error_key_num; /*!< if the index creation fails to a
602
duplicate key error, a mysql key
603
number of that index is stored here */
604
sess_t* sess; /*!< session of the trx, NULL if none */
605
que_t* graph; /*!< query currently run in the session,
606
or NULL if none; NOTE that the query
607
belongs to the session, and it can
608
survive over a transaction commit, if
609
it is a stored procedure with a COMMIT
610
WORK statement, for instance */
611
ulint n_active_thrs; /*!< number of active query threads */
612
que_t* graph_before_signal_handling;
613
/* value of graph when signal handling
614
for this trx started: this is used to
615
return control to the original query
616
graph for error processing */
617
trx_sig_t sig; /*!< one signal object can be allocated
618
in this space, avoiding mem_alloc */
619
UT_LIST_BASE_NODE_T(trx_sig_t)
620
signals; /*!< queue of processed or pending
621
signals to the trx */
622
UT_LIST_BASE_NODE_T(trx_sig_t)
623
reply_signals; /*!< list of signals sent by the query
624
threads of this trx for which a thread
625
is waiting for a reply; if this trx is
626
killed, the reply requests in the list
628
/*------------------------------*/
629
lock_t* wait_lock; /*!< if trx execution state is
630
TRX_QUE_LOCK_WAIT, this points to
631
the lock request, otherwise this is
633
ibool was_chosen_as_deadlock_victim;
634
/* when the transaction decides to wait
635
for a lock, it sets this to FALSE;
636
if another transaction chooses this
637
transaction as a victim in deadlock
638
resolution, it sets this to TRUE */
639
time_t wait_started; /*!< lock wait started at this time */
640
UT_LIST_BASE_NODE_T(que_thr_t)
641
wait_thrs; /*!< query threads belonging to this
642
trx that are in the QUE_THR_LOCK_WAIT
644
/*------------------------------*/
645
mem_heap_t* lock_heap; /*!< memory heap for the locks of the
647
UT_LIST_BASE_NODE_T(lock_t)
648
trx_locks; /*!< locks reserved by the transaction */
649
/*------------------------------*/
650
mem_heap_t* global_read_view_heap;
651
/* memory heap for the global read
653
read_view_t* global_read_view;
654
/* consistent read view associated
655
to a transaction or NULL */
656
read_view_t* read_view; /*!< consistent read view used in the
657
transaction or NULL, this read view
658
if defined can be normal read view
659
associated to a transaction (i.e.
660
same as global_read_view) or read view
661
associated to a cursor */
662
/*------------------------------*/
663
UT_LIST_BASE_NODE_T(trx_named_savept_t)
664
trx_savepoints; /*!< savepoints set with SAVEPOINT ...,
666
/*------------------------------*/
667
mutex_t undo_mutex; /*!< mutex protecting the fields in this
668
section (down to undo_no_arr), EXCEPT
669
last_sql_stat_start, which can be
670
accessed only when we know that there
671
cannot be any activity in the undo
673
undo_no_t undo_no; /*!< next undo log record number to
674
assign; since the undo log is
675
private for a transaction, this
676
is a simple ascending sequence
677
with no gaps; thus it represents
678
the number of modified/inserted
679
rows in a transaction */
680
trx_savept_t last_sql_stat_start;
681
/* undo_no when the last sql statement
682
was started: in case of an error, trx
683
is rolled back down to this undo
684
number; see note at undo_mutex! */
685
trx_rseg_t* rseg; /*!< rollback segment assigned to the
686
transaction, or NULL if not assigned
688
trx_undo_t* insert_undo; /*!< pointer to the insert undo log, or
689
NULL if no inserts performed yet */
690
trx_undo_t* update_undo; /*!< pointer to the update undo log, or
691
NULL if no update performed yet */
692
undo_no_t roll_limit; /*!< least undo number to undo during
694
ulint pages_undone; /*!< number of undo log pages undone
695
since the last undo log truncation */
696
trx_undo_arr_t* undo_no_arr; /*!< array of undo numbers of undo log
697
records which are currently processed
698
by a rollback operation */
699
/*------------------------------*/
700
ulint n_autoinc_rows; /*!< no. of AUTO-INC rows required for
701
an SQL statement. This is useful for
703
ib_vector_t* autoinc_locks; /* AUTOINC locks held by this
704
transaction. Note that these are
705
also in the lock list trx_locks. This
706
vector needs to be freed explicitly
707
when the trx_t instance is desrtoyed */
708
/*------------------------------*/
709
char detailed_error[256]; /*!< detailed error message for last
713
#define TRX_MAX_N_THREADS 32 /* maximum number of
714
concurrent threads running a
715
single operation of a
716
transaction, e.g., a parallel
718
/* Transaction concurrency states (trx->conc_state) */
719
#define TRX_NOT_STARTED 0
721
#define TRX_COMMITTED_IN_MEMORY 2
722
#define TRX_PREPARED 3 /* Support for 2PC/XA */
724
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
725
#define TRX_QUE_RUNNING 0 /* transaction is running */
726
#define TRX_QUE_LOCK_WAIT 1 /* transaction is waiting for a lock */
727
#define TRX_QUE_ROLLING_BACK 2 /* transaction is rolling back */
728
#define TRX_QUE_COMMITTING 3 /* transaction is committing */
730
/* Transaction isolation levels (trx->isolation_level) */
731
#define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking
732
SELECTs are performed so that
733
we do not look at a possible
734
earlier version of a record;
735
thus they are not 'consistent'
736
reads under this isolation
737
level; otherwise like level
740
#define TRX_ISO_READ_COMMITTED 1 /* somewhat Oracle-like
741
isolation, except that in
742
range UPDATE and DELETE we
743
must block phantom rows
745
SELECT ... FOR UPDATE and ...
746
LOCK IN SHARE MODE only lock
747
the index records, NOT the
748
gaps before them, and thus
749
allow free inserting;
750
each consistent read reads its
753
#define TRX_ISO_REPEATABLE_READ 2 /* this is the default;
754
all consistent reads in the
755
same trx read the same
757
full next-key locking used
758
in locking reads to block
759
insertions into gaps */
761
#define TRX_ISO_SERIALIZABLE 3 /* all plain SELECTs are
762
converted to LOCK IN SHARE
765
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
766
Multiple flags can be combined with bitwise OR. */
767
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
768
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
771
/* Types of a trx signal */
772
#define TRX_SIG_NO_SIGNAL 0
773
#define TRX_SIG_TOTAL_ROLLBACK 1
774
#define TRX_SIG_ROLLBACK_TO_SAVEPT 2
775
#define TRX_SIG_COMMIT 3
776
#define TRX_SIG_ERROR_OCCURRED 4
777
#define TRX_SIG_BREAK_EXECUTION 5
779
/* Sender types of a signal */
780
#define TRX_SIG_SELF 0 /* sent by the session itself, or
781
by an error occurring within this
783
#define TRX_SIG_OTHER_SESS 1 /* sent by another session (which
784
must hold rights to this) */
786
/** Commit node states */
787
enum commit_node_state {
788
COMMIT_NODE_SEND = 1, /*!< about to send a commit signal to
790
COMMIT_NODE_WAIT /*!< commit signal sent to the transaction,
791
waiting for completion */
794
/** Commit command node in a query graph */
795
struct commit_node_struct{
796
que_common_t common; /*!< node type: QUE_NODE_COMMIT */
797
enum commit_node_state
798
state; /*!< node execution state */
804
#include "trx0trx.ic"
806
#endif /* !UNIV_HOTBACKUP */