MySQL 8.4.2
Source Code Documentation
transaction_info.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, 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
34#include "sql/mdl.h" // MDL_savepoint
35#include "sql/rpl_transaction_ctx.h" // Rpl_transaction_ctx
36#include "sql/rpl_transaction_write_set_ctx.h" // Transaction_write_set_ctx
37#include "sql/xa.h" // XID_STATE
38#include "strmake.h"
39
40class Ha_trx_info;
42class THD;
43struct handlerton;
44
45struct SAVEPOINT {
47 char *name;
48 size_t length;
50 /** State of metadata locks before this savepoint was set. */
52};
53
55 public:
57
59
60 void register_ha(enum_trx_scope scope, Ha_trx_info *ha_info, handlerton *ht);
61
62 public:
63 struct THD_TRANS {
64 /* true is not all entries in the ht[] support 2pc */
67 /* storage engines that registered in this transaction */
69
70 private:
71 /*
72 The purpose of this member variable (i.e. flag) is to keep track of
73 statements which cannot be rolled back safely(completely).
74 For example,
75
76 * statements that modified non-transactional tables. The value
77 MODIFIED_NON_TRANS_TABLE is set within mysql_insert, mysql_update,
78 mysql_delete, etc if a non-transactional table is modified.
79
80 * 'DROP TEMPORARY TABLE' and 'CREATE TEMPORARY TABLE' statements.
81 The former sets the value DROPPED_TEMP_TABLE and the latter
82 the value CREATED_TEMP_TABLE.
83
84 The tracked statements are modified in scope of:
85
86 * transaction, when the variable is a member of
87 THD::m_transaction.m_scope_info[SESSION]
88
89 * top-level statement or sub-statement, when the variable is a
90 member of THD::m_transaction.m_scope_info[STMT]
91
92 This member has the following life cycle:
93
94 * m_scope_info[STMT].m_unsafe_rollback_flags is used to keep track of
95 top-level statements which cannot be rolled back safely. At the end of the
96 statement, the value of m_scope_info[STMT].m_unsafe_rollback_flags is
97 merged with m_scope_info[SESSION].m_unsafe_rollback_flags
98 and gets reset.
99
100 * m_scope_info[SESSION].cannot_safely_rollback is reset at the end
101 of transaction
102
103 * Since we do not have a dedicated context for execution of
104 a sub-statement, to keep track of non-transactional changes in a
105 sub-statement, we re-use m_scope_info[STMT].m_unsafe_rollback_flags.
106 At entrance into a sub-statement, a copy of the value of
107 m_scope_info[STMT].m_unsafe_rollback_flags (containing the changes of the
108 outer statement) is saved on stack.
109 Then m_scope_info[STMT].m_unsafe_rollback_flags is reset to 0 and the
110 substatement is executed. Then the new value is merged
111 with the saved value.
112 */
113
115 /*
116 Define the type of statements which cannot be rolled back safely.
117 Each type occupies one bit in m_unsafe_rollback_flags.
118 */
119 static unsigned int const MODIFIED_NON_TRANS_TABLE = 0x01;
120 static unsigned int const CREATED_TEMP_TABLE = 0x02;
121 static unsigned int const DROPPED_TEMP_TABLE = 0x04;
122
123 public:
125 unsigned int get_unsafe_rollback_flags() const {
127 }
128 void set_unsafe_rollback_flags(unsigned int flags) {
129 DBUG_PRINT("debug", ("set_unsafe_rollback_flags: %u", flags));
131 }
132 void add_unsafe_rollback_flags(unsigned int flags) {
133 DBUG_PRINT("debug", ("add_unsafe_rollback_flags: %u", flags));
135 }
137 DBUG_PRINT("debug", ("reset_unsafe_rollback_flags"));
139 }
141 DBUG_PRINT("debug", ("mark_modified_non_trans_table"));
143 }
146 }
148 DBUG_PRINT("debug", ("mark_created_temp_table"));
150 }
153 }
155 DBUG_PRINT("debug", ("mark_dropped_temp_table"));
157 }
160 }
161
162 void reset() {
163 m_no_2pc = false;
164 m_rw_ha_count = 0;
166 }
167 bool is_empty() const { return m_ha_list == nullptr; }
168 };
169
170 private:
172
174
175 MEM_ROOT m_mem_root; // Transaction-life memory allocation pool
176
177 public:
178 /*
179 (Mostly) binlog-specific fields use while flushing the caches
180 and committing transactions.
181 We don't use bitfield any more in the struct. Modification will
182 be lost when concurrently updating multiple bit fields. It will
183 cause a race condition in a multi-threaded application. And we
184 already caught a race condition case between xid_written and
185 ready_preempt in MYSQL_BIN_LOG::ordered_commit.
186 */
187 struct {
188 bool enabled{false}; // see ha_enable_transaction()
189 bool xid_written{false}; // The session wrote an XID
190 bool real_commit{false}; // Is this a "real" commit?
191 bool commit_low{false}; // see MYSQL_BIN_LOG::ordered_commit
192 bool run_hooks{false}; // Call the after_commit hook
193#ifndef NDEBUG
194 bool ready_preempt{false}; // internal in MYSQL_BIN_LOG::ordered_commit
195#endif
197 /* Binlog-specific logical timestamps. */
198 /*
199 Store for the transaction's commit parent sequence_number.
200 The value specifies this transaction dependency with a "parent"
201 transaction.
202 The member is assigned, when the transaction is about to commit
203 in binlog to a value of the last committed transaction's sequence_number.
204 This and last_committed as numbers are kept ever incremented
205 regardless of binary logs being rotated or when transaction
206 is logged in multiple pieces.
207 However the logger to the binary log may convert them
208 according to its specification.
209 */
211 /*
212 The transaction's private logical timestamp assigned at the
213 transaction prepare phase. The timestamp enumerates transactions
214 in the binary log. The value is gained through incrementing (stepping) a
215 global clock.
216 Eventually the value is considered to increase max_committed_transaction
217 system clock when the transaction has committed.
218 */
220
221 void store_commit_parent(int64 last_arg) { last_committed = last_arg; }
222
225
226 void cleanup() {
228 m_savepoints = nullptr;
234 return;
235 }
236
237 bool is_active(enum_trx_scope scope) const {
238 return m_scope_info[scope].m_ha_list != nullptr;
239 }
240
242
244 /*
245 Merge m_scope_info[STMT].unsafe_rollback_flags to
246 m_scope_info[SESSION].unsafe_rollback_flags. If the statement
247 cannot be rolled back safely, the transaction including
248 this statement definitely cannot rolled back safely.
249 */
252 }
253
254 void init_mem_root_defaults(ulong trans_alloc_block_size, ulong) {
255 m_mem_root.set_block_size(trans_alloc_block_size);
256 }
257
259
260 void *allocate_memory(unsigned int size) { return m_mem_root.Alloc(size); }
261
262 void claim_memory_ownership(bool claim) { m_mem_root.Claim(claim); }
263
265
266 char *strmake(const char *str, size_t len) {
267 return strmake_root(&m_mem_root, str, len);
268 }
269
271
272 void add_changed_table(const char *key, uint32 key_length);
273
275
278 m_scope_info[scope].m_ha_list = trx_info;
279 return;
280 }
281
283
284 const XID_STATE *xid_state() const { return &m_xid_state; }
285
287 return m_scope_info[scope].cannot_safely_rollback();
288 }
289
290 unsigned int get_unsafe_rollback_flags(enum_trx_scope scope) const {
292 }
293
296 }
297
300 }
301
304 }
305
308 }
309
312 }
313
316 }
317
319 return m_scope_info[scope].has_created_temp_table();
320 }
321
324 }
325
327 return m_scope_info[scope].has_dropped_temp_table();
328 }
329
330 void reset(enum_trx_scope scope) { m_scope_info[scope].reset(); }
331
332 bool is_empty(enum_trx_scope scope) const {
333 return m_scope_info[scope].is_empty();
334 }
335
336 void set_no_2pc(enum_trx_scope scope, bool value) {
337 m_scope_info[scope].m_no_2pc = value;
338 }
339
340 bool no_2pc(enum_trx_scope scope) const {
341 return m_scope_info[scope].m_no_2pc;
342 }
343
344 int rw_ha_count(enum_trx_scope scope) const {
345 return m_scope_info[scope].m_rw_ha_count;
346 }
347
348 void set_rw_ha_count(enum_trx_scope scope, int value) {
349 m_scope_info[scope].m_rw_ha_count = value;
350 }
351
354 m_scope_info[scope].m_ha_list = nullptr;
355 m_scope_info[scope].m_no_2pc = false;
356 m_scope_info[scope].m_rw_ha_count = 0;
357 return;
358 }
359
361 return &m_rpl_transaction_ctx;
362 }
363
365 return &m_rpl_transaction_ctx;
366 }
367
370 }
371
374 }
375
377
379
380 private:
384};
385
386/**
387 Either statement transaction or normal transaction - related
388 thread-specific storage engine data.
389
390 If a storage engine participates in a statement/transaction,
391 an instance of this class is present in
392 thd->m_transaction.m_scope_info[STMT|SESSION].ha_list. The addition
393 this list is made by trans_register_ha().
394
395 When it's time to commit or rollback, each element of ha_list
396 is used to access storage engine's prepare()/commit()/rollback()
397 methods, and also to evaluate if a full two phase commit is
398 necessary.
399
400 @sa General description of transaction handling in handler.cc.
401*/
402
404 public:
405 friend class Ha_trx_info_list;
406
407 /**
408 Register this storage engine in the given transaction context.
409 */
412 assert(m_flags == 0);
413 assert(m_ht == nullptr);
414 assert(m_next == nullptr);
415
416 m_ht = ht_arg;
417 m_flags = (int)TRX_READ_ONLY; /* Assume read-only at start. */
418
419 if (trans->m_ha_list != this) {
420 m_next = trans->m_ha_list;
421 trans->m_ha_list = this;
422 }
423
424 return;
425 }
426
427 /**
428 Clear, prepare for reuse.
429 */
430
431 void reset() {
433 m_next = nullptr;
434 m_ht = nullptr;
435 m_flags = 0;
436 return;
437 }
438
440
442 assert(is_started());
443 m_flags |= (int)TRX_READ_WRITE;
444 }
445
446 bool is_trx_read_write() const {
447 assert(is_started());
448 return m_flags & (int)TRX_READ_WRITE;
449 }
450
451 bool is_started() const { return m_ht != nullptr; }
452
453 /**
454 Mark this transaction read-write if the argument is read-write.
455 */
456
457 void coalesce_trx_with(const Ha_trx_info *stmt_trx) {
458 this->coalesce_trx_with(*stmt_trx);
459 }
460
461 void coalesce_trx_with(const Ha_trx_info &stmt_trx) {
462 /*
463 Must be called only after the transaction has been started.
464 Can be called many times, e.g. when we have many
465 read-write statements in a transaction.
466 */
467 assert(is_started());
468 if (stmt_trx.is_trx_read_write()) set_trx_read_write();
469 }
470
471 handlerton *ht() const {
472 assert(is_started());
473 return m_ht;
474 }
475
476 private:
477 enum { TRX_READ_ONLY = 0, TRX_READ_WRITE = 1 };
478 /**
479 Auxiliary, used for ha_list management
480 */
482
483 /**
484 Although a given Ha_trx_info instance is currently always used
485 for the same storage engine, 'ht' is not-NULL only when the
486 corresponding storage is a part of a transaction.
487 */
489
490 /**
491 Transaction flags related to this engine.
492 Not-null only if this instance is a part of transaction.
493 May assume a combination of enum values above.
494 */
496};
497
498/**
499 @class Ha_trx_info_list
500
501 Container to hold and allow iteration over a set of Ha_trx_info objects.
502 */
504 public:
505 /**
506 @class Iterator
507
508 Implements a forward iterator for `Ha_trx_info_list`. The
509 `Ha_trx_info_list` methods `begin` and `end` complete the requirements
510 for algorithms usage.
511
512 Since the container this iterator targets is a linked-list where the
513 list and the list elements are the same, the invalidation rules are not
514 the ones usually encontered in iterator classes. Invoking
515 `Ha_trx_info::reset()`, which clears the pointer to next element in the
516 list, doesn't invalidate the iterator, instead the pointer reference is
517 kept by the iterator in order to allow the requirements for forward
518 iterating to be valid. Therefore, although `Ha_trx_info::reset()`
519 removes the element from the list, the iterator is no invalidated and
520 iteration over the rest of the element is kept.
521 */
522 class Iterator {
523 public:
524 using difference_type = std::ptrdiff_t;
527 using iterator_category = std::forward_iterator_tag;
528
529 Iterator(Ha_trx_info *parent);
530 Iterator(std::nullptr_t);
531 Iterator(Iterator const &rhs);
532 virtual ~Iterator() = default;
533
534 // BASIC ITERATOR METHODS //
535 Iterator &operator=(const Iterator &rhs);
537 reference operator*() const;
538 // END / BASIC ITERATOR METHODS //
539
540 // INPUT ITERATOR METHODS //
541 Iterator operator++(int);
542 pointer operator->() const;
543 bool operator==(Iterator const &rhs) const;
544 bool operator==(Ha_trx_info const *rhs) const;
545 bool operator==(Ha_trx_info const &rhs) const;
546 bool operator!=(Iterator const &rhs) const;
547 bool operator!=(Ha_trx_info const *rhs) const;
548 bool operator!=(Ha_trx_info const &rhs) const;
549 // END / INPUT ITERATOR METHODS //
550
551 // OUTPUT ITERATOR METHODS //
552 // reference operator*() const; <- already defined
553 // iterator operator++(int); <- already defined
554 // END / OUTPUT ITERATOR METHODS //
555
556 // FORWARD ITERATOR METHODS //
557 // Enable support for both input and output iterator
558 // END / FORWARD ITERATOR METHODS //
559
560 private:
561 /** Item this iterator is currently pointing to */
563 /** Next item in the list */
565
567 };
568
569 /**
570 Default constructor.
571 */
572 Ha_trx_info_list() = default;
573 /**
574 Class constructor that instantiates the underlying head of the list
575 with the parameter.
576
577 @param rhs The pointer to initialize the underlying list head with.
578 */
580 /**
581 Copy constructor.
582
583 @param rhs The object instance to copy content from.
584 */
586 /**
587 Move constructor.
588
589 @param rhs The object instance to move content from.
590 */
592 virtual ~Ha_trx_info_list() = default;
593
594 /**
595 Copy operator.
596
597 @param rhs The object instance to copy content from.
598
599 @return this object reference, for chaining puposes.
600 */
602 /**
603 Move operator.
604
605 @param rhs The object instance to move content from.
606
607 @return this object reference, for chaining puposes.
608 */
610 /**
611 Retrieves the reference to the undelying head of the list.
612
613 @return The reference to the undelying head of the list.
614 */
616 /**
617 Retrieves the reference to the undelying head of the list.
618
619 @return The reference to the undelying head of the list.
620 */
621 Ha_trx_info const &operator*() const;
622 /**
623 Retrieves the pointer to the undelying head of the list.
624
625 @return The pointer to the undelying head of the list.
626 */
628 /**
629 Retrieves the pointer to the undelying head of the list.
630
631 @return The pointer to the undelying head of the list.
632 */
633 Ha_trx_info const *operator->() const;
634 /**
635 Equality operator that compares with another instance of this class. It
636 evaluates to true if both object's underlying head point to the same
637 address.
638
639 @param rhs The object to compare this object to.
640
641 @return true if both object's underlying head point to the same
642 address, false otherwise.
643 */
644 bool operator==(Ha_trx_info_list const &rhs) const;
645 /**
646 Equality operator that compares with an instance of Ha_trx_info
647 class. It evaluates to true if this object's underlying head points to
648 the same address of the parameter object.
649
650 @param rhs The object to compare this object to.
651
652 @return true if this object's underlying head point to the same address
653 as the parameter object, false otherwise.
654 */
655 bool operator==(Ha_trx_info const *rhs) const;
656 /**
657 Equality operator that compares with null. It evaluates to true if this
658 object's underlying head points to null.
659
660 @param rhs The `nullptr` value
661
662 @return true if this object's underlying head point to null, false
663 otherwise.
664 */
665 bool operator==(std::nullptr_t rhs) const;
666 /**
667 Inequality operator that compares with another instance of this
668 class. It evaluates to true if both object's underlying head point to
669 the different addresses.
670
671 @param rhs The object to compare this object to.
672
673 @return true if both object's underlying head point to different
674 addresses, false otherwise.
675 */
676 bool operator!=(Ha_trx_info_list const &rhs) const;
677 /**
678 Inequality operator that compares with an instance of Ha_trx_info
679 class. It evaluates to true if this object's underlying head points to
680 a different address of the parameter object.
681
682 @param rhs The object to compare this object to.
683
684 @return true if this object's underlying head point to different
685 address as the parameter object, false otherwise.
686 */
687 bool operator!=(Ha_trx_info const *rhs) const;
688 /**
689 Inequality operator that compares with null. It evaluates to true if
690 this object's underlying head points to a non-null value.
691
692 @param rhs The `nullptr` value
693
694 @return true if this object's underlying head point to a non-null
695 value, false otherwise.
696 */
697 bool operator!=(std::nullptr_t rhs) const;
698 /**
699 Cast operator to `bool`. It returns true if the this object underlying
700 list head doesn't point to null, false otherwise.
701
702 @return true if the this object underlying list head doesn't point to
703 null, false otherwise.
704 */
705 operator bool() const;
706 /**
707 Retrieves the pointer to the underlying list head.
708
709 @return The underlying list head.
710 */
711 Ha_trx_info *head();
712 /**
713 Retrieves an iterator pointing to the underlying list head.
714
715 @return An iterator pointing to the underlying list head.
716 */
717 Iterator begin();
718 /**
719 Retrieves an iterator pointing to the underlying list head.
720
721 @return An iterator pointing to the underlying list head.
722 */
723 const Iterator begin() const;
724 /**
725 Retrieves an iterator pointing to null.
726
727 @return An iterator pointing null.
728 */
729 Iterator end();
730 /**
731 Retrieves an iterator pointing to null.
732
733 @return An iterator pointing null.
734 */
735 const Iterator end() const;
736
737 private:
738 /** The head of the list */
740};
741
742#endif
Implements a forward iterator for Ha_trx_info_list.
Definition: transaction_info.h:522
Ha_trx_info * m_current
Item this iterator is currently pointing to
Definition: transaction_info.h:562
virtual ~Iterator()=default
Iterator & set_next()
Definition: transaction_info.cc:146
reference operator*() const
Definition: transaction_info.cc:106
Iterator & operator=(const Iterator &rhs)
Definition: transaction_info.cc:92
std::ptrdiff_t difference_type
Definition: transaction_info.h:524
Iterator(Ha_trx_info *parent)
Definition: transaction_info.cc:84
std::forward_iterator_tag iterator_category
Definition: transaction_info.h:527
pointer operator->() const
Definition: transaction_info.cc:117
bool operator==(Iterator const &rhs) const
Definition: transaction_info.cc:122
Iterator & operator++()
Definition: transaction_info.cc:99
bool operator!=(Iterator const &rhs) const
Definition: transaction_info.cc:134
Ha_trx_info * m_next
Next item in the list
Definition: transaction_info.h:564
Container to hold and allow iteration over a set of Ha_trx_info objects.
Definition: transaction_info.h:503
Ha_trx_info_list & operator=(Ha_trx_info_list const &rhs)
Copy operator.
Definition: transaction_info.cc:161
Iterator end()
Retrieves an iterator pointing to null.
Definition: transaction_info.cc:222
Ha_trx_info * operator->()
Retrieves the pointer to the undelying head of the list.
Definition: transaction_info.cc:178
bool operator==(Ha_trx_info_list const &rhs) const
Equality operator that compares with another instance of this class.
Definition: transaction_info.cc:184
virtual ~Ha_trx_info_list()=default
Ha_trx_info & operator*()
Retrieves the reference to the undelying head of the list.
Definition: transaction_info.cc:172
Ha_trx_info * m_underlying
The head of the list.
Definition: transaction_info.h:739
Ha_trx_info * head()
Retrieves the pointer to the underlying list head.
Definition: transaction_info.cc:212
bool operator!=(Ha_trx_info_list const &rhs) const
Inequality operator that compares with another instance of this class.
Definition: transaction_info.cc:196
Ha_trx_info_list()=default
Default constructor.
Iterator begin()
Retrieves an iterator pointing to the underlying list head.
Definition: transaction_info.cc:214
Either statement transaction or normal transaction - related thread-specific storage engine data.
Definition: transaction_info.h:403
void coalesce_trx_with(const Ha_trx_info &stmt_trx)
Definition: transaction_info.h:461
handlerton * ht() const
Definition: transaction_info.h:471
@ TRX_READ_WRITE
Definition: transaction_info.h:477
@ TRX_READ_ONLY
Definition: transaction_info.h:477
bool is_started() const
Definition: transaction_info.h:451
handlerton * m_ht
Although a given Ha_trx_info instance is currently always used for the same storage engine,...
Definition: transaction_info.h:488
bool is_trx_read_write() const
Definition: transaction_info.h:446
Ha_trx_info * m_next
Auxiliary, used for ha_list management.
Definition: transaction_info.h:481
void reset()
Clear, prepare for reuse.
Definition: transaction_info.h:431
void set_trx_read_write()
Definition: transaction_info.h:441
Ha_trx_info()
Definition: transaction_info.h:439
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:457
void register_ha(Transaction_ctx::THD_TRANS *trans, handlerton *ht_arg)
Register this storage engine in the given transaction context.
Definition: transaction_info.h:410
uchar m_flags
Transaction flags related to this engine.
Definition: transaction_info.h:495
Savepoint for MDL context.
Definition: mdl.h:1317
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:54
void set_rw_ha_count(enum_trx_scope scope, int value)
Definition: transaction_info.h:348
void merge_unsafe_rollback_flags()
Definition: transaction_info.h:243
Rpl_transaction_write_set_ctx m_transaction_write_set_ctx
Definition: transaction_info.h:382
bool has_created_temp_table(enum_trx_scope scope) const
Definition: transaction_info.h:318
bool is_active(enum_trx_scope scope) const
Definition: transaction_info.h:237
void * allocate_memory(unsigned int size)
Definition: transaction_info.h:260
bool cannot_safely_rollback(enum_trx_scope scope) const
Definition: transaction_info.h:286
bool enabled
Definition: transaction_info.h:188
char * strmake(const char *str, size_t len)
Definition: transaction_info.h:266
void register_ha(enum_trx_scope scope, Ha_trx_info *ha_info, handlerton *ht)
Definition: transaction_info.cc:75
virtual ~Transaction_ctx()
Definition: transaction_info.h:224
bool was_trans_begin_hook_invoked()
Definition: transaction_info.h:376
bool no_2pc(enum_trx_scope scope) const
Definition: transaction_info.h:340
void set_trans_begin_hook_invoked()
Definition: transaction_info.h:378
MEM_ROOT m_mem_root
Definition: transaction_info.h:175
SAVEPOINT * m_savepoints
Definition: transaction_info.h:58
int64 last_committed
Definition: transaction_info.h:210
bool real_commit
Definition: transaction_info.h:190
void reset_unsafe_rollback_flags(enum_trx_scope scope)
Definition: transaction_info.h:302
Transaction_ctx()
Definition: transaction_info.cc:43
void push_unsafe_rollback_warnings(THD *thd)
Definition: transaction_info.cc:56
struct Transaction_ctx::@190 m_flags
XID_STATE * xid_state()
Definition: transaction_info.h:282
const Rpl_transaction_write_set_ctx * get_transaction_write_set_ctx() const
Definition: transaction_info.h:372
bool run_hooks
Definition: transaction_info.h:192
bool commit_low
Definition: transaction_info.h:191
XID_STATE m_xid_state
Definition: transaction_info.h:173
void reset(enum_trx_scope scope)
Definition: transaction_info.h:330
int64 sequence_number
Definition: transaction_info.h:219
void init_mem_root_defaults(ulong trans_alloc_block_size, ulong)
Definition: transaction_info.h:254
const Rpl_transaction_ctx * get_rpl_transaction_ctx() const
Definition: transaction_info.h:364
void store_commit_parent(int64 last_arg)
Definition: transaction_info.h:221
int rw_ha_count(enum_trx_scope scope) const
Definition: transaction_info.h:344
void add_changed_table(const char *key, uint32 key_length)
bool trans_begin_hook_invoked
Definition: transaction_info.h:383
void set_unsafe_rollback_flags(enum_trx_scope scope, unsigned int flags)
Definition: transaction_info.h:294
const XID_STATE * xid_state() const
Definition: transaction_info.h:284
bool xid_written
Definition: transaction_info.h:189
void claim_memory_ownership(bool claim)
Definition: transaction_info.h:262
Rpl_transaction_write_set_ctx * get_transaction_write_set_ctx()
Definition: transaction_info.h:368
Ha_trx_info_list ha_trx_info(enum_trx_scope scope)
Definition: transaction_info.cc:80
unsigned int get_unsafe_rollback_flags(enum_trx_scope scope) const
Definition: transaction_info.h:290
void mark_modified_non_trans_table(enum_trx_scope scope)
Definition: transaction_info.h:306
void reset_scope(enum_trx_scope scope)
Definition: transaction_info.h:352
void free_memory()
Definition: transaction_info.h:264
void invalidate_changed_tables_in_cache(THD *thd)
void add_unsafe_rollback_flags(enum_trx_scope scope, unsigned int flags)
Definition: transaction_info.h:298
void cleanup()
Definition: transaction_info.h:226
void mark_created_temp_table(enum_trx_scope scope)
Definition: transaction_info.h:314
void set_no_2pc(enum_trx_scope scope, bool value)
Definition: transaction_info.h:336
bool has_dropped_temp_table(enum_trx_scope scope) const
Definition: transaction_info.h:326
bool has_modified_non_trans_table(enum_trx_scope scope) const
Definition: transaction_info.h:310
bool ready_preempt
Definition: transaction_info.h:194
void mark_dropped_temp_table(enum_trx_scope scope)
Definition: transaction_info.h:322
Rpl_transaction_ctx m_rpl_transaction_ctx
Definition: transaction_info.h:381
THD_TRANS m_scope_info[2]
Definition: transaction_info.h:171
void set_ha_trx_info(enum_trx_scope scope, Ha_trx_info *trx_info)
Definition: transaction_info.h:276
Rpl_transaction_ctx * get_rpl_transaction_ctx()
Definition: transaction_info.h:360
bool is_empty(enum_trx_scope scope) const
Definition: transaction_info.h:332
enum_trx_scope
Definition: transaction_info.h:56
@ SESSION
Definition: transaction_info.h:56
@ STMT
Definition: transaction_info.h:56
MEM_ROOT * transaction_memroot()
Definition: transaction_info.h:258
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:161
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
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:45
size_t length
Definition: transaction_info.h:48
char * name
Definition: transaction_info.h:47
Ha_trx_info * ha_list
Definition: transaction_info.h:49
SAVEPOINT * prev
Definition: transaction_info.h:46
MDL_savepoint mdl_savepoint
State of metadata locks before this savepoint was set.
Definition: transaction_info.h:51
Definition: transaction_info.h:63
void add_unsafe_rollback_flags(unsigned int flags)
Definition: transaction_info.h:132
void mark_modified_non_trans_table()
Definition: transaction_info.h:140
bool has_modified_non_trans_table() const
Definition: transaction_info.h:144
void mark_dropped_temp_table()
Definition: transaction_info.h:154
bool m_no_2pc
Definition: transaction_info.h:65
unsigned int get_unsafe_rollback_flags() const
Definition: transaction_info.h:125
static unsigned int const DROPPED_TEMP_TABLE
Definition: transaction_info.h:121
void reset_unsafe_rollback_flags()
Definition: transaction_info.h:136
bool is_empty() const
Definition: transaction_info.h:167
bool cannot_safely_rollback() const
Definition: transaction_info.h:124
void mark_created_temp_table()
Definition: transaction_info.h:147
void set_unsafe_rollback_flags(unsigned int flags)
Definition: transaction_info.h:128
Ha_trx_info * m_ha_list
Definition: transaction_info.h:68
int m_rw_ha_count
Definition: transaction_info.h:66
bool has_dropped_temp_table() const
Definition: transaction_info.h:158
static unsigned int const MODIFIED_NON_TRANS_TABLE
Definition: transaction_info.h:119
static unsigned int const CREATED_TEMP_TABLE
Definition: transaction_info.h:120
unsigned int m_unsafe_rollback_flags
Definition: transaction_info.h:114
void reset()
Definition: transaction_info.h:162
bool has_created_temp_table() const
Definition: transaction_info.h:151
handlerton is a singleton structure - one instance per storage engine - to provide access to storage ...
Definition: handler.h:2734