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