466
483
struct trx_struct{
468
/* All the next fields are protected by the kernel mutex, except the
469
undo logs which are protected by undo_mutex */
486
/* These fields are not protected by any mutex. */
470
487
const char* op_info; /*!< English text describing the
471
488
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
490
ulint conc_state; /*!< state of the trx from the point
477
491
of view of concurrency control:
478
492
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
494
ulint isolation_level;/* TRX_ISO_REPEATABLE_READ, ... */
495
ulint check_foreigns; /* normally TRUE, but if the user
485
496
wants to suppress foreign key checks,
486
497
(in table imports, for example) we
487
498
set this FALSE */
488
unsigned check_unique_secondary:1;
499
ulint check_unique_secondary;
489
500
/* normally TRUE, but if the user
490
501
wants to speed up inserts by
491
502
suppressing unique key checks
492
503
for secondary indexes when we decide
493
504
if we can use the insert buffer for
494
505
them, we set this FALSE */
495
unsigned support_xa:1; /*!< normally we do the XA two-phase
506
ulint support_xa; /*!< normally we do the XA two-phase
496
507
commit steps, but by setting this to
497
508
FALSE, one can save CPU time and about
498
509
150 bytes in the undo log size as then
499
510
we skip XA steps */
500
unsigned flush_log_later:1;/* In 2PC, we hold the
511
ulint flush_log_later;/* In 2PC, we hold the
501
512
prepare_commit mutex across
502
513
both phases. In that case, we
503
514
defer flush of the logs to disk
504
515
until after we release the
506
unsigned must_flush_log_later:1;/* this flag is set to TRUE in
517
ulint must_flush_log_later;/* this flag is set to TRUE in
507
518
trx_commit_off_kernel() if
508
519
flush_log_later was TRUE, and there
509
520
were modifications by the transaction;
510
521
in that case we must flush the log
511
522
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 active_trans:2; /*!< 1 - if a transaction in MySQL
523
ulint duplicates; /*!< TRX_DUP_IGNORE | TRX_DUP_REPLACE */
524
ulint active_trans; /*!< 1 - if a transaction in MySQL
515
525
is active. 2 - if prepare_commit_mutex
517
unsigned has_search_latch:1;
527
ulint has_search_latch;
518
528
/* TRUE if this trx has latched the
519
529
search system latch in S-mode */
520
unsigned declared_to_be_inside_innodb:1;
530
ulint deadlock_mark; /*!< a mark field used in deadlock
531
checking algorithm. */
532
trx_dict_op_t dict_operation; /**< @see enum trx_dict_op */
534
/* Fields protected by the srv_conc_mutex. */
535
ulint declared_to_be_inside_innodb;
521
536
/* this is TRUE if we have declared
522
537
this transaction in
523
538
srv_conc_enter_innodb to be inside the
525
unsigned handling_signals:1;/* this is TRUE as long as the trx
526
is handling signals */
527
unsigned dict_operation_lock_mode:2;
528
/* 0, RW_S_LATCH, or RW_X_LATCH:
541
/* Fields protected by dict_operation_lock. The very latch
542
it is used to track. */
543
ulint dict_operation_lock_mode;
544
/*!< 0, RW_S_LATCH, or RW_X_LATCH:
529
545
the latch mode trx currently holds
530
546
on dict_operation_lock */
548
/* All the next fields are protected by the kernel mutex, except the
549
undo logs which are protected by undo_mutex */
550
ulint is_purge; /*!< 0=user transaction, 1=purge */
551
ulint is_recovered; /*!< 0=normal transaction,
552
1=recovered, must be rolled back */
553
ulint que_state; /*!< valid when conc_state
554
== TRX_ACTIVE: TRX_QUE_RUNNING,
555
TRX_QUE_LOCK_WAIT, ... */
556
ulint handling_signals;/* this is TRUE as long as the trx
557
is handling signals */
531
558
time_t start_time; /*!< time the trx object was created
532
559
or the state last time became