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