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, 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 */
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 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
#else /* !UNIV_HOTBACKUP */
395
#define trx_is_interrupted(trx) FALSE
396
#endif /* !UNIV_HOTBACKUP */
398
/*******************************************************************//**
399
Calculates the "weight" of a transaction. The weight of one transaction
400
is estimated as the number of altered rows + the number of locked rows.
402
@return transaction weight */
403
#define TRX_WEIGHT(t) \
404
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
406
/*******************************************************************//**
407
Compares the "weight" (or size) of two transactions. Transactions that
408
have edited non-transactional tables are considered heavier than ones
410
@return <0, 0 or >0; similar to strcmp(3) */
415
const trx_t* a, /*!< in: the first transaction to be compared */
416
const trx_t* b); /*!< in: the second transaction to be compared */
418
/*******************************************************************//**
419
Retrieves transacion's id, represented as unsigned long long.
420
@return transaction's id */
425
const trx_t* trx); /*!< in: transaction */
427
/* Maximum length of a string that can be returned by
428
trx_get_que_state_str(). */
429
#define TRX_QUE_STATE_STR_MAX_LEN 12 /* "ROLLING BACK" */
431
/*******************************************************************//**
432
Retrieves transaction's que state in a human readable string. The string
433
should not be free()'d or modified.
434
@return string in the data segment */
437
trx_get_que_state_str(
438
/*==================*/
439
const trx_t* trx); /*!< in: transaction */
441
/* Signal to a transaction */
442
struct trx_sig_struct{
443
unsigned type:3; /*!< signal type */
444
unsigned sender:1; /*!< TRX_SIG_SELF or
445
TRX_SIG_OTHER_SESS */
446
que_thr_t* receiver; /*!< non-NULL if the sender of the signal
447
wants reply after the operation induced
448
by the signal is completed */
449
trx_savept_t savept; /*!< possible rollback savepoint */
450
UT_LIST_NODE_T(trx_sig_t)
451
signals; /*!< queue of pending signals to the
453
UT_LIST_NODE_T(trx_sig_t)
454
reply_signals; /*!< list of signals for which the sender
455
transaction is waiting a reply */
458
#define TRX_MAGIC_N 91118598
460
/* The transaction handle; every session has a trx object which is freed only
461
when the session is freed; in addition there may be session-less transactions
462
rolling back after a database recovery */
466
/* All the next fields are protected by the kernel mutex, except the
467
undo logs which are protected by undo_mutex */
468
const char* op_info; /*!< English text describing the
469
current operation, or an empty
471
unsigned is_purge:1; /*!< 0=user transaction, 1=purge */
472
unsigned is_recovered:1; /*!< 0=normal transaction,
473
1=recovered, must be rolled back */
474
unsigned conc_state:2; /*!< state of the trx from the point
475
of view of concurrency control:
476
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
478
unsigned que_state:2; /*!< valid when conc_state == TRX_ACTIVE:
479
TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
481
unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
482
unsigned check_foreigns:1;/* normally TRUE, but if the user
483
wants to suppress foreign key checks,
484
(in table imports, for example) we
486
unsigned check_unique_secondary:1;
487
/* normally TRUE, but if the user
488
wants to speed up inserts by
489
suppressing unique key checks
490
for secondary indexes when we decide
491
if we can use the insert buffer for
492
them, we set this FALSE */
493
unsigned support_xa:1; /*!< normally we do the XA two-phase
494
commit steps, but by setting this to
495
FALSE, one can save CPU time and about
496
150 bytes in the undo log size as then
498
unsigned flush_log_later:1;/* In 2PC, we hold the
499
prepare_commit mutex across
500
both phases. In that case, we
501
defer flush of the logs to disk
502
until after we release the
504
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
505
trx_commit_off_kernel() if
506
flush_log_later was TRUE, and there
507
were modifications by the transaction;
508
in that case we must flush the log
509
in trx_commit_complete_for_mysql() */
510
unsigned dict_operation:2;/**< @see enum trx_dict_op */
511
unsigned duplicates:2; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
512
unsigned active_trans:2; /*!< 1 - if a transaction in MySQL
513
is active. 2 - if prepare_commit_mutex
515
unsigned has_search_latch:1;
516
/* TRUE if this trx has latched the
517
search system latch in S-mode */
518
unsigned declared_to_be_inside_innodb:1;
519
/* this is TRUE if we have declared
521
srv_conc_enter_innodb to be inside the
523
unsigned handling_signals:1;/* this is TRUE as long as the trx
524
is handling signals */
525
unsigned dict_operation_lock_mode:2;
526
/* 0, RW_S_LATCH, or RW_X_LATCH:
527
the latch mode trx currently holds
528
on dict_operation_lock */
529
time_t start_time; /*!< time the trx object was created
530
or the state last time became
532
trx_id_t id; /*!< transaction id */
533
XID xid; /*!< X/Open XA transaction
534
identification to identify a
535
transaction branch */
536
trx_id_t no; /*!< transaction serialization number ==
537
max trx id when the transaction is
538
moved to COMMITTED_IN_MEMORY state */
539
ib_uint64_t commit_lsn; /*!< lsn at the time of the commit */
540
trx_id_t table_id; /*!< Table to drop iff dict_operation
541
is TRUE, or ut_dulint_zero. */
542
/*------------------------------*/
543
void* mysql_thd; /*!< MySQL thread handle corresponding
544
to this trx, or NULL */
545
char** mysql_query_str;/* pointer to the field in mysqld_thd
546
which contains the pointer to the
547
current SQL query string */
548
const char* mysql_log_file_name;
549
/* if MySQL binlog is used, this field
550
contains a pointer to the latest file
551
name; this is NULL if binlog is not
553
ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
554
contains the end offset of the binlog
556
os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
557
with this transaction object */
558
ulint mysql_process_no;/* since in Linux, 'top' reports
559
process id's and not thread id's, we
560
store the process number too */
561
/*------------------------------*/
562
ulint n_mysql_tables_in_use; /* number of Innobase tables
563
used in the processing of the current
564
SQL statement in MySQL */
565
ulint mysql_n_tables_locked;
566
/* how many tables the current SQL
567
statement uses, except those
568
in consistent read */
569
ulint search_latch_timeout;
570
/* If we notice that someone is
571
waiting for our S-lock on the search
572
latch to be released, we wait in
573
row0sel.c for BTR_SEA_TIMEOUT new
574
searches until we try to keep
575
the search latch again over
576
calls from MySQL; this is intended
577
to reduce contention on the search
579
/*------------------------------*/
580
ulint n_tickets_to_enter_innodb;
581
/* this can be > 0 only when
582
declared_to_... is TRUE; when we come
583
to srv_conc_innodb_enter, if the value
584
here is > 0, we decrement this by 1 */
585
/*------------------------------*/
586
UT_LIST_NODE_T(trx_t)
587
trx_list; /*!< list of transactions */
588
UT_LIST_NODE_T(trx_t)
589
mysql_trx_list; /*!< list of transactions created for
591
/*------------------------------*/
592
ulint error_state; /*!< 0 if no error, otherwise error
593
number; NOTE That ONLY the thread
594
doing the transaction is allowed to
595
set this field: this is NOT protected
596
by the kernel mutex */
597
const dict_index_t*error_info; /*!< if the error number indicates a
598
duplicate key error, a pointer to
599
the problematic index is stored here */
600
ulint error_key_num; /*!< if the index creation fails to a
601
duplicate key error, a mysql key
602
number of that index is stored here */
603
sess_t* sess; /*!< session of the trx, NULL if none */
604
que_t* graph; /*!< query currently run in the session,
605
or NULL if none; NOTE that the query
606
belongs to the session, and it can
607
survive over a transaction commit, if
608
it is a stored procedure with a COMMIT
609
WORK statement, for instance */
610
ulint n_active_thrs; /*!< number of active query threads */
611
que_t* graph_before_signal_handling;
612
/* value of graph when signal handling
613
for this trx started: this is used to
614
return control to the original query
615
graph for error processing */
616
trx_sig_t sig; /*!< one signal object can be allocated
617
in this space, avoiding mem_alloc */
618
UT_LIST_BASE_NODE_T(trx_sig_t)
619
signals; /*!< queue of processed or pending
620
signals to the trx */
621
UT_LIST_BASE_NODE_T(trx_sig_t)
622
reply_signals; /*!< list of signals sent by the query
623
threads of this trx for which a thread
624
is waiting for a reply; if this trx is
625
killed, the reply requests in the list
627
/*------------------------------*/
628
lock_t* wait_lock; /*!< if trx execution state is
629
TRX_QUE_LOCK_WAIT, this points to
630
the lock request, otherwise this is
632
ibool was_chosen_as_deadlock_victim;
633
/* when the transaction decides to wait
634
for a lock, it sets this to FALSE;
635
if another transaction chooses this
636
transaction as a victim in deadlock
637
resolution, it sets this to TRUE */
638
time_t wait_started; /*!< lock wait started at this time */
639
UT_LIST_BASE_NODE_T(que_thr_t)
640
wait_thrs; /*!< query threads belonging to this
641
trx that are in the QUE_THR_LOCK_WAIT
643
ulint deadlock_mark; /*!< a mark field used in deadlock
644
checking algorithm. This must be
645
in its own machine word, because
646
it can be changed by other
647
threads while holding kernel_mutex. */
648
/*------------------------------*/
649
mem_heap_t* lock_heap; /*!< memory heap for the locks of the
651
UT_LIST_BASE_NODE_T(lock_t)
652
trx_locks; /*!< locks reserved by the transaction */
653
/*------------------------------*/
654
mem_heap_t* global_read_view_heap;
655
/* memory heap for the global read
657
read_view_t* global_read_view;
658
/* consistent read view associated
659
to a transaction or NULL */
660
read_view_t* read_view; /*!< consistent read view used in the
661
transaction or NULL, this read view
662
if defined can be normal read view
663
associated to a transaction (i.e.
664
same as global_read_view) or read view
665
associated to a cursor */
666
/*------------------------------*/
667
UT_LIST_BASE_NODE_T(trx_named_savept_t)
668
trx_savepoints; /*!< savepoints set with SAVEPOINT ...,
670
/*------------------------------*/
671
mutex_t undo_mutex; /*!< mutex protecting the fields in this
672
section (down to undo_no_arr), EXCEPT
673
last_sql_stat_start, which can be
674
accessed only when we know that there
675
cannot be any activity in the undo
677
undo_no_t undo_no; /*!< next undo log record number to
678
assign; since the undo log is
679
private for a transaction, this
680
is a simple ascending sequence
681
with no gaps; thus it represents
682
the number of modified/inserted
683
rows in a transaction */
684
trx_savept_t last_sql_stat_start;
685
/* undo_no when the last sql statement
686
was started: in case of an error, trx
687
is rolled back down to this undo
688
number; see note at undo_mutex! */
689
trx_rseg_t* rseg; /*!< rollback segment assigned to the
690
transaction, or NULL if not assigned
692
trx_undo_t* insert_undo; /*!< pointer to the insert undo log, or
693
NULL if no inserts performed yet */
694
trx_undo_t* update_undo; /*!< pointer to the update undo log, or
695
NULL if no update performed yet */
696
undo_no_t roll_limit; /*!< least undo number to undo during
698
ulint pages_undone; /*!< number of undo log pages undone
699
since the last undo log truncation */
700
trx_undo_arr_t* undo_no_arr; /*!< array of undo numbers of undo log
701
records which are currently processed
702
by a rollback operation */
703
/*------------------------------*/
704
ulint n_autoinc_rows; /*!< no. of AUTO-INC rows required for
705
an SQL statement. This is useful for
707
ib_vector_t* autoinc_locks; /* AUTOINC locks held by this
708
transaction. Note that these are
709
also in the lock list trx_locks. This
710
vector needs to be freed explicitly
711
when the trx_t instance is desrtoyed */
712
/*------------------------------*/
713
char detailed_error[256]; /*!< detailed error message for last
717
#define TRX_MAX_N_THREADS 32 /* maximum number of
718
concurrent threads running a
719
single operation of a
720
transaction, e.g., a parallel
722
/* Transaction concurrency states (trx->conc_state) */
723
#define TRX_NOT_STARTED 0
725
#define TRX_COMMITTED_IN_MEMORY 2
726
#define TRX_PREPARED 3 /* Support for 2PC/XA */
728
/* Transaction execution states when trx->conc_state == TRX_ACTIVE */
729
#define TRX_QUE_RUNNING 0 /* transaction is running */
730
#define TRX_QUE_LOCK_WAIT 1 /* transaction is waiting for a lock */
731
#define TRX_QUE_ROLLING_BACK 2 /* transaction is rolling back */
732
#define TRX_QUE_COMMITTING 3 /* transaction is committing */
734
/* Transaction isolation levels (trx->isolation_level) */
735
#define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking
736
SELECTs are performed so that
737
we do not look at a possible
738
earlier version of a record;
739
thus they are not 'consistent'
740
reads under this isolation
741
level; otherwise like level
744
#define TRX_ISO_READ_COMMITTED 1 /* somewhat Oracle-like
745
isolation, except that in
746
range UPDATE and DELETE we
747
must block phantom rows
749
SELECT ... FOR UPDATE and ...
750
LOCK IN SHARE MODE only lock
751
the index records, NOT the
752
gaps before them, and thus
753
allow free inserting;
754
each consistent read reads its
757
#define TRX_ISO_REPEATABLE_READ 2 /* this is the default;
758
all consistent reads in the
759
same trx read the same
761
full next-key locking used
762
in locking reads to block
763
insertions into gaps */
765
#define TRX_ISO_SERIALIZABLE 3 /* all plain SELECTs are
766
converted to LOCK IN SHARE
769
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
770
Multiple flags can be combined with bitwise OR. */
771
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
772
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
775
/* Types of a trx signal */
776
#define TRX_SIG_NO_SIGNAL 0
777
#define TRX_SIG_TOTAL_ROLLBACK 1
778
#define TRX_SIG_ROLLBACK_TO_SAVEPT 2
779
#define TRX_SIG_COMMIT 3
780
#define TRX_SIG_ERROR_OCCURRED 4
781
#define TRX_SIG_BREAK_EXECUTION 5
783
/* Sender types of a signal */
784
#define TRX_SIG_SELF 0 /* sent by the session itself, or
785
by an error occurring within this
787
#define TRX_SIG_OTHER_SESS 1 /* sent by another session (which
788
must hold rights to this) */
790
/** Commit node states */
791
enum commit_node_state {
792
COMMIT_NODE_SEND = 1, /*!< about to send a commit signal to
794
COMMIT_NODE_WAIT /*!< commit signal sent to the transaction,
795
waiting for completion */
798
/** Commit command node in a query graph */
799
struct commit_node_struct{
800
que_common_t common; /*!< node type: QUE_NODE_COMMIT */
801
enum commit_node_state
802
state; /*!< node execution state */
808
#include "trx0trx.ic"
810
#endif /* !UNIV_HOTBACKUP */