1
/******************************************************
6
Created 3/26/1996 Heikki Tuuri
7
*******************************************************/
13
#include "trx0types.h"
14
#include "lock0types.h"
15
#include "usr0types.h"
16
#include "que0types.h"
18
#include "read0types.h"
19
#include "dict0types.h"
22
/* Dummy session used currently in MySQL interface */
23
extern sess_t* trx_dummy_sess;
25
/* Number of transactions currently allocated for MySQL: protected by
27
extern ulint trx_n_mysql_transactions;
29
/*****************************************************************
30
Resets the new record lock info in a transaction struct. */
33
trx_reset_new_rec_lock_info(
34
/*========================*/
35
trx_t* trx); /* in: transaction struct */
36
/*****************************************************************
37
Registers that we have set a new record lock on an index. We only have space
38
to store 2 indexes! If this is called to store more than 2 indexes after
39
trx_reset_new_rec_lock_info(), then this function does nothing. */
42
trx_register_new_rec_lock(
43
/*======================*/
44
trx_t* trx, /* in: transaction struct */
45
dict_index_t* index); /* in: trx sets a new record lock on this
47
/*****************************************************************
48
Checks if trx has set a new record lock on an index. */
51
trx_new_rec_locks_contain(
52
/*======================*/
53
/* out: TRUE if trx has set a new record lock
55
trx_t* trx, /* in: transaction struct */
56
dict_index_t* index); /* in: index */
57
/************************************************************************
58
Releases the search latch if trx has reserved it. */
61
trx_search_latch_release_if_reserved(
62
/*=================================*/
63
trx_t* trx); /* in: transaction */
64
/**********************************************************************
65
Set detailed error message for the transaction. */
68
trx_set_detailed_error(
69
/*===================*/
70
trx_t* trx, /* in: transaction struct */
71
const char* msg); /* in: detailed error message */
72
/*****************************************************************
73
Set detailed error message for the transaction from a file. Note that the
74
file is rewinded before reading from it. */
77
trx_set_detailed_error_from_file(
78
/*=============================*/
79
trx_t* trx, /* in: transaction struct */
80
FILE* file); /* in: file to read message from */
81
/********************************************************************
82
Retrieves the error_info field from a trx. */
87
/* out: the error info */
88
const trx_t* trx); /* in: trx object */
89
/********************************************************************
90
Creates and initializes a transaction object. */
95
/* out, own: the transaction */
96
sess_t* sess) /* in: session */
97
__attribute__((nonnull));
98
/************************************************************************
99
Creates a transaction object for MySQL. */
102
trx_allocate_for_mysql(void);
103
/*========================*/
104
/* out, own: transaction object */
105
/************************************************************************
106
Creates a transaction object for background operations by the master thread. */
109
trx_allocate_for_background(void);
110
/*=============================*/
111
/* out, own: transaction object */
112
/************************************************************************
113
Frees a transaction object. */
118
trx_t* trx); /* in, own: trx object */
119
/************************************************************************
120
Frees a transaction object for MySQL. */
125
trx_t* trx); /* in, own: trx object */
126
/************************************************************************
127
Frees a transaction object of a background operation of the master thread. */
130
trx_free_for_background(
131
/*====================*/
132
trx_t* trx); /* in, own: trx object */
133
/********************************************************************
134
Creates trx objects for transactions and initializes the trx list of
135
trx_sys at database start. Rollback segment and undo log lists must
136
already exist when this function is called, because the lists of
137
transactions to be rolled back or cleaned up are built based on the
141
trx_lists_init_at_db_start(void);
142
/*============================*/
143
/********************************************************************
144
Starts a new transaction. */
149
/* out: TRUE if success, FALSE if the rollback
150
segment could not support this many transactions */
151
trx_t* trx, /* in: transaction */
152
ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED
153
is passed, the system chooses the rollback segment
154
automatically in a round-robin fashion */
155
/********************************************************************
156
Starts a new transaction. */
162
trx_t* trx, /* in: transaction */
163
ulint rseg_id);/* in: rollback segment id; if ULINT_UNDEFINED
164
is passed, the system chooses the rollback segment
165
automatically in a round-robin fashion */
166
/*****************************************************************
167
Starts the transaction if it is not yet started. */
170
trx_start_if_not_started(
171
/*=====================*/
172
trx_t* trx); /* in: transaction */
173
/*****************************************************************
174
Starts the transaction if it is not yet started. Assumes we have reserved
178
trx_start_if_not_started_low(
179
/*=========================*/
180
trx_t* trx); /* in: transaction */
181
/********************************************************************
182
Commits a transaction. */
185
trx_commit_off_kernel(
186
/*==================*/
187
trx_t* trx); /* in: transaction */
188
/********************************************************************
189
Cleans up a transaction at database startup. The cleanup is needed if
190
the transaction already got to the middle of a commit when the database
191
crashed, andf we cannot roll it back. */
194
trx_cleanup_at_db_startup(
195
/*======================*/
196
trx_t* trx); /* in: transaction */
197
/**************************************************************************
198
Does the transaction commit for MySQL. */
201
trx_commit_for_mysql(
202
/*=================*/
203
/* out: DB_SUCCESS or error number */
204
trx_t* trx); /* in: trx handle */
205
/**************************************************************************
206
Does the transaction prepare for MySQL. */
209
trx_prepare_for_mysql(
210
/*==================*/
211
/* out: 0 or error number */
212
trx_t* trx); /* in: trx handle */
213
/**************************************************************************
214
This function is used to find number of prepared transactions and
215
their transaction objects for a recovery. */
218
trx_recover_for_mysql(
219
/*==================*/
220
/* out: number of prepared transactions */
221
XID* xid_list, /* in/out: prepared transactions */
222
ulint len); /* in: number of slots in xid_list */
223
/***********************************************************************
224
This function is used to find one X/Open XA distributed transaction
225
which is in the prepared state */
230
/* out: trx or NULL */
231
XID* xid); /* in: X/Open XA transaction identification */
232
/**************************************************************************
233
If required, flushes the log to disk if we called trx_commit_for_mysql()
234
with trx->flush_log_later == TRUE. */
237
trx_commit_complete_for_mysql(
238
/*==========================*/
239
/* out: 0 or error number */
240
trx_t* trx); /* in: trx handle */
241
/**************************************************************************
242
Marks the latest SQL statement ended. */
245
trx_mark_sql_stat_end(
246
/*==================*/
247
trx_t* trx); /* in: trx handle */
248
/************************************************************************
249
Assigns a read view for a consistent read query. All the consistent reads
250
within the same transaction will get the same read view, which is created
251
when this function is first called for a new started transaction. */
254
trx_assign_read_view(
255
/*=================*/
256
/* out: consistent read view */
257
trx_t* trx); /* in: active transaction */
258
/***************************************************************
259
The transaction must be in the TRX_QUE_LOCK_WAIT state. Puts it to
260
the TRX_QUE_RUNNING state and releases query threads which were
261
waiting for a lock in the wait_thrs list. */
266
trx_t* trx); /* in: transaction */
267
/********************************************************************
268
Sends a signal to a trx object. */
273
trx_t* trx, /* in: trx handle */
274
ulint type, /* in: signal type */
275
ulint sender, /* in: TRX_SIG_SELF or
276
TRX_SIG_OTHER_SESS */
277
que_thr_t* receiver_thr, /* in: query thread which wants the
278
reply, or NULL; if type is
279
TRX_SIG_END_WAIT, this must be NULL */
280
trx_savept_t* savept, /* in: possible rollback savepoint, or
282
que_thr_t** next_thr); /* in/out: next query thread to run;
283
if the value which is passed in is
284
a pointer to a NULL pointer, then the
285
calling function can start running
286
a new query thread; if the parameter
287
is NULL, it is ignored */
288
/********************************************************************
289
Send the reply message when a signal in the queue of the trx has
295
trx_sig_t* sig, /* in: signal */
296
que_thr_t** next_thr); /* in/out: next query thread to run;
297
if the value which is passed in is
298
a pointer to a NULL pointer, then the
299
calling function can start running
300
a new query thread */
301
/********************************************************************
302
Removes the signal object from a trx signal queue. */
307
trx_t* trx, /* in: trx handle */
308
trx_sig_t* sig); /* in, own: signal */
309
/********************************************************************
310
Starts handling of a trx signal. */
313
trx_sig_start_handle(
314
/*=================*/
315
trx_t* trx, /* in: trx handle */
316
que_thr_t** next_thr); /* in/out: next query thread to run;
317
if the value which is passed in is
318
a pointer to a NULL pointer, then the
319
calling function can start running
320
a new query thread */
321
/********************************************************************
322
Ends signal handling. If the session is in the error state, and
323
trx->graph_before_signal_handling != NULL, returns control to the error
324
handling routine of the graph (currently only returns the control to the
325
graph root which then sends an error message to the client). */
328
trx_end_signal_handling(
329
/*====================*/
330
trx_t* trx); /* in: trx */
331
/*************************************************************************
332
Creates a commit command node struct. */
337
/* out, own: commit node struct */
338
mem_heap_t* heap); /* in: mem heap where created */
339
/***************************************************************
340
Performs an execution step for a commit type node in a query graph. */
345
/* out: query thread to run next, or NULL */
346
que_thr_t* thr); /* in: query thread */
348
/**************************************************************************
349
Prints info about a transaction to the given file. The caller must own the
350
kernel mutex and must have called
351
innobase_mysql_prepare_print_arbitrary_thd(), unless he knows that MySQL
352
or InnoDB cannot meanwhile change the info printed here. */
357
FILE* f, /* in: output stream */
358
trx_t* trx, /* in: transaction */
359
ulint max_query_len); /* in: max query length to print, or 0 to
360
use the default max length */
362
/** Type of data dictionary operation */
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
377
/**************************************************************************
378
Determine if a transaction is a dictionary operation. */
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. */
390
trx_set_dict_operation(
391
/*===================*/
392
trx_t* trx, /* in/out: transaction */
393
enum trx_dict_op op); /* in: operation, not
396
#ifndef UNIV_HOTBACKUP
397
/**************************************************************************
398
Determines if the currently running transaction has been interrupted. */
403
/* out: TRUE if interrupted */
404
trx_t* trx); /* in: transaction */
405
#else /* !UNIV_HOTBACKUP */
406
#define trx_is_interrupted(trx) FALSE
407
#endif /* !UNIV_HOTBACKUP */
409
/***********************************************************************
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.
414
#define TRX_WEIGHT(t) \
415
ut_dulint_add((t)->undo_no, UT_LIST_GET_LEN((t)->trx_locks))
417
/***********************************************************************
418
Compares the "weight" (or size) of two transactions. Transactions that
419
have edited non-transactional tables are considered heavier than ones
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 */
429
/***********************************************************************
430
Retrieves transacion's id, represented as unsigned long long. */
435
/* out: transaction's id */
436
const trx_t* trx); /* in: transaction */
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" */
442
/***********************************************************************
443
Retrieves transaction's que state in a human readable string. The string
444
should not be free()'d or modified. */
447
trx_get_que_state_str(
448
/*==================*/
449
/* out: string in the data segment */
450
const trx_t* trx); /* in: transaction */
452
/* Signal to a transaction */
453
struct trx_sig_struct{
454
unsigned type:3; /* signal type */
455
unsigned sender:1; /* TRX_SIG_SELF or
456
TRX_SIG_OTHER_SESS */
457
que_thr_t* receiver; /* non-NULL if the sender of the signal
458
wants reply after the operation induced
459
by the signal is completed */
460
trx_savept_t savept; /* possible rollback savepoint */
461
UT_LIST_NODE_T(trx_sig_t)
462
signals; /* queue of pending signals to the
464
UT_LIST_NODE_T(trx_sig_t)
465
reply_signals; /* list of signals for which the sender
466
transaction is waiting a reply */
469
#define TRX_MAGIC_N 91118598
471
/* The transaction handle; every session has a trx object which is freed only
472
when the session is freed; in addition there may be session-less transactions
473
rolling back after a database recovery */
477
/* All the next fields are protected by the kernel mutex, except the
478
undo logs which are protected by undo_mutex */
479
const char* op_info; /* English text describing the
480
current operation, or an empty
482
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
486
of view of concurrency control:
487
TRX_ACTIVE, TRX_COMMITTED_IN_MEMORY,
489
unsigned que_state:2; /* valid when conc_state == TRX_ACTIVE:
490
TRX_QUE_RUNNING, TRX_QUE_LOCK_WAIT,
492
unsigned isolation_level:2;/* TRX_ISO_REPEATABLE_READ, ... */
493
unsigned check_foreigns:1;/* normally TRUE, but if the user
494
wants to suppress foreign key checks,
495
(in table imports, for example) we
497
unsigned check_unique_secondary:1;
498
/* normally TRUE, but if the user
499
wants to speed up inserts by
500
suppressing unique key checks
501
for secondary indexes when we decide
502
if we can use the insert buffer for
503
them, we set this FALSE */
504
unsigned support_xa:1; /* normally we do the XA two-phase
505
commit steps, but by setting this to
506
FALSE, one can save CPU time and about
507
150 bytes in the undo log size as then
509
unsigned flush_log_later:1;/* when we commit the transaction
510
in MySQL's binlog write, we will
511
flush the log to disk later in
513
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
514
trx_commit_off_kernel() if
515
flush_log_later was TRUE, and there
516
were modifications by the transaction;
517
in that case we must flush the log
518
in trx_commit_complete_for_mysql() */
519
unsigned dict_operation:2;/**< @see enum trx_dict_op */
520
unsigned duplicates:2; /* TRX_DUP_IGNORE | TRX_DUP_REPLACE */
521
unsigned active_trans:2; /* 1 - if a transaction in MySQL
522
is active. 2 - if prepare_commit_mutex
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
530
srv_conc_enter_innodb to be inside the
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
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
void* mysql_thd; /* MySQL thread handle corresponding
553
to this trx, or NULL */
554
char** mysql_query_str;/* pointer to the field in mysqld_thd
555
which contains the pointer to the
556
current SQL query string */
557
const char* mysql_log_file_name;
558
/* if MySQL binlog is used, this field
559
contains a pointer to the latest file
560
name; this is NULL if binlog is not
562
ib_int64_t mysql_log_offset;/* if MySQL binlog is used, this field
563
contains the end offset of the binlog
565
os_thread_id_t mysql_thread_id;/* id of the MySQL thread associated
566
with this transaction object */
567
ulint mysql_process_no;/* since in Linux, 'top' reports
568
process id's and not thread id's, we
569
store the process number too */
570
/*------------------------------*/
571
ulint n_mysql_tables_in_use; /* number of Innobase tables
572
used in the processing of the current
573
SQL statement in MySQL */
574
ulint mysql_n_tables_locked;
575
/* how many tables the current SQL
576
statement uses, except those
577
in consistent read */
578
ulint search_latch_timeout;
579
/* If we notice that someone is
580
waiting for our S-lock on the search
581
latch to be released, we wait in
582
row0sel.c for BTR_SEA_TIMEOUT new
583
searches until we try to keep
584
the search latch again over
585
calls from MySQL; this is intended
586
to reduce contention on the search
588
/*------------------------------*/
589
ulint n_tickets_to_enter_innodb;
590
/* this can be > 0 only when
591
declared_to_... is TRUE; when we come
592
to srv_conc_innodb_enter, if the value
593
here is > 0, we decrement this by 1 */
594
/*------------------------------*/
595
lock_t* auto_inc_lock; /* possible auto-inc lock reserved by
596
the transaction; note that it is also
597
in the lock list trx_locks */
598
dict_index_t* new_rec_locks[2];/* these are normally NULL; if
599
srv_locks_unsafe_for_binlog is TRUE
600
or session is using READ COMMITTED
602
in a cursor search, if we set a new
603
record lock on an index, this is set
604
to point to the index; this is
605
used in releasing the locks under the
606
cursors if we are performing an UPDATE
607
and we determine after retrieving
608
the row that it does not need to be
609
locked; thus, these can be used to
610
implement a 'mini-rollback' that
611
releases the latest record locks */
612
UT_LIST_NODE_T(trx_t)
613
trx_list; /* list of transactions */
614
UT_LIST_NODE_T(trx_t)
615
mysql_trx_list; /* list of transactions created for
617
/*------------------------------*/
618
ulint error_state; /* 0 if no error, otherwise error
619
number; NOTE That ONLY the thread
620
doing the transaction is allowed to
621
set this field: this is NOT protected
622
by the kernel mutex */
623
const dict_index_t*error_info; /* if the error number indicates a
624
duplicate key error, a pointer to
625
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
sess_t* sess; /* session of the trx, NULL if none */
630
que_t* graph; /* query currently run in the session,
631
or NULL if none; NOTE that the query
632
belongs to the session, and it can
633
survive over a transaction commit, if
634
it is a stored procedure with a COMMIT
635
WORK statement, for instance */
636
ulint n_active_thrs; /* number of active query threads */
637
que_t* graph_before_signal_handling;
638
/* value of graph when signal handling
639
for this trx started: this is used to
640
return control to the original query
641
graph for error processing */
642
trx_sig_t sig; /* one signal object can be allocated
643
in this space, avoiding mem_alloc */
644
UT_LIST_BASE_NODE_T(trx_sig_t)
645
signals; /* queue of processed or pending
646
signals to the trx */
647
UT_LIST_BASE_NODE_T(trx_sig_t)
648
reply_signals; /* list of signals sent by the query
649
threads of this trx for which a thread
650
is waiting for a reply; if this trx is
651
killed, the reply requests in the list
653
/*------------------------------*/
654
lock_t* wait_lock; /* if trx execution state is
655
TRX_QUE_LOCK_WAIT, this points to
656
the lock request, otherwise this is
658
ibool was_chosen_as_deadlock_victim;
659
/* when the transaction decides to wait
660
for a lock, it sets this to FALSE;
661
if another transaction chooses this
662
transaction as a victim in deadlock
663
resolution, it sets this to TRUE */
664
time_t wait_started; /* lock wait started at this time */
665
UT_LIST_BASE_NODE_T(que_thr_t)
666
wait_thrs; /* query threads belonging to this
667
trx that are in the QUE_THR_LOCK_WAIT
669
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. */
674
/*------------------------------*/
675
mem_heap_t* lock_heap; /* memory heap for the locks of the
677
UT_LIST_BASE_NODE_T(lock_t)
678
trx_locks; /* locks reserved by the transaction */
679
/*------------------------------*/
680
mem_heap_t* global_read_view_heap;
681
/* memory heap for the global read
683
read_view_t* global_read_view;
684
/* consistent read view associated
685
to a transaction or NULL */
686
read_view_t* read_view; /* consistent read view used in the
687
transaction or NULL, this read view
688
if defined can be normal read view
689
associated to a transaction (i.e.
690
same as global_read_view) or read view
691
associated to a cursor */
692
/*------------------------------*/
693
UT_LIST_BASE_NODE_T(trx_named_savept_t)
694
trx_savepoints; /* savepoints set with SAVEPOINT ...,
696
/*------------------------------*/
697
mutex_t undo_mutex; /* mutex protecting the fields in this
698
section (down to undo_no_arr), EXCEPT
699
last_sql_stat_start, which can be
700
accessed only when we know that there
701
cannot be any activity in the undo
703
dulint undo_no; /* next undo log record number to
704
assign; since the undo log is
705
private for a transaction, this
706
is a simple ascending sequence
707
with no gaps; thus it represents
708
the number of modified/inserted
709
rows in a transaction */
710
trx_savept_t last_sql_stat_start;
711
/* undo_no when the last sql statement
712
was started: in case of an error, trx
713
is rolled back down to this undo
714
number; see note at undo_mutex! */
715
trx_rseg_t* rseg; /* rollback segment assigned to the
716
transaction, or NULL if not assigned
718
trx_undo_t* insert_undo; /* pointer to the insert undo log, or
719
NULL if no inserts performed yet */
720
trx_undo_t* update_undo; /* pointer to the update undo log, or
721
NULL if no update performed yet */
722
dulint roll_limit; /* least undo number to undo during
724
ulint pages_undone; /* number of undo log pages undone
725
since the last undo log truncation */
726
trx_undo_arr_t* undo_no_arr; /* array of undo numbers of undo log
727
records which are currently processed
728
by a rollback operation */
729
ulint n_autoinc_rows; /* no. of AUTO-INC rows required for
730
an SQL statement. This is useful for
732
/*------------------------------*/
733
char detailed_error[256]; /* detailed error message for last
737
#define TRX_MAX_N_THREADS 32 /* maximum number of
738
concurrent threads running a
739
single operation of a
740
transaction, e.g., a parallel
742
/* Transaction concurrency states (trx->conc_state) */
743
#define TRX_NOT_STARTED 0
745
#define TRX_COMMITTED_IN_MEMORY 2
746
#define TRX_PREPARED 3 /* Support for 2PC/XA */
748
/* 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 */
754
/* Transaction isolation levels (trx->isolation_level) */
755
#define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking
756
SELECTs are performed so that
757
we do not look at a possible
758
earlier version of a record;
759
thus they are not 'consistent'
760
reads under this isolation
761
level; otherwise like level
764
#define TRX_ISO_READ_COMMITTED 1 /* somewhat Oracle-like
765
isolation, except that in
766
range UPDATE and DELETE we
767
must block phantom rows
769
SELECT ... FOR UPDATE and ...
770
LOCK IN SHARE MODE only lock
771
the index records, NOT the
772
gaps before them, and thus
773
allow free inserting;
774
each consistent read reads its
777
#define TRX_ISO_REPEATABLE_READ 2 /* this is the default;
778
all consistent reads in the
779
same trx read the same
781
full next-key locking used
782
in locking reads to block
783
insertions into gaps */
785
#define TRX_ISO_SERIALIZABLE 3 /* all plain SELECTs are
786
converted to LOCK IN SHARE
789
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
790
Multiple flags can be combined with bitwise OR. */
791
#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
792
#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
795
/* Types of a trx signal */
796
#define TRX_SIG_NO_SIGNAL 0
797
#define TRX_SIG_TOTAL_ROLLBACK 1
798
#define TRX_SIG_ROLLBACK_TO_SAVEPT 2
799
#define TRX_SIG_COMMIT 3
800
#define TRX_SIG_ERROR_OCCURRED 4
801
#define TRX_SIG_BREAK_EXECUTION 5
803
/* Sender types of a signal */
804
#define TRX_SIG_SELF 0 /* sent by the session itself, or
805
by an error occurring within this
807
#define TRX_SIG_OTHER_SESS 1 /* sent by another session (which
808
must hold rights to this) */
810
/* Commit command node in a query graph */
811
struct commit_node_struct{
812
que_common_t common; /* node type: QUE_NODE_COMMIT */
813
ulint state; /* node execution state */
816
/* Commit node states */
817
#define COMMIT_NODE_SEND 1
818
#define COMMIT_NODE_WAIT 2
822
#include "trx0trx.ic"