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