MySQL 26.7.0
Source Code Documentation
transaction_info.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2026, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef TRANSACTION_INFO_INCLUDED
25#define TRANSACTION_INFO_INCLUDED
26
27#include <stddef.h>
28#include <sys/types.h>
29
30#include "my_alloc.h"
31#include "my_dbug.h"
32#include "my_inttypes.h"
33#include "my_sys.h" // strmake_root
35#include "sql/mdl.h" // MDL_savepoint
36#include "sql/rpl_transaction_ctx.h" // Rpl_transaction_ctx
37#include "sql/rpl_transaction_write_set_ctx.h" // Transaction_write_set_ctx
38#include "sql/xa.h" // XID_STATE
39#include "strmake.h"
40
41class Ha_trx_info;
43class THD;
44struct handlerton;
45
46/**
47 Has the transaction been prepared while logging to binary log.
48 NO, YES - Transaction is 2PC commited between binlog and storage engine.
49 YES - prepare was invoked and prepare is used
50 NO - prepare was invoked and preprare is not used as
51 transaction is not persisted
52 NO_2PC - Transaction is not 2PC between binary log and storage engine,
53 prepare is not invoked
54 */
55enum class Transaction_prepared { NO = 0, YES = 1, NO_2PC = 2 };
56enum class Transaction_flushed { NO = 0, YES = 1, UNSET = 2 };
57
58struct SAVEPOINT {
60 char *name;
61 size_t length;
63 /** State of metadata locks before this savepoint was set. */
65};
66
68 public:
70
72
73 void register_ha(enum_trx_scope scope, Ha_trx_info *ha_info, handlerton *ht);
74
75 public:
76 struct THD_TRANS {
77 /* true is not all entries in the ht[] support 2pc */
80 /* storage engines that registered in this transaction */
82
83 private:
84 /*
85 The purpose of this member variable (i.e. flag) is to keep track of
86 statements which cannot be rolled back safely(completely).
87 For example,
88
89 * statements that modified non-transactional tables. The value
90 MODIFIED_NON_TRANS_TABLE is set within mysql_insert, mysql_update,
91 mysql_delete, etc if a non-transactional table is modified.
92
93 * 'DROP TEMPORARY TABLE' and 'CREATE TEMPORARY TABLE' statements.
94 The former sets the value DROPPED_TEMP_TABLE and the latter
95 the value CREATED_TEMP_TABLE.
96
97 The tracked statements are modified in scope of:
98
99 * transaction, when the variable is a member of
100 THD::m_transaction.m_scope_info[SESSION]
101
102 * top-level statement or sub-statement, when the variable is a
103 member of THD::m_transaction.m_scope_info[STMT]
104
105 This member has the following life cycle:
106
107 * m_scope_info[STMT].m_unsafe_rollback_flags is used to keep track of
108 top-level statements which cannot be rolled back safely. At the end of the
109 statement, the value of m_scope_info[STMT].m_unsafe_rollback_flags is
110 merged with m_scope_info[SESSION].m_unsafe_rollback_flags
111 and gets reset.
112
113 * m_scope_info[SESSION].cannot_safely_rollback is reset at the end
114 of transaction
115
116 * Since we do not have a dedicated context for execution of
117 a sub-statement, to keep track of non-transactional changes in a
118 sub-statement, we re-use m_scope_info[STMT].m_unsafe_rollback_flags.
119 At entrance into a sub-statement, a copy of the value of
120 m_scope_info[STMT].m_unsafe_rollback_flags (containing the changes of the
121 outer statement) is saved on stack.
122 Then m_scope_info[STMT].m_unsafe_rollback_flags is reset to 0 and the
123 substatement is executed. Then the new value is merged
124 with the saved value.
125 */
126
128 /*
129 Define the type of statements which cannot be rolled back safely.
130 Each type occupies one bit in m_unsafe_rollback_flags.
131 */
132 static unsigned int const MODIFIED_NON_TRANS_TABLE = 0x01;
133 static unsigned int const CREATED_TEMP_TABLE = 0x02;
134 static unsigned int const DROPPED_TEMP_TABLE = 0x04;
135
136 public:
138 unsigned int get_unsafe_rollback_flags() const {
140 }
141 void set_unsafe_rollback_flags(unsigned int flags) {
142 DBUG_PRINT("debug", ("set_unsafe_rollback_flags: %u", flags));
144 }
145 void add_unsafe_rollback_flags(unsigned int flags) {
146 DBUG_PRINT("debug", ("add_unsafe_rollback_flags: %u", flags));
148 }
150 DBUG_PRINT("debug", ("reset_unsafe_rollback_flags"));
152 }
154 DBUG_PRINT("debug", ("mark_modified_non_trans_table"));
156 }
159 }
161 DBUG_PRINT("debug", ("mark_created_temp_table"));
163 }
166 }
168 DBUG_PRINT("debug", ("mark_dropped_temp_table"));
170 }
173 }
174
175 void reset() {
176 m_no_2pc = false;
177 m_rw_ha_count = 0;
179 }
180 bool is_empty() const { return m_ha_list == nullptr; }
181 };
182
183 private:
185
187
188 MEM_ROOT m_mem_root; // Transaction-life memory allocation pool
189
190 public:
191 /*
192 (Mostly) binlog-specific fields use while flushing the caches
193 and committing transactions.
194 We don't use bitfield any more in the struct. Modification will
195 be lost when concurrently updating multiple bit fields. It will
196 cause a race condition in a multi-threaded application. And we
197 already caught a race condition case between xid_written and
198 ready_preempt in MYSQL_BIN_LOG::ordered_commit.
199 */
200 struct {
201 bool enabled{false}; // see ha_enable_transaction()
202 bool xid_written{false}; // The session wrote an XID
203 bool real_commit{false}; // Is this a "real" commit?
204 bool commit_low{false}; // see MYSQL_BIN_LOG::ordered_commit
205 bool run_hooks{false}; // Call the after_commit hook
206#ifndef NDEBUG
207 bool ready_preempt{false}; // internal in MYSQL_BIN_LOG::ordered_commit
208#endif
210 /* Binlog-specific logical timestamps. */
211 /*
212 Store for the transaction's commit parent sequence_number.
213 The value specifies this transaction dependency with a "parent"
214 transaction.
215 The member is assigned, when the transaction is about to commit
216 in binlog to a value of the last committed transaction's sequence_number.
217 This and last_committed as numbers are kept ever incremented
218 regardless of binary logs being rotated or when transaction
219 is logged in multiple pieces.
220 However the logger to the binary log may convert them
221 according to its specification.
222 */
224 /*
225 The transaction's private logical timestamp assigned at the
226 transaction prepare phase. The timestamp enumerates transactions
227 in the binary log. The value is gained through incrementing (stepping) a
228 global clock.
229 Eventually the value is considered to increase max_committed_transaction
230 system clock when the transaction has committed.
231 */
233
234 void store_commit_parent(int64 last_arg) { last_committed = last_arg; }
235
238
239 void cleanup() {
241 m_savepoints = nullptr;
247
248 // Reset the flag indicating the warning of mixing transactional engine
249 // with non-transactional engine is always emitted per transaction
251
252 /// Clear the registered engine
254 return;
255 }
256
257 void cleanup_transaction();
258
259 bool is_active(enum_trx_scope scope) const {
260 return m_scope_info[scope].m_ha_list != nullptr;
261 }
262
264
266 /*
267 Merge m_scope_info[STMT].unsafe_rollback_flags to
268 m_scope_info[SESSION].unsafe_rollback_flags. If the statement
269 cannot be rolled back safely, the transaction including
270 this statement definitely cannot rolled back safely.
271 */
274 }
275
276 void init_mem_root_defaults(ulong trans_alloc_block_size, ulong) {
277 m_mem_root.set_block_size(trans_alloc_block_size);
278 }
279
281
282 void *allocate_memory(unsigned int size) { return m_mem_root.Alloc(size); }
283
284 void claim_memory_ownership(bool claim) { m_mem_root.Claim(claim); }
285
287
288 char *strmake(const char *str, size_t len) {
289 return strmake_root(&m_mem_root, str, len);
290 }
291
293
294 void add_changed_table(const char *key, uint32 key_length);
295
297
300 m_scope_info[scope].m_ha_list = trx_info;
301 return;
302 }
303
305
306 const XID_STATE *xid_state() const { return &m_xid_state; }
307
309 return m_scope_info[scope].cannot_safely_rollback();
310 }
311
312 unsigned int get_unsafe_rollback_flags(enum_trx_scope scope) const {
314 }
315
318 }
319
322 }
323
326 }
327
330 }
331
334 }
335
338 }
339
341 return m_scope_info[scope].has_created_temp_table();
342 }
343
346 }
347
349 return m_scope_info[scope].has_dropped_temp_table();
350 }
351
352 void reset(enum_trx_scope scope) { m_scope_info[scope].reset(); }
353
354 bool is_empty(enum_trx_scope scope) const {
355 return m_scope_info[scope].is_empty();
356 }
357
358 void set_no_2pc(enum_trx_scope scope, bool value) {
359 m_scope_info[scope].m_no_2pc = value;
360 }
361
362 bool no_2pc(enum_trx_scope scope) const {
363 return m_scope_info[scope].m_no_2pc;
364 }
365
366 int rw_ha_count(enum_trx_scope scope) const {
367 return m_scope_info[scope].m_rw_ha_count;
368 }
369
372 }
373
376 m_scope_info[scope].m_ha_list = nullptr;
377 m_scope_info[scope].m_no_2pc = false;
378 m_scope_info[scope].m_rw_ha_count = 0;
379 return;
380 }
381
383 return &m_rpl_transaction_ctx;
384 }
385
387 return &m_rpl_transaction_ctx;
388 }
389
392 }
393
396 }
397
399
401
402 private:
406
407 public:
411};
412
413/**
414 Either statement transaction or normal transaction - related
415 thread-specific storage engine data.
416
417 If a storage engine participates in a statement/transaction,
418 an instance of this class is present in
419 thd->m_transaction.m_scope_info[STMT|SESSION].ha_list. The addition
420 this list is made by trans_register_ha().
421
422 When it's time to commit or rollback, each element of ha_list
423 is used to access storage engine's prepare()/commit()/rollback()
424 methods, and also to evaluate if a full two phase commit is
425 necessary.
426
427 @sa General description of transaction handling in handler.cc.
428*/
429
431 public:
432 friend class Ha_trx_info_list;
433
434 /**
435 Register this storage engine in the given transaction context.
436 */
439 assert(m_flags == 0);
440 assert(m_ht == nullptr);
441 assert(m_next == nullptr);
442
443 m_ht = ht_arg;
444 m_flags = (int)TRX_READ_ONLY; /* Assume read-only at start. */
445
446 if (trans->m_ha_list != this) {
447 m_next = trans->m_ha_list;
448 trans->m_ha_list = this;
449 }
450
451 return;
452 }
453
454 /**
455 Clear, prepare for reuse.
456 */
457
458 void reset() {
460 m_next = nullptr;
461 m_ht = nullptr;
462 m_flags = 0;
463 return;
464 }
465
467
469 assert(is_started());
470 m_flags |= (int)TRX_READ_WRITE;
471 }
472
473 bool is_trx_read_write() const {
474 assert(is_started());
475 return m_flags & (int)TRX_READ_WRITE;
476 }
477
478 bool is_started() const { return m_ht != nullptr; }
479
480 /**
481 Mark this transaction read-write if the argument is read-write.
482 */
483
484 void coalesce_trx_with(const Ha_trx_info *stmt_trx) {
485 this->coalesce_trx_with(*stmt_trx);
486 }
487
488 void coalesce_trx_with(const Ha_trx_info &stmt_trx) {
489 /*
490 Must be called only after the transaction has been started.
491 Can be called many times, e.g. when we have many
492 read-write statements in a transaction.
493 */
494 assert(is_started());
495 if (stmt_trx.is_trx_read_write()) set_trx_read_write();
496 }
497
498 handlerton *ht() const {
499 assert(is_started());
500 return m_ht;
501 }
502
503 private:
504 enum { TRX_READ_ONLY = 0, TRX_READ_WRITE = 1 };
505 /**
506 Auxiliary, used for ha_list management
507 */
509
510 /**
511 Although a given Ha_trx_info instance is currently always used
512 for the same storage engine, 'ht' is not-NULL only when the
513 corresponding storage is a part of a transaction.
514 */
516
517 /**
518 Transaction flags related to this engine.
519 Not-null only if this instance is a part of transaction.
520 May assume a combination of enum values above.
521 */
523};
524
525/**
526 @class Ha_trx_info_list
527
528 Container to hold and allow iteration over a set of Ha_trx_info objects.
529 */
531 public:
532 /**
533 @class Iterator
534
535 Implements a forward iterator for `Ha_trx_info_list`. The
536 `Ha_trx_info_list` methods `begin` and `end` complete the requirements
537 for algorithms usage.
538
539 Since the container this iterator targets is a linked-list where the
540 list and the list elements are the same, the invalidation rules are not
541 the ones usually encontered in iterator classes. Invoking
542 `Ha_trx_info::reset()`, which clears the pointer to next element in the
543 list, doesn't invalidate the iterator, instead the pointer reference is
544 kept by the iterator in order to allow the requirements for forward
545 iterating to be valid. Therefore, although `Ha_trx_info::reset()`
546 removes the element from the list, the iterator is no invalidated and
547 iteration over the rest of the element is kept.
548 */
549 class Iterator {
550 public:
551 using difference_type = std::ptrdiff_t;
554 using iterator_category = std::forward_iterator_tag;
555
556 Iterator(Ha_trx_info *parent);
557 Iterator(std::nullptr_t);
558 Iterator(Iterator const &rhs);
559 virtual ~Iterator() = default;
560
561 // BASIC ITERATOR METHODS //
562 Iterator &operator=(const Iterator &rhs);
564 reference operator*() const;
565 // END / BASIC ITERATOR METHODS //
566
567 // INPUT ITERATOR METHODS //
568 Iterator operator++(int);
569 pointer operator->() const;
570 bool operator==(Iterator const &rhs) const;
571 bool operator==(Ha_trx_info const *rhs) const;
572 bool operator==(Ha_trx_info const &rhs) const;
573 bool operator!=(Iterator const &rhs) const;
574 bool operator!=(Ha_trx_info const *rhs) const;
575 bool operator!=(Ha_trx_info const &rhs) const;
576 // END / INPUT ITERATOR METHODS //
577
578 // OUTPUT ITERATOR METHODS //
579 // reference operator*() const; <- already defined
580 // iterator operator++(int); <- already defined
581 // END / OUTPUT ITERATOR METHODS //
582
583 // FORWARD ITERATOR METHODS //
584 // Enable support for both input and output iterator
585 // END / FORWARD ITERATOR METHODS //
586
587 private:
588 /** Item this iterator is currently pointing to */
590 /** Next item in the list */
592
594 };
595
596 /**
597 Default constructor.
598 */
599 Ha_trx_info_list() = default;
600 /**
601 Class constructor that instantiates the underlying head of the list
602 with the parameter.
603
604 @param rhs The pointer to initialize the underlying list head with.
605 */
607 /**
608 Copy constructor.
609
610 @param rhs The object instance to copy content from.
611 */
613 /**
614 Move constructor.
615
616 @param rhs The object instance to move content from.
617 */
619 virtual ~Ha_trx_info_list() = default;
620
621 /**
622 Copy operator.
623
624 @param rhs The object instance to copy content from.
625
626 @return this object reference, for chaining puposes.
627 */
629 /**
630 Move operator.
631
632 @param rhs The object instance to move content from.
633
634 @return this object reference, for chaining puposes.
635 */
637 /**
638 Retrieves the reference to the undelying head of the list.
639
640 @return The reference to the undelying head of the list.
641 */
643 /**
644 Retrieves the reference to the undelying head of the list.
645
646 @return The reference to the undelying head of the list.
647 */
648 Ha_trx_info const &operator*() const;
649 /**
650 Retrieves the pointer to the undelying head of the list.
651
652 @return The pointer to the undelying head of the list.
653 */
655 /**
656 Retrieves the pointer to the undelying head of the list.
657
658 @return The pointer to the undelying head of the list.
659 */
660 Ha_trx_info const *operator->() const;
661 /**
662 Equality operator that compares with another instance of this class. It
663 evaluates to true if both object's underlying head point to the same
664 address.
665
666 @param rhs The object to compare this object to.
667
668 @return true if both object's underlying head point to the same
669 address, false otherwise.
670 */
671 bool operator==(Ha_trx_info_list const &rhs) const;
672 /**
673 Equality operator that compares with an instance of Ha_trx_info
674 class. It evaluates to true if this object's underlying head points to
675 the same address of the parameter object.
676
677 @param rhs The object to compare this object to.
678
679 @return true if this object's underlying head point to the same address
680 as the parameter object, false otherwise.
681 */
682 bool operator==(Ha_trx_info const *rhs) const;
683 /**
684 Equality operator that compares with null. It evaluates to true if this
685 object's underlying head points to null.
686
687 @param rhs The `nullptr` value
688
689 @return true if this object's underlying head point to null, false
690 otherwise.
691 */
692 bool operator==(std::nullptr_t rhs) const;
693 /**
694 Inequality operator that compares with another instance of this
695 class. It evaluates to true if both object's underlying head point to
696 the different addresses.
697
698 @param rhs The object to compare this object to.
699
700 @return true if both object's underlying head point to different
701 addresses, false otherwise.
702 */
703 bool operator!=(Ha_trx_info_list const &rhs) const;
704 /**
705 Inequality operator that compares with an instance of Ha_trx_info
706 class. It evaluates to true if this object's underlying head points to
707 a different address of the parameter object.
708
709 @param rhs The object to compare this object to.
710
711 @return true if this object's underlying head point to different
712 address as the parameter object, false otherwise.
713 */
714 bool operator!=(Ha_trx_info const *rhs) const;
715 /**
716 Inequality operator that compares with null. It evaluates to true if
717 this object's underlying head points to a non-null value.
718
719 @param rhs The `nullptr` value
720
721 @return true if this object's underlying head point to a non-null
722 value, false otherwise.
723 */
724 bool operator!=(std::nullptr_t rhs) const;
725 /**
726 Cast operator to `bool`. It returns true if the this object underlying
727 list head doesn't point to null, false otherwise.
728
729 @return true if the this object underlying list head doesn't point to
730 null, false otherwise.
731 */
732 operator bool() const;
733 /**
734 Retrieves the pointer to the underlying list head.
735
736 @return The underlying list head.
737 */
738 Ha_trx_info *head();
739 /**
740 Retrieves an iterator pointing to the underlying list head.
741
742 @return An iterator pointing to the underlying list head.
743 */
744 Iterator begin();
745 /**
746 Retrieves an iterator pointing to the underlying list head.
747
748 @return An iterator pointing to the underlying list head.
749 */
750 const Iterator begin() const;
751 /**
752 Retrieves an iterator pointing to null.
753
754 @return An iterator pointing null.
755 */
756 Iterator end();
757 /**
758 Retrieves an iterator pointing to null.
759
760 @return An iterator pointing null.
761 */
762 const Iterator end() const;
763
764 private:
765 /** The head of the list */
767};
768
769#endif
Definition: engine_combination_tracker.h:27
void clear_known_engine()
This method clear the registered engine in the variable m_known_engine.
Definition: engine_combination_tracker.cc:57
void set_warning_already_emitted(bool value)
This method sets the value of is_warning_already_emitted.
Definition: engine_combination_tracker.cc:65
Implements a forward iterator for Ha_trx_info_list.
Definition: transaction_info.h:549
Ha_trx_info * m_current
Item this iterator is currently pointing to
Definition: transaction_info.h:589
virtual ~Iterator()=default
Iterator & set_next()
Definition: transaction_info.cc:153
reference operator*() const
Definition: transaction_info.cc:113
Iterator & operator=(const Iterator &rhs)
Definition: transaction_info.cc:99
std::ptrdiff_t difference_type
Definition: transaction_info.h:551
Iterator(Ha_trx_info *parent)
Definition: transaction_info.cc:91
std::forward_iterator_tag iterator_category
Definition: transaction_info.h:554
pointer operator->() const
Definition: transaction_info.cc:124
bool operator==(Iterator const &rhs) const
Definition: transaction_info.cc:129
Iterator & operator++()
Definition: transaction_info.cc:106
bool operator!=(Iterator const &rhs) const
Definition: transaction_info.cc:141
Ha_trx_info * m_next
Next item in the list
Definition: transaction_info.h:591
Container to hold and allow iteration over a set of Ha_trx_info objects.
Definition: transaction_info.h:530
Ha_trx_info_list & operator=(Ha_trx_info_list const &rhs)
Copy operator.
Definition: transaction_info.cc:168
Iterator end()
Retrieves an iterator pointing to null.
Definition: transaction_info.cc:229
Ha_trx_info * operator->()
Retrieves the pointer to the undelying head of the list.
Definition: transaction_info.cc:185
bool operator==(Ha_trx_info_list const &rhs) const
Equality operator that compares with another instance of this class.
Definition: transaction_info.cc:191
virtual ~Ha_trx_info_list()=default
Ha_trx_info & operator*()
Retrieves the reference to the undelying head of the list.
Definition: transaction_info.cc:179
Ha_trx_info * m_underlying
The head of the list.
Definition: transaction_info.h:766
Ha_trx_info * head()
Retrieves the pointer to the underlying list head.
Definition: transaction_info.cc:219
bool operator!=(Ha_trx_info_list const &rhs) const
Inequality operator that compares with another instance of this class.
Definition: transaction_info.cc:203
Ha_trx_info_list()=default
Default constructor.
Iterator begin()
Retrieves an iterator pointing to the underlying list head.
Definition: transaction_info.cc:221
Either statement transaction or normal transaction - related thread-specific storage engine data.
Definition: transaction_info.h:430
void coalesce_trx_with(const Ha_trx_info &stmt_trx)
Definition: transaction_info.h:488
handlerton * ht() const
Definition: transaction_info.h:498
bool is_started() const
Definition: transaction_info.h:478
handlerton * m_ht
Although a given Ha_trx_info instance is currently always used for the same storage engine,...
Definition: transaction_info.h:515
@ TRX_READ_WRITE
Definition: transaction_info.h:504
@ TRX_READ_ONLY
Definition: transaction_info.h:504
bool is_trx_read_write() const
Definition: transaction_info.h:473
Ha_trx_info * m_next
Auxiliary, used for ha_list management.
Definition: transaction_info.h:508
void reset()
Clear, prepare for reuse.
Definition: transaction_info.h:458
void set_trx_read_write()
Definition: transaction_info.h:468
Ha_trx_info()
Definition: transaction_info.h:466
void coalesce_trx_with(const Ha_trx_info *stmt_trx)
Mark this transaction read-write if the argument is read-write.
Definition: transaction_info.h:484
void register_ha(Transaction_ctx::THD_TRANS *trans, handlerton *ht_arg)
Register this storage engine in the given transaction context.
Definition: transaction_info.h:437
uchar m_flags
Transaction flags related to this engine.
Definition: transaction_info.h:522
Savepoint for MDL context.
Definition: mdl.h:1320
Server side support to provide a service to plugins to report if a given transaction should continue ...
Definition: rpl_transaction_ctx.h:36
void cleanup()
Reset transaction context to default values.
Definition: rpl_transaction_ctx.cc:42
Thread class responsible for the collection of write sets associated to a transaction.
Definition: rpl_transaction_write_set_ctx.h:101
void reset_state()
Reset the object so it can be used for a new transaction.
Definition: rpl_transaction_write_set_ctx.cc:103
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Definition: transaction_info.h:67
void set_rw_ha_count(enum_trx_scope scope, int value)
Definition: transaction_info.h:370
void merge_unsafe_rollback_flags()
Definition: transaction_info.h:265
Rpl_transaction_write_set_ctx m_transaction_write_set_ctx
Definition: transaction_info.h:404
bool has_created_temp_table(enum_trx_scope scope) const
Definition: transaction_info.h:340
bool is_active(enum_trx_scope scope) const
Definition: transaction_info.h:259
void * allocate_memory(unsigned int size)
Definition: transaction_info.h:282
bool cannot_safely_rollback(enum_trx_scope scope) const
Definition: transaction_info.h:308
bool enabled
Definition: transaction_info.h:201
char * strmake(const char *str, size_t len)
Definition: transaction_info.h:288
void register_ha(enum_trx_scope scope, Ha_trx_info *ha_info, handlerton *ht)
Definition: transaction_info.cc:82
virtual ~Transaction_ctx()
Definition: transaction_info.h:237
bool was_trans_begin_hook_invoked()
Definition: transaction_info.h:398
bool no_2pc(enum_trx_scope scope) const
Definition: transaction_info.h:362
void set_trans_begin_hook_invoked()
Definition: transaction_info.h:400
MEM_ROOT m_mem_root
Definition: transaction_info.h:188
SAVEPOINT * m_savepoints
Definition: transaction_info.h:71
int64 last_committed
Definition: transaction_info.h:223
bool real_commit
Definition: transaction_info.h:203
void reset_unsafe_rollback_flags(enum_trx_scope scope)
Definition: transaction_info.h:324
Transaction_ctx()
Definition: transaction_info.cc:43
void push_unsafe_rollback_warnings(THD *thd)
Definition: transaction_info.cc:63
XID_STATE * xid_state()
Definition: transaction_info.h:304
const Rpl_transaction_write_set_ctx * get_transaction_write_set_ctx() const
Definition: transaction_info.h:394
bool run_hooks
Definition: transaction_info.h:205
bool commit_low
Definition: transaction_info.h:204
XID_STATE m_xid_state
Definition: transaction_info.h:186
void reset(enum_trx_scope scope)
Definition: transaction_info.h:352
int64 sequence_number
Definition: transaction_info.h:232
void init_mem_root_defaults(ulong trans_alloc_block_size, ulong)
Definition: transaction_info.h:276
const Rpl_transaction_ctx * get_rpl_transaction_ctx() const
Definition: transaction_info.h:386
void store_commit_parent(int64 last_arg)
Definition: transaction_info.h:234
int rw_ha_count(enum_trx_scope scope) const
Definition: transaction_info.h:366
struct Transaction_ctx::@196 m_flags
void add_changed_table(const char *key, uint32 key_length)
bool trans_begin_hook_invoked
Definition: transaction_info.h:405
void set_unsafe_rollback_flags(enum_trx_scope scope, unsigned int flags)
Definition: transaction_info.h:316
Transaction_flushed m_transaction_flushed
Definition: transaction_info.h:410
const XID_STATE * xid_state() const
Definition: transaction_info.h:306
bool xid_written
Definition: transaction_info.h:202
void claim_memory_ownership(bool claim)
Definition: transaction_info.h:284
Rpl_transaction_write_set_ctx * get_transaction_write_set_ctx()
Definition: transaction_info.h:390
Ha_trx_info_list ha_trx_info(enum_trx_scope scope)
Definition: transaction_info.cc:87
void cleanup_transaction()
Definition: transaction_info.cc:58
unsigned int get_unsafe_rollback_flags(enum_trx_scope scope) const
Definition: transaction_info.h:312
Transaction_prepared m_transaction_prepared
Definition: transaction_info.h:409
void mark_modified_non_trans_table(enum_trx_scope scope)
Definition: transaction_info.h:328
void reset_scope(enum_trx_scope scope)
Definition: transaction_info.h:374
void free_memory()
Definition: transaction_info.h:286
void invalidate_changed_tables_in_cache(THD *thd)
Engine_combination_tracker tracker
Definition: transaction_info.h:408
void add_unsafe_rollback_flags(enum_trx_scope scope, unsigned int flags)
Definition: transaction_info.h:320
void cleanup()
Definition: transaction_info.h:239
void mark_created_temp_table(enum_trx_scope scope)
Definition: transaction_info.h:336
void set_no_2pc(enum_trx_scope scope, bool value)
Definition: transaction_info.h:358
bool has_dropped_temp_table(enum_trx_scope scope) const
Definition: transaction_info.h:348
bool has_modified_non_trans_table(enum_trx_scope scope) const
Definition: transaction_info.h:332
bool ready_preempt
Definition: transaction_info.h:207
void mark_dropped_temp_table(enum_trx_scope scope)
Definition: transaction_info.h:344
Rpl_transaction_ctx m_rpl_transaction_ctx
Definition: transaction_info.h:403
THD_TRANS m_scope_info[2]
Definition: transaction_info.h:184
void set_ha_trx_info(enum_trx_scope scope, Ha_trx_info *trx_info)
Definition: transaction_info.h:298
Rpl_transaction_ctx * get_rpl_transaction_ctx()
Definition: transaction_info.h:382
bool is_empty(enum_trx_scope scope) const
Definition: transaction_info.h:354
enum_trx_scope
Definition: transaction_info.h:69
@ SESSION
Definition: transaction_info.h:69
@ STMT
Definition: transaction_info.h:69
MEM_ROOT * transaction_memroot()
Definition: transaction_info.h:280
Definition: xa.h:295
void cleanup()
Definition: xa.h:365
char * strmake_root(MEM_ROOT *root, const char *str, size_t len)
Definition: my_alloc.cc:287
static int flags[50]
Definition: hp_test1.cc:40
This file follows Google coding style, except for the name MEM_ROOT (which is kept for historical rea...
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
#define DBUG_TRACE
Definition: my_dbug.h:146
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
int64_t int64
Definition: my_inttypes.h:68
uint32_t uint32
Definition: my_inttypes.h:67
Common header for many mysys elements.
static HashTable ht
Definition: mysql.cc:162
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1077
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
size_t size(const char *const c)
Definition: base64.h:46
required string key
Definition: replication_asynchronous_connection_failover.proto:60
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
void Claim(bool claim)
Claim all the allocated memory for the current thread in the performance schema.
Definition: my_alloc.cc:223
void set_block_size(size_t block_size)
Set the desired size of the next block to be allocated.
Definition: my_alloc.h:292
void Clear()
Deallocate all the RAM used.
Definition: my_alloc.cc:172
void ClearForReuse()
Similar to Clear(), but anticipates that the block will be reused for further allocations.
Definition: my_alloc.cc:190
void * Alloc(size_t length)
Allocate memory.
Definition: my_alloc.h:145
Definition: transaction_info.h:58
size_t length
Definition: transaction_info.h:61
char * name
Definition: transaction_info.h:60
Ha_trx_info * ha_list
Definition: transaction_info.h:62
SAVEPOINT * prev
Definition: transaction_info.h:59
MDL_savepoint mdl_savepoint
State of metadata locks before this savepoint was set.
Definition: transaction_info.h:64
Definition: transaction_info.h:76
void add_unsafe_rollback_flags(unsigned int flags)
Definition: transaction_info.h:145
void mark_modified_non_trans_table()
Definition: transaction_info.h:153
bool has_modified_non_trans_table() const
Definition: transaction_info.h:157
void mark_dropped_temp_table()
Definition: transaction_info.h:167
bool m_no_2pc
Definition: transaction_info.h:78
unsigned int get_unsafe_rollback_flags() const
Definition: transaction_info.h:138
static unsigned int const DROPPED_TEMP_TABLE
Definition: transaction_info.h:134
void reset_unsafe_rollback_flags()
Definition: transaction_info.h:149
bool is_empty() const
Definition: transaction_info.h:180
bool cannot_safely_rollback() const
Definition: transaction_info.h:137
void mark_created_temp_table()
Definition: transaction_info.h:160
void set_unsafe_rollback_flags(unsigned int flags)
Definition: transaction_info.h:141
Ha_trx_info * m_ha_list
Definition: transaction_info.h:81
int m_rw_ha_count
Definition: transaction_info.h:79
bool has_dropped_temp_table() const
Definition: transaction_info.h:171
static unsigned int const MODIFIED_NON_TRANS_TABLE
Definition: transaction_info.h:132
static unsigned int const CREATED_TEMP_TABLE
Definition: transaction_info.h:133
unsigned int m_unsafe_rollback_flags
Definition: transaction_info.h:127
void reset()
Definition: transaction_info.h:175
bool has_created_temp_table() const
Definition: transaction_info.h:164
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2852
Transaction_prepared
Has the transaction been prepared while logging to binary log.
Definition: transaction_info.h:55
Transaction_flushed
Definition: transaction_info.h:56