24#ifndef RPL_GTID_H_INCLUDED
25#define RPL_GTID_H_INCLUDED
67#define BINLOG_ERROR(MYSQLBINLOG_ERROR, SERVER_ERROR) error MYSQLBINLOG_ERROR
69#define BINLOG_ERROR(MYSQLBINLOG_ERROR, SERVER_ERROR) my_error SERVER_ERROR
83#define SKIP_WHITESPACE() \
84 while (my_isspace(&my_charset_utf8mb3_general_ci, *s)) s++
92#undef NON_DISABLED_GTID
117class Locked_sidno_set;
165#define __CHECK_RETURN_STATUS(STATUS, ACTION, STATUS_NAME, ALLOW_UNREPORTED)
168 const char *status_name,
int allow_unreported);
169#define __CHECK_RETURN_STATUS(STATUS, ACTION, STATUS_NAME, ALLOW_UNREPORTED) \
170 check_return_status(STATUS, ACTION, STATUS_NAME, ALLOW_UNREPORTED);
177#define __PROPAGATE_ERROR(STATUS, RETURN_VALUE, ALLOW_UNREPORTED) \
179 enum_return_status __propagate_error_status = STATUS; \
180 if (__propagate_error_status != RETURN_STATUS_OK) { \
181 __CHECK_RETURN_STATUS(__propagate_error_status, "Propagating", #STATUS, \
183 return RETURN_VALUE; \
187#define __RETURN_STATUS(STATUS, ALLOW_UNREPORTED) \
189 enum_return_status __return_status_status = STATUS; \
190 __CHECK_RETURN_STATUS(__return_status_status, "Returning", #STATUS, \
192 return __return_status_status; \
198#define PROPAGATE_ERROR(STATUS) \
199 __PROPAGATE_ERROR(STATUS, __propagate_error_status, true)
205#define PROPAGATE_REPORTED_ERROR(STATUS) \
206 __PROPAGATE_ERROR(STATUS, __propagate_error_status, false)
212#define PROPAGATE_REPORTED_ERROR_INT(STATUS) __PROPAGATE_ERROR(STATUS, 1, false)
217#define RETURN_STATUS(STATUS) __RETURN_STATUS(STATUS, true)
223#define RETURN_REPORTED_STATUS(STATUS) __RETURN_STATUS(STATUS, false)
225#define RETURN_OK return RETURN_STATUS_OK
227#define RETURN_REPORTED_ERROR RETURN_STATUS(RETURN_STATUS_REPORTED_ERROR)
229#define RETURN_UNREPORTED_ERROR RETURN_STATUS(RETURN_STATUS_UNREPORTED_ERROR)
336 m_is_write_lock =
false;
338#if defined(HAVE_PSI_INTERFACE)
391 std::adopt_lock_t t [[maybe_unused]])
396 lock.assert_some_rdlock();
399 lock.assert_some_wrlock();
501 m_is_write_lock =
true;
517 m_is_write_lock =
false;
530 return m_is_write_lock;
546 m_is_write_lock =
true;
602 bool m_is_write_lock;
709 static std::pair<bool, value_type>
from_string(std::string s);
774 using Tsid_ref = std::reference_wrapper<const Tsid>;
1009 inline bool wait(
const THD *thd,
int sidno,
struct timespec *abstime)
const {
1016 if (abstime !=
nullptr)
1030 inline int get_max_index() const {
1032 return static_cast<int>(
m_array.size() - 1);
1054 bool is_thd_killed(
const THD *thd)
const;
1063 assert(
n <= get_max_index());
1115 assert(sidno_arg > 0);
1116 assert(gno_arg > 0);
1143 static bool is_valid(
const char *text);
1163 bool need_lock =
false)
const;
1183 static std::pair<Tag, std::size_t>
parse_tag_str(
const char *text,
1194 static std::pair<mysql::utils::Return_status, mysql::gtid::Gtid>
1205 printf(
"%s\n",
buf);
1210 const char *text [[maybe_unused]] =
"",
1211 bool need_lock [[maybe_unused]] =
false)
const {
1215 DBUG_PRINT(
"info", (
"%s%s%s", text, *text ?
": " :
"",
buf));
1229 static std::size_t
skip_whitespace(
const char *text, std::size_t pos);
1239 static std::tuple<mysql::utils::Return_status, rpl_sid, std::size_t>
1248 static std::tuple<mysql::utils::Return_status, rpl_gno, std::size_t>
1257 static std::pair<mysql::utils::Return_status, std::size_t>
1317 uint *gtid_length_arg,
1338 uint *gtid_length_arg,
1367 Tsid_map *tsid_map,
char *gtid_arg, uint *gtid_length_arg,
1369 ulonglong *start_time_arg, uint *last_transient_errno_arg,
1370 char *last_transient_errmsg_arg, uint *last_transient_errmsg_length_arg,
1371 ulonglong *last_transient_timestamp_arg, ulong *retries_count_arg)
const;
1400 Tsid_map *tsid_map,
char *gtid_arg, uint *gtid_length_arg,
1403 uint *last_transient_errno_arg,
char *last_transient_errmsg_arg,
1404 uint *last_transient_errmsg_length_arg,
1405 ulonglong *last_transient_timestamp_arg, ulong *retries_count_arg)
const;
1490 ulonglong immediate_ts_arg,
bool skipped_arg =
false);
1493 size_t uncompressed_size);
1531 const char *transient_err_message_arg,
1532 ulong trans_retries_arg);
1728 bool *starts_with_plus =
nullptr);
1747 size_t *actual_length =
nullptr);
1848 while (ivit.
get() !=
nullptr) {
1869 return ivit.
get() !=
nullptr;
1875 static bool is_valid(
const char *text);
1961 printf(
"%s\n",
str ?
str :
"out of memory in Gtid_set::print");
1979 bool need_lock [[maybe_unused]] =
false,
1981 [[maybe_unused]] =
nullptr)
const {
1985 DBUG_PRINT(
"info", (
"%s%s'%s'", text, *text ?
": " :
"",
1986 str ?
str :
"out of memory in Gtid_set::dbug_print"));
2058 template <
typename Gt
id_set_p,
typename Interval_p>
2069 init(gtid_set, sidno);
2073 p =
const_cast<Interval_p *
>(>id_set->free_intervals);
2077 p =
const_cast<Interval_p *
>(>id_set->m_intervals[sidno - 1]);
2081 assert(*
p !=
nullptr);
2082 p =
const_cast<Interval_p *
>(&(*p)->next);
2085 inline Interval_p
get()
const {
return *
p; }
2139 assert(
get() !=
nullptr);
2174 if (iv ==
nullptr) {
2177 if (
sidno == 0)
return;
2202 }
while (iv ==
nullptr);
2239 bool skip_tagged_gtids)
const;
2276 while (ivit.
get() !=
nullptr) {
2287 for (
rpl_sidno sidno = 1; sidno < max_sidno; sidno++)
2299 bool skip_tagged_gtids)
const;
2399 Free_intervals_lock *
lock);
2422 Free_intervals_lock *
lock);
2439 Free_intervals_lock *
lock);
2456 Free_intervals_lock *
lock);
2461 Const_interval_iterator *super);
2464 Const_interval_iterator *ivit2);
2491#ifdef FRIEND_OF_GTID_SET
2492 friend FRIEND_OF_GTID_SET;
2640 if (sidno > max_sidno)
continue;
2641 bool printed_sid =
false;
2642 for (
const auto &key_and_value : *
get_hash(sidno)) {
2643 Node *node = key_and_value.second.get();
2644 assert(node !=
nullptr);
2649 p += sprintf(
p,
":%" PRId64
"#%u", node->
gno, node->
owner);
2653 return (
int)(
p - out);
2664 for (
rpl_sidno sidno = 1; sidno <= max_sidno; sidno++) {
2665 size_t records =
get_hash(sidno)->size();
2680 while (node !=
nullptr) {
2681 if (node->
owner == thd_id)
return true;
2696 assert(
str !=
nullptr);
2703 printf(
"%s\n",
str);
2714 DBUG_PRINT(
"info", (
"%s%s%s", text, *text ?
": " :
"",
str));
2775 assert(
hash !=
nullptr);
2778 assert(
node !=
nullptr);
2995 (
"atomic_anonymous_gtid_count increased to %d", new_value));
2996 assert(new_value >= 1);
3010 (
"atomic_anonymous_gtid_count decreased to %d", new_value));
3011 assert(new_value >= 0);
3032 (
"ongoing_automatic_gtid_violating_transaction_count increased to %d",
3034 assert(new_value >= 1);
3054 (
"ongoing_automatic_gtid_violating_transaction_count decreased to %d",
3056 assert(new_value >= 0);
3080 DBUG_PRINT(
"info", (
"atomic_anonymous_gtid_violation_count increased to %d",
3082 assert(new_value >= 1);
3102 (
"ongoing_anonymous_gtid_violating_transaction_count decreased to %d",
3104 assert(new_value >= 0);
3129 DBUG_PRINT(
"info", (
"atomic_gtid_wait_count changed from %d to %d",
3130 new_value - 1, new_value));
3131 assert(new_value >= 1);
3146 DBUG_PRINT(
"info", (
"atomic_gtid_wait_count changed from %d to %d",
3147 new_value + 1, new_value));
3148 assert(new_value >= 0);
3272 bool update_thd_status =
true);
3279 struct timespec *abstime =
nullptr);
3295 bool update_thd_status =
true);
3413 p += sprintf(
p,
"Executed GTIDs:\n");
3415 p += sprintf(
p,
"\nOwned GTIDs:\n");
3417 p += sprintf(
p,
"\nLost GTIDs:\n");
3419 p += sprintf(
p,
"\nGTIDs only_in_table:\n");
3421 return (
int)(
p -
buf);
3445 DBUG_PRINT(
"info", (
"%s%s%s", text, *text ?
": " :
"",
str));
3545#ifdef HAVE_GTID_NEXT_LIST
3547 void lock_owned_sidnos(
const THD *thd);
3595#ifdef FRIEND_OF_GTID_STATE
3596 friend FRIEND_OF_GTID_STATE;
4098 static bool is_valid(
const char *text);
4102 static bool is_tagged(
const char *text);
4117 bool need_lock =
false)
const;
4134 printf(
"%s\n",
buf);
4142 bool need_lock [[maybe_unused]] =
false)
const {
4146 DBUG_PRINT(
"info", (
"%s%s%s", text, *text ?
": " :
"",
buf));
4151static_assert(std::is_trivial_v<Gtid_specification>);
4152static_assert(std::is_standard_layout_v<Gtid_specification>);
4259#ifdef HAVE_GTID_NEXT_LIST
4260int gtid_acquire_ownership_multiple(
THD *thd);
Kerberos Client Authentication nullptr
Definition: auth_kerberos_client_plugin.cc:251
RAII class to acquire a lock for the duration of a block.
Definition: rpl_gtid.h:358
void unlock_if_locked()
Unlock the lock, if it was acquired by this guard.
Definition: rpl_gtid.h:466
Guard(Checkable_rwlock &lock, enum_lock_type lock_type)
Create a guard, and optionally acquire a lock on it.
Definition: rpl_gtid.h:366
Checkable_rwlock & m_lock
Definition: rpl_gtid.h:359
Guard(Checkable_rwlock &lock, enum_lock_type lock_type, std::adopt_lock_t t)
Create a guard, assuming the caller already holds a lock on it.
Definition: rpl_gtid.h:390
bool is_locked() const
Return true if this object is either read locked or write locked.
Definition: rpl_gtid.h:481
bool is_wrlocked() const
Return true if this object is write locked.
Definition: rpl_gtid.h:478
int tryrdlock()
Try to acquire a read lock, and fail if it cannot be immediately granted.
Definition: rpl_gtid.h:450
enum_lock_type m_lock_type
Definition: rpl_gtid.h:360
Guard(Guard const ©)=delete
Objects of this class should not be copied or moved.
void unlock()
Unlock the lock.
Definition: rpl_gtid.h:459
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:419
Guard(Guard const &©)=delete
bool is_rdlocked() const
Return true if this object is read locked.
Definition: rpl_gtid.h:475
~Guard()
Unlock on destruct.
Definition: rpl_gtid.h:413
Checkable_rwlock & get_lock() const
Return the underlying Checkable_rwlock object.
Definition: rpl_gtid.h:472
int trywrlock()
Try to acquire the write lock, and fail if it cannot be immediately granted.
Definition: rpl_gtid.h:438
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:427
This has the functionality of mysql_rwlock_t, with two differences:
Definition: rpl_gtid.h:324
int32 get_state() const
Read lock_state atomically and return the value.
Definition: rpl_gtid.h:597
void assert_no_rdlock() const
Assert that no thread holds the read lock.
Definition: rpl_gtid.h:579
int trywrlock()
Return 0 if the write lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:537
enum_lock_type
Definition: rpl_gtid.h:347
@ TRY_READ_LOCK
Definition: rpl_gtid.h:351
@ TRY_WRITE_LOCK
Definition: rpl_gtid.h:352
@ WRITE_LOCK
Definition: rpl_gtid.h:350
@ READ_LOCK
Definition: rpl_gtid.h:349
@ NO_LOCK
Definition: rpl_gtid.h:348
void rdlock()
Acquire the read lock.
Definition: rpl_gtid.h:485
void wrlock()
Acquire the write lock.
Definition: rpl_gtid.h:494
std::atomic< int32 > m_lock_state
The state of the lock: 0 - not locked -1 - write locked >0 - read locked by that many threads.
Definition: rpl_gtid.h:595
void assert_no_lock() const
Assert that no thread holds read or write lock.
Definition: rpl_gtid.h:581
int tryrdlock()
Return 0 if the read lock is held, otherwise an error will be returned.
Definition: rpl_gtid.h:556
~Checkable_rwlock()
Destroy this Checkable_lock.
Definition: rpl_gtid.h:345
void assert_no_wrlock() const
Assert that no thread holds the write lock.
Definition: rpl_gtid.h:577
void assert_some_lock() const
Assert that some thread holds either the read or the write lock.
Definition: rpl_gtid.h:571
Checkable_rwlock(PSI_rwlock_key psi_key=0)
Initialize this Checkable_rwlock.
Definition: rpl_gtid.h:327
void assert_some_rdlock() const
Assert that some thread holds the read lock.
Definition: rpl_gtid.h:573
void unlock()
Release the lock (whether it is a write or read lock).
Definition: rpl_gtid.h:505
bool m_dbug_trace
If enabled, print any lock/unlock operations to the DBUG trace.
Definition: rpl_gtid.h:586
bool is_wrlock()
Return true if the write lock is held.
Definition: rpl_gtid.h:525
void assert_some_wrlock() const
Assert that some thread holds the write lock.
Definition: rpl_gtid.h:575
mysql_rwlock_t m_rwlock
The rwlock.
Definition: rpl_gtid.h:606
Class to access the value of @global.gtid_mode in an efficient and thread-safe manner.
Definition: rpl_gtid.h:616
static std::pair< bool, value_type > from_string(std::string s)
Return the given string gtid_mode as an enumeration value.
Definition: rpl_gtid_mode.cc:56
static ulong sysvar_mode
The sys_var framework needs a variable of type ulong to store the value in.
Definition: rpl_gtid.h:629
std::atomic< int > m_atomic_mode
Definition: rpl_gtid.h:618
const char * get_string() const
Return the current gtid_mode as a string.
Definition: rpl_gtid_mode.cc:53
Gtid_mode()
Definition: rpl_gtid.h:621
static const char * names[]
Strings holding the enumeration values for gtid_mode.
Definition: rpl_gtid.h:661
void set(value_type value)
Set a new value for @global.gtid_mode.
Definition: rpl_gtid_mode.cc:44
value_type get() const
Return the current gtid_mode as an enumeration value.
Definition: rpl_gtid_mode.cc:48
static const char * to_string(value_type value)
Return the given gtid_mode as a string.
Definition: rpl_gtid_mode.cc:68
static Checkable_rwlock lock
Protects updates to @global.gtid_mode.
Definition: rpl_gtid.h:672
value_type
Possible values for @global.gtid_mode.
Definition: rpl_gtid.h:632
@ ON_PERMISSIVE
New transactions are GTID-transactions.
Definition: rpl_gtid.h:648
@ OFF
New transactions are anonymous.
Definition: rpl_gtid.h:637
@ OFF_PERMISSIVE
New transactions are anonyomus.
Definition: rpl_gtid.h:643
@ ON
New transactions are GTID-transactions.
Definition: rpl_gtid.h:654
@ DEFAULT
Definition: rpl_gtid.h:638
Stores information to monitor a transaction during the different replication stages.
Definition: rpl_gtid.h:1412
Trx_monitoring_info * last_processed_trx
Holds information about the last processed transaction.
Definition: rpl_gtid.h:1432
const Gtid * get_processing_trx_gtid()
Returns the GTID of the processing_trx.
Definition: rpl_gtid_misc.cc:602
void update(mysql::binlog::event::compression::type t, size_t payload_size, size_t uncompressed_size)
Definition: rpl_gtid_misc.cc:515
void clear()
Clear all monitoring information.
Definition: rpl_gtid_misc.cc:496
void finish()
Sets the final information, copy processing info to last_processed and clears processing info.
Definition: rpl_gtid_misc.cc:563
void start(Gtid gtid_arg, ulonglong original_ts_arg, ulonglong immediate_ts_arg, bool skipped_arg=false)
Sets the initial monitoring information.
Definition: rpl_gtid_misc.cc:523
~Gtid_monitoring_info()
Destroy this GTID monitoring info object.
Definition: rpl_gtid_misc.cc:455
Trx_monitoring_info * processing_trx
Holds information about transaction being processed.
Definition: rpl_gtid.h:1430
void atomic_lock()
Lock this object when no thread mutex is used to arbitrate the access.
Definition: rpl_gtid_misc.cc:460
void atomic_unlock()
Unlock this object when no thread mutex is used to arbitrate the access.
Definition: rpl_gtid_misc.cc:485
mysql_mutex_t * atomic_mutex
Mutex arbitrating the atomic access to the object.
Definition: rpl_gtid.h:1449
void copy_info_to(Trx_monitoring_info *processing_dest, Trx_monitoring_info *last_processed_dest)
Copies both processing_trx and last_processed_trx info to other Trx_monitoring_info structures.
Definition: rpl_gtid_misc.cc:580
std::atomic< bool > atomic_locked
The atomic locked flag.
Definition: rpl_gtid.h:1452
bool is_processing_trx_set()
Returns true if the processing_trx is set, false otherwise.
Definition: rpl_gtid_misc.cc:593
bool is_locked
Flag to assert the atomic lock behavior.
Definition: rpl_gtid.h:1455
void store_transient_error(uint transient_errno_arg, const char *transient_err_message_arg, ulong trans_retries_arg)
Stores the information about the last transient error in the current transaction, namely: the error n...
Definition: rpl_gtid_misc.cc:611
Gtid_monitoring_info(mysql_mutex_t *atomic_mutex_arg=nullptr)
Create this GTID monitoring info object.
Definition: rpl_gtid_misc.cc:449
void clear_last_processed_trx()
Clear only the last_processed_trx monitoring info.
Definition: rpl_gtid_misc.cc:509
void clear_processing_trx()
Clear only the processing_trx monitoring info.
Definition: rpl_gtid_misc.cc:503
Iterator over intervals of a const Gtid_set.
Definition: rpl_gtid.h:2100
Const_interval_iterator(const Gtid_set *gtid_set)
Create this Const_interval_iterator.
Definition: rpl_gtid.h:2107
Const_interval_iterator(const Gtid_set *gtid_set, rpl_sidno sidno)
Create this Const_interval_iterator.
Definition: rpl_gtid.h:2103
Class representing a lock on free_intervals_mutex.
Definition: rpl_gtid.h:2350
bool locked
Definition: rpl_gtid.h:2374
void unlock_if_locked()
Lock the lock if it is locked.
Definition: rpl_gtid.h:2363
Free_intervals_lock(Gtid_set *_gtid_set)
Create a new lock, but do not acquire it.
Definition: rpl_gtid.h:2353
~Free_intervals_lock()
Destroy this object and unlock the lock if it is locked.
Definition: rpl_gtid.h:2370
void lock_if_not_locked()
Lock the lock if it is not already locked.
Definition: rpl_gtid.h:2356
Gtid_set * gtid_set
Definition: rpl_gtid.h:2373
Iterator over all gtids in a Gtid_set.
Definition: rpl_gtid.h:2158
Gtid get() const
Return next gtid, or {0,0} if we reached the end.
Definition: rpl_gtid.h:2184
rpl_sidno sidno
The SIDNO of the current element, or 0 if the iterator is past the last element.
Definition: rpl_gtid.h:2211
const Gtid_set * gtid_set
The Gtid_set we iterate over.
Definition: rpl_gtid.h:2206
void next()
Advance to next gtid.
Definition: rpl_gtid.h:2165
rpl_gno gno
The GNO of the current element, or 0 if the iterator is past the last element.
Definition: rpl_gtid.h:2216
Const_interval_iterator ivit
Iterator over the intervals for the current SIDNO.
Definition: rpl_gtid.h:2218
Gtid_iterator(const Gtid_set *gs)
Definition: rpl_gtid.h:2160
void next_sidno()
Find the next sidno that has one or more intervals.
Definition: rpl_gtid.h:2191
Iterator over intervals for a given SIDNO.
Definition: rpl_gtid.h:2059
Interval_p get() const
Return current_elem.
Definition: rpl_gtid.h:2085
void init(Gtid_set_p gtid_set, rpl_sidno sidno)
Reset this iterator.
Definition: rpl_gtid.h:2076
Interval_iterator_base(Gtid_set_p gtid_set, rpl_sidno sidno)
Construct a new iterator over the GNO intervals for a given Gtid_set.
Definition: rpl_gtid.h:2067
Interval_p * p
Holds the address of the 'next' pointer of the previous element, or the address of the initial pointe...
Definition: rpl_gtid.h:2093
Interval_iterator_base(Gtid_set_p gtid_set)
Construct a new iterator over the free intervals of a Gtid_set.
Definition: rpl_gtid.h:2072
void next()
Advance current_elem one step.
Definition: rpl_gtid.h:2080
Iterator over intervals of a non-const Gtid_set, with additional methods to modify the Gtid_set.
Definition: rpl_gtid.h:2117
Interval_iterator(Gtid_set *gtid_set)
Destroy this Interval_iterator.
Definition: rpl_gtid.h:2123
void set(Interval *iv)
Set current_elem to the given Interval but do not touch the next pointer of the given Interval.
Definition: rpl_gtid.h:2131
void insert(Interval *iv)
Insert the given element before current_elem.
Definition: rpl_gtid.h:2133
void remove(Gtid_set *gtid_set)
Remove current_elem.
Definition: rpl_gtid.h:2138
Interval_iterator(Gtid_set *gtid_set, rpl_sidno sidno)
Create this Interval_iterator.
Definition: rpl_gtid.h:2120
Represents a set of GTIDs.
Definition: rpl_gtid.h:1556
void put_free_interval(Interval *iv)
Puts the given interval in the list of free intervals.
Definition: rpl_gtid_set.cc:257
rpl_gno get_last_gno(rpl_sidno sidno) const
Definition: rpl_gtid_set.cc:759
bool is_size_greater_than_or_equal(ulonglong num) const
Return true if the size of the set is greater than or equal to the given number.
Definition: rpl_gtid_set.cc:1326
bool is_intersection_nonempty(const Gtid_set *other) const
Returns true if there is a least one element of this Gtid_set in the other Gtid_set.
Definition: rpl_gtid_set.cc:1246
bool is_subset(const Gtid_set *super) const
Returns true if this Gtid_set is a subset of the other Gtid_set.
Definition: rpl_gtid_set.cc:1166
void add_interval_memory(int n_intervals, Interval *intervals_param)
Provides an array of Intervals that this Gtid_set can use when gtids are subsequently added.
Definition: rpl_gtid.h:2042
bool contains_sidno(rpl_sidno sidno) const
Returns true if this Gtid_set contains at least one GTID with the given SIDNO.
Definition: rpl_gtid.h:1865
void encode(uchar *buf, bool skip_tagged_gtids=false) const
Encodes this Gtid_set as a binary string.
Definition: rpl_gtid_set.cc:1377
Gtid_set(Tsid_map *tsid_map, Checkable_rwlock *tsid_lock=nullptr)
Constructs a new, empty Gtid_set.
Definition: rpl_gtid_set.cc:87
int get_n_intervals() const
Return the number of intervals in this Gtid_set.
Definition: rpl_gtid.h:2283
bool sidno_equals(rpl_sidno sidno, const Gtid_set *other, rpl_sidno other_sidno) const
Return true if the given sidno of this Gtid_set contains the same intervals as the given sidno of the...
Definition: rpl_gtid_set.cc:989
friend std::ostream & operator<<(std::ostream &os, const Gtid_set &in)
For use with C++ std::ostream
Definition: rpl_gtid.h:1966
void add_gno_intervals(rpl_sidno sidno, Const_interval_iterator ivit, Free_intervals_lock *lock)
Adds a list of intervals to the given SIDNO.
Definition: rpl_gtid_set.cc:649
static bool is_interval_subset(Const_interval_iterator *sub, Const_interval_iterator *super)
Returns true if every interval of sub is a subset of some interval of super.
Definition: rpl_gtid_set.cc:1062
void init()
Worker for the constructor.
Definition: rpl_gtid_set.cc:104
static const int CHUNK_GROW_SIZE
The default number of intervals in an Interval_chunk.
Definition: rpl_gtid.h:2258
Interval_chunk * chunks
Linked list of chunks.
Definition: rpl_gtid.h:2476
static const String_format commented_string_format
String_format for printing the Gtid_set commented: the string is not quote-wrapped,...
Definition: rpl_gtid.h:2010
bool contains_gtid(rpl_sidno sidno, rpl_gno gno) const
Return true iff the given GTID exists in this set.
Definition: rpl_gtid_set.cc:741
enum_return_status ensure_sidno(rpl_sidno sidno)
Allocates space for all sidnos up to the given sidno in the array of intervals.
Definition: rpl_gtid_set.cc:134
Tsid_map * tsid_map
Tsid_map associated with this Gtid_set.
Definition: rpl_gtid.h:2467
int get_n_intervals(rpl_sidno sidno) const
Return the number of intervals for the given sidno.
Definition: rpl_gtid.h:2273
bool contains_tags() const
Checks if this Gtid set contains any tagged GTIDs.
Definition: rpl_gtid_set.cc:914
void clear_set_and_tsid_map()
Removes all gtids from this Gtid_set and clear all the sidnos used by the Gtid_set and it's TSID map.
Definition: rpl_gtid_set.cc:290
enum_return_status add_gtid_set(const Gtid_set *other)
Adds all gtids from the given Gtid_set to this Gtid_set.
Definition: rpl_gtid_set.cc:684
Interval * free_intervals
Linked list of free intervals.
Definition: rpl_gtid.h:2474
bool contains_gtid(const Gtid >id) const
Return true iff the given GTID exists in this set.
Definition: rpl_gtid.h:1751
static const String_format default_string_format
The default String_format: the format understood by add_gtid_text(const char *).
Definition: rpl_gtid.h:2000
void add_interval_memory_lock_taken(int n_ivs, Interval *ivs)
Like add_interval_memory, but does not acquire free_intervals_mutex.
Definition: rpl_gtid_set.cc:182
void remove_gtid_set(const Gtid_set *other)
Removes all gtids in the given Gtid_set from this Gtid_set.
Definition: rpl_gtid_set.cc:715
void print(bool need_lock=false, const Gtid_set::String_format *sf=nullptr) const
Debug only: Print this Gtid_set to stdout.
Definition: rpl_gtid.h:1957
Prealloced_array< Interval *, 8 > m_intervals
Array where the N'th element contains the head pointer to the intervals of SIDNO N+1.
Definition: rpl_gtid.h:2472
mysql_mutex_t free_intervals_mutex
Lock protecting the list of free intervals.
Definition: rpl_gtid.h:2336
void dbug_print(const char *text="", bool need_lock=false, const Gtid_set::String_format *sf=nullptr) const
Print this Gtid_set to the trace file if debug is enabled; no-op otherwise.
Definition: rpl_gtid.h:1978
int n_chunks
The number of chunks.
Definition: rpl_gtid.h:2488
void remove_gno_intervals(rpl_sidno sidno, Const_interval_iterator ivit, Free_intervals_lock *lock)
Removes a list of intervals from the given SIDNO.
Definition: rpl_gtid_set.cc:662
static bool is_valid(const char *text)
Returns true if the given string is a valid specification of a Gtid_set, false otherwise.
Definition: rpl_gtid_set.cc:596
void clear()
Removes all gtids from this Gtid_set.
Definition: rpl_gtid_set.cc:265
static bool is_interval_intersection_nonempty(Const_interval_iterator *ivit1, Const_interval_iterator *ivit2)
Returns true if at least one sidno in ivit1 is also in ivit2.
Definition: rpl_gtid_set.cc:1209
bool is_subset_for_sid(const Gtid_set *super, const rpl_sid &sid) const
Returns true if this Gtid_set is a subset of the given gtid_set with respect to the given sid.
Definition: rpl_gtid_set.cc:1103
enum_return_status intersection(const Gtid_set *other, Gtid_set *result)
Add the intersection of this Gtid_set and the other Gtid_set to result.
Definition: rpl_gtid_set.cc:1300
void remove_gno_interval(Interval_iterator *ivitp, rpl_gno start, rpl_gno end, Free_intervals_lock *lock)
Removes the interval (start, end) from the given Interval_iterator.
Definition: rpl_gtid_set.cc:352
void get_gtid_intervals(std::list< Gtid_interval > *gtid_intervals) const
Gets all gtid intervals from this Gtid_set.
Definition: rpl_gtid_set.cc:873
bool is_subset_not_equals(const Gtid_set *super) const
Returns true if this Gtid_set is a non equal subset of the other Gtid_set.
Definition: rpl_gtid.h:1778
enum_return_status add_gtid(const mysql::gtid::Gtid >id)
Adds specified GTID (TSID+GNO) to this Gtid_set.
Definition: rpl_gtid_set.cc:426
size_t get_string_length(const String_format *string_format=nullptr) const
Returns the length of the output from to_string.
Definition: rpl_gtid_set.cc:931
size_t cached_string_length
The string length.
Definition: rpl_gtid.h:2480
enum_return_status add_gtid_text(const char *text, bool *anonymous=nullptr, bool *starts_with_plus=nullptr)
Adds the set of GTIDs represented by the given string to this Gtid_set.
Definition: rpl_gtid_set.cc:440
void add_gno_interval(Interval_iterator *ivitp, rpl_gno start, rpl_gno end, Free_intervals_lock *lock)
Adds the interval (start, end) to the given Interval_iterator.
Definition: rpl_gtid_set.cc:303
size_t get_encoded_length(bool skip_tagged_gtids=false) const
Returns the length of this Gtid_set when encoded using the encode() function.
Definition: rpl_gtid_set.cc:1546
void _add_gtid(rpl_sidno sidno, rpl_gno gno)
Adds the given GTID to this Gtid_set.
Definition: rpl_gtid.h:1618
bool is_empty() const
Returns true if this Gtid_set is empty.
Definition: rpl_gtid.h:1822
static PSI_mutex_key key_gtid_executed_free_intervals_mutex
Definition: rpl_gtid.h:1558
static const String_format sql_string_format
String_format useful to generate an SQL string: the string is wrapped in single quotes and there is a...
Definition: rpl_gtid.h:2005
bool equals(const Gtid_set *other) const
Returns true if this Gtid_set is equal to the other Gtid_set.
Definition: rpl_gtid_set.cc:1007
enum_return_status add_gtid_encoding(const uchar *encoded, size_t length, size_t *actual_length=nullptr)
Decodes a Gtid_set from the given string.
Definition: rpl_gtid_set.cc:1428
void remove_intervals_for_sidno(Gtid_set *other, rpl_sidno sidno)
Removes all intervals of 'other' for a given SIDNO, from 'this'.
Definition: rpl_gtid_set.cc:676
bool is_subset_for_sidno(const Gtid_set *super, rpl_sidno superset_sidno, rpl_sidno subset_sidno) const
Returns true if this Gtid_set is a subset of the given gtid_set on the given superset_sidno and subse...
Definition: rpl_gtid_set.cc:1128
~Gtid_set()
Destroy this Gtid_set.
Definition: rpl_gtid_set.cc:119
bool has_cached_string_length
If the string is cached.
Definition: rpl_gtid.h:2478
const String_format * cached_string_format
The String_format that was used when cached_string_length was computed.
Definition: rpl_gtid.h:2482
void get_free_interval(Interval **out)
Returns a fresh new Interval object.
Definition: rpl_gtid_set.cc:244
size_t to_string(char *buf, bool need_lock=false, const String_format *string_format=nullptr) const
Formats this Gtid_set as a string and saves in a given buffer.
Definition: rpl_gtid_set.cc:796
void _remove_gtid(const Gtid >id)
Removes the given GTID from this Gtid_set.
Definition: rpl_gtid.h:1656
Checkable_rwlock * tsid_lock
Read-write lock that protects updates to the number of TSIDs.
Definition: rpl_gtid.h:2331
mysql::gtid::Gtid_format analyze_encoding_format(bool skip_tagged_gtids) const
Goes through recorded tsids.
Definition: rpl_gtid_set.cc:1510
void _remove_gtid(rpl_sidno sidno, rpl_gno gno)
Removes the given GTID from this Gtid_set.
Definition: rpl_gtid.h:1634
Tsid_map * get_tsid_map() const
Return the Tsid_map associated with this Gtid_set.
Definition: rpl_gtid.h:2013
void create_new_chunk(int size)
Allocates a new chunk of Intervals and adds them to the list of unused intervals.
Definition: rpl_gtid_set.cc:193
void _add_gtid(const Gtid >id)
Adds the given GTID to this Gtid_set.
Definition: rpl_gtid.h:1650
rpl_sidno get_max_sidno() const
Returns the maximal sidno that this Gtid_set currently has space for.
Definition: rpl_gtid.h:1757
void assert_free_intervals_locked()
Definition: rpl_gtid.h:2376
ulonglong get_gtid_count(rpl_sidno sidno) const
What is the count of all the GTIDs in all intervals for a sidno.
Definition: rpl_gtid.h:1845
Represents the server's GTID state: the set of committed GTIDs, the set of lost gtids,...
Definition: rpl_gtid.h:2853
bool update_gtids_impl_check_skip_gtid_rollback(THD *thd)
Used by unit tests that need to access private members.
Definition: rpl_gtid_state.cc:759
int init()
Add @GLOBAL.SERVER_UUID to this binlog's Tsid_map.
Definition: rpl_gtid_state.cc:651
Tsid_map * tsid_map
The Tsid_map used by this Gtid_state.
Definition: rpl_gtid.h:3556
bool update_gtids_impl_do_nothing(THD *thd)
This is a sub task of update_gtids_impl responsible only to handle the case of a thread that owns not...
Definition: rpl_gtid_state.cc:768
void end_automatic_gtid_violating_transaction()
Decrease the global counter when ending a GTID-violating transaction having GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3042
void broadcast_owned_sidnos(const THD *thd)
Broadcast the condition for all SIDNOs owned by the given THD.
Definition: rpl_gtid_state.cc:146
const Gtid_set * get_executed_gtids() const
Definition: rpl_gtid.h:3356
void unlock_sidnos(const Gtid_set *set)
Unlocks the mutex for each SIDNO where the given Gtid_set has at least one GTID.
Definition: rpl_gtid_state.cc:547
void print() const
Debug only: print this Gtid_state to stdout.
Definition: rpl_gtid.h:3431
const Gtid_set * get_lost_gtids() const
Return a pointer to the Gtid_set that contains the lost gtids.
Definition: rpl_gtid.h:3351
enum_return_status ensure_sidno()
Ensure that owned_gtids, executed_gtids, lost_gtids, gtids_only_in_table, previous_gtids_logged and t...
Definition: rpl_gtid_state.cc:561
void decrease_gtid_automatic_tagged_count()
Decrements atomic_automatic_tagged_gtid_session_count.
Definition: rpl_gtid.h:3386
void begin_anonymous_gtid_violating_transaction()
Increase the global counter when starting a GTID-violating transaction having GTID_NEXT=ANONYMOUS.
Definition: rpl_gtid.h:3072
const Tsid & get_server_tsid() const
Return the server's TSID.
Definition: rpl_gtid.h:3376
rpl_sidno server_sidno
The SIDNO for this server.
Definition: rpl_gtid.h:3579
bool wait_for_gtid_set(THD *thd, Gtid_set *gtid_set, double timeout, bool update_thd_status=true)
Wait until the given Gtid_set is included in @GLOBAL.GTID_EXECUTED.
Definition: rpl_gtid_state.cc:304
enum_return_status acquire_ownership(THD *thd, const Gtid >id)
Acquires ownership of the given GTID, on behalf of the given thread.
Definition: rpl_gtid_state.cc:80
void update_gtids_impl_own_nothing(THD *thd)
Handle the case that the thread owns nothing.
Definition: rpl_gtid_state.cc:940
void update_gtids_impl_lock_sidno(rpl_sidno sidno)
Lock a given sidno of a transaction being updated.
Definition: rpl_gtid_state.cc:819
std::atomic< int32 > atomic_anonymous_gtid_count
The number of anonymous transactions owned by any client.
Definition: rpl_gtid.h:3582
int save_gtids_of_last_binlog_into_table()
Save the set of gtids logged in the last binlog into gtid_executed table.
Definition: rpl_gtid_state.cc:694
void end_gtid_wait()
Decrease the global counter when ending a call to WAIT_FOR_EXECUTED_GTID_SET.
Definition: rpl_gtid.h:3139
bool is_any_session_assigning_automatic_tagged_gtids()
Checks whether there are ongoing sessions executing transactions with GTID_NEXT set to AUTOMATIC:tag.
Definition: rpl_gtid.h:3394
Gtid_set lost_gtids
The set of GTIDs that existed in some previously purged binary log.
Definition: rpl_gtid.h:3563
const Owned_gtids * get_owned_gtids() const
Return a pointer to the Owned_gtids that contains the owned gtids.
Definition: rpl_gtid.h:3372
void unlock_owned_sidnos(const THD *thd)
Unlock all SIDNOs owned by the given THD.
Definition: rpl_gtid_state.cc:134
Owned_gtids owned_gtids
The set of GTIDs that are owned by some thread.
Definition: rpl_gtid.h:3577
rpl_sidno get_server_sidno() const
Return the server's SIDNO.
Definition: rpl_gtid.h:3374
const Gtid_set * get_previous_gtids_logged() const
Definition: rpl_gtid.h:3368
void update_gtids_impl_broadcast_and_unlock_sidno(rpl_sidno sidno)
Unlock a given sidno after broadcasting its changes.
Definition: rpl_gtid_state.cc:904
Gtid_state(Checkable_rwlock *_tsid_lock, Tsid_map *_tsid_map)
Constructs a new Gtid_state object.
Definition: rpl_gtid.h:2862
int32 get_gtid_wait_count()
Return the number of clients that have an ongoing call to WAIT_FOR_EXECUTED_GTID_SET.
Definition: rpl_gtid.h:3156
char * to_string() const
Debug only: return a newly allocated string, or NULL on out-of-memory.
Definition: rpl_gtid.h:3424
int read_gtid_executed_from_table()
Fetch gtids from gtid_executed table and store them into gtid_executed set.
Definition: rpl_gtid_state.cc:744
Mutex_cond_array tsid_locks
Contains one mutex/cond pair for every SIDNO.
Definition: rpl_gtid.h:3558
Gtid_set previous_gtids_logged
Definition: rpl_gtid.h:3575
std::atomic< int64_t > atomic_automatic_tagged_gtid_session_count
The number of sessions that have GTID_NEXT set to AUTOMATIC with tag assigned.
Definition: rpl_gtid.h:3592
enum_return_status add_lost_gtids(Gtid_set *gtid_set, bool starts_with_plus)
Adds the given Gtid_set to lost_gtids and executed_gtids.
Definition: rpl_gtid_state.cc:607
bool wait_for_sidno(THD *thd, rpl_sidno sidno, struct timespec *abstime, bool update_thd_status=true)
Wait for a signal on the given SIDNO.
Definition: rpl_gtid_state.cc:269
const Gtid_set * get_gtids_only_in_table() const
Definition: rpl_gtid.h:3361
int compress(THD *thd)
Compress the gtid_executed table, read each row by the PK(sid, gno_start) in increasing order,...
Definition: rpl_gtid_state.cc:748
std::unordered_map< rpl_sidno, rpl_gno > next_free_gno_map
The next_free_gno map contains next_free_gno for recorded sidnos.
Definition: rpl_gtid.h:3193
int32 get_anonymous_gtid_violating_transaction_count()
Return the number of ongoing GTID-violating transactions having GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3114
void lock_sidnos(const Gtid_set *set)
Locks one mutex for each SIDNO where the given Gtid_set has at least one GTID.
Definition: rpl_gtid_state.cc:540
void assert_sidno_lock_owner(rpl_sidno sidno) const
Assert that we own the given SIDNO.
Definition: rpl_gtid.h:3246
enum_return_status ensure_commit_group_sidnos(rpl_sidno sidno)
Ensure that commit_group_sidnos have room for the SIDNO passed as parameter.
Definition: rpl_gtid_state.cc:950
void update_gtids_impl_own_anonymous(THD *thd, bool *more_trx)
Handle the case that the thread owns ANONYMOUS GTID.
Definition: rpl_gtid_state.cc:918
bool wait_for_gtid(THD *thd, const Gtid >id, struct timespec *abstime=nullptr)
This is only a shorthand for wait_for_sidno, which contains additional debug printouts and assertions...
Definition: rpl_gtid_state.cc:292
void acquire_anonymous_ownership()
Acquire anonymous ownership.
Definition: rpl_gtid.h:2986
int warn_or_err_on_modify_gtid_table(THD *thd, Table_ref *table)
Push a warning to client if user is modifying the gtid_executed table explicitly by a non-XA transact...
Definition: rpl_gtid_state.cc:752
void update_on_rollback(THD *thd)
Update the state after the given thread has rollbacked.
Definition: rpl_gtid_state.cc:213
Gtid_set gtids_only_in_table
Definition: rpl_gtid.h:3573
rpl_gno get_automatic_gno(rpl_sidno sidno) const
Computes the next available GNO.
Definition: rpl_gtid_state.cc:415
Gtid_set executed_gtids
Definition: rpl_gtid.h:3568
void update_gtids_impl_own_gtid(THD *thd, bool is_commit)
Handle the case that the thread own a single non-anonymous GTID.
Definition: rpl_gtid_state.cc:846
int32 get_automatic_gtid_violating_transaction_count()
Return the number of ongoing GTID-violating transactions having GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3064
void dbug_print(const char *text="") const
Print this Gtid_state to the trace file if debug is enabled; no-op otherwise.
Definition: rpl_gtid.h:3441
void update_commit_group(THD *first_thd)
This function updates both the THD and the Gtid_state to reflect that the transaction set of transact...
Definition: rpl_gtid_state.cc:158
void unlock_sidno(rpl_sidno sidno)
Unlocks a mutex for the given SIDNO.
Definition: rpl_gtid.h:3242
bool is_owned(const Gtid >id) const
Returns true if GTID is owned, otherwise returns 0.
Definition: rpl_gtid.h:2919
int to_string(char *buf) const
Debug only: Generate a string in the given buffer and return the length.
Definition: rpl_gtid.h:3411
bool is_executed(const Gtid >id) const
Returns true if the given GTID is logged.
Definition: rpl_gtid.h:2906
Prealloced_array< bool, 8 > commit_group_sidnos
This array is used by Gtid_state_update_gtids_impl* functions.
Definition: rpl_gtid.h:3832
void update_prev_gtids(Gtid_set *write_gtid_set)
Updates previously logged GTID set before writing to table.
Definition: rpl_gtid_state.cc:588
Checkable_rwlock * tsid_lock
Read-write lock that protects updates to the number of TSIDs.
Definition: rpl_gtid.h:3554
void end_gtid_violating_transaction(THD *thd)
Definition: rpl_gtid_state.cc:256
void begin_automatic_gtid_violating_transaction()
Increase the global counter when starting a GTID-violating transaction having GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3022
rpl_sidno specify_transaction_sidno(THD *thd, Gtid_state::Locked_sidno_set &sidno_set)
Determines sidno for thd transaction.
Definition: rpl_gtid_state.cc:479
void update_gtids_impl_broadcast_and_unlock_sidnos()
Unlocks all locked sidnos after broadcasting their changes.
Definition: rpl_gtid_state.cc:910
void lock_sidno(rpl_sidno sidno)
Locks a mutex for the given SIDNO.
Definition: rpl_gtid.h:3240
void update_gtids_impl_own_gtid_set(THD *thd, bool is_commit)
Handle the case that the thread own a set of GTIDs.
Definition: rpl_gtid_state.cc:791
void broadcast_sidnos(const Gtid_set *set)
Broadcasts the condition variable for each SIDNO where the given Gtid_set has at least one GTID.
Definition: rpl_gtid_state.cc:554
size_t get_max_string_length() const
Debug only: Returns an upper bound on the length of the string generated by to_string(),...
Definition: rpl_gtid.h:3404
std::atomic< int32 > atomic_automatic_gtid_violation_count
The number of GTID-violating transactions that use GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3584
std::atomic< int32 > atomic_gtid_wait_count
The number of clients that are executing WAIT_FOR_EXECUTED_GTID_SET.
Definition: rpl_gtid.h:3589
void end_anonymous_gtid_violating_transaction()
Decrease the global counter when ending a GTID-violating transaction having GTID_NEXT=ANONYMOUS.
Definition: rpl_gtid.h:3090
rpl_gno get_last_executed_gno(rpl_sidno sidno) const
Return the last executed GNO for a given SIDNO, e.g.
Definition: rpl_gtid_state.cc:468
int clear(THD *thd)
Reset the state and persistor after RESET BINARY LOGS AND GTIDS: remove all logged and lost gtids,...
Definition: rpl_gtid_state.cc:58
std::atomic< int32 > atomic_anonymous_gtid_violation_count
The number of GTID-violating transactions that use GTID_NEXT=AUTOMATIC.
Definition: rpl_gtid.h:3586
void update_on_commit(THD *thd)
Remove the GTID owned by thread from owned GTIDs, stating that thd->owned_gtid was committed.
Definition: rpl_gtid_state.cc:206
void update_gtids_impl_lock_sidnos(THD *thd)
Locks the sidnos of all the GTIDs of the commit group starting on the transaction passed as parameter...
Definition: rpl_gtid_state.cc:825
int32 get_anonymous_ownership_count()
Return the number of clients that hold anonymous ownership.
Definition: rpl_gtid.h:3016
void update_gtids_impl_end(THD *thd, bool more_trx)
Handle the final part of update_gtids_impl.
Definition: rpl_gtid_state.cc:946
int save(THD *thd)
Save gtid owned by the thd into executed_gtids variable and gtid_executed table.
Definition: rpl_gtid_state.cc:667
bool update_gtids_impl_begin(THD *thd)
This is a sub task of update_gtids_impl responsible only to evaluate if the thread is committing in t...
Definition: rpl_gtid_state.cc:781
void broadcast_sidno(rpl_sidno sidno)
Broadcasts updates for the given SIDNO.
Definition: rpl_gtid.h:3244
enum_return_status generate_automatic_gtid(THD *thd, rpl_sidno specified_sidno=0, rpl_gno specified_gno=0)
Generates the GTID (or ANONYMOUS, if GTID_MODE = OFF or OFF_PERMISSIVE) for the THD,...
Definition: rpl_gtid_state.cc:499
void release_anonymous_ownership()
Release anonymous ownership.
Definition: rpl_gtid.h:3001
void begin_gtid_wait()
Increase the global counter when starting a call to WAIT_FOR_EXECUTED_GTID_SET.
Definition: rpl_gtid.h:3122
void increase_gtid_automatic_tagged_count()
Increments atomic_automatic_tagged_gtid_session_count.
Definition: rpl_gtid.h:3381
void update_gtids_impl(THD *thd, bool is_commit)
Remove the GTID owned by thread from owned GTIDs.
Definition: rpl_gtid_state.cc:220
Malloc_allocator is a C++ STL memory allocator based on my_malloc/my_free.
Definition: malloc_allocator.h:63
Represents a growable array where each element contains a mutex and a condition variable.
Definition: rpl_gtid.h:947
Prealloced_array< Mutex_cond *, 8 > m_array
Definition: rpl_gtid.h:1070
bool is_thd_killed(const THD *thd) const
Return true if the given THD is killed.
Definition: rpl_gtid_mutex_cond_array.cc:96
void enter_cond(THD *thd, int n, PSI_stage_info *stage, PSI_stage_info *old_stage) const
Execute THD::enter_cond for the n'th condition variable.
Definition: rpl_gtid_mutex_cond_array.cc:66
Checkable_rwlock * global_lock
Read-write lock that protects updates to the number of elements.
Definition: rpl_gtid.h:1069
bool wait(const THD *thd, int sidno, struct timespec *abstime) const
Wait for signal on the n'th condition variable.
Definition: rpl_gtid.h:1009
Mutex_cond_array(Checkable_rwlock *global_lock)
Create a new Mutex_cond_array.
Definition: rpl_gtid_mutex_cond_array.cc:42
void broadcast(int n) const
Broadcast the n'th condition.
Definition: rpl_gtid.h:969
void assert_not_owner(int n) const
Assert that this thread does not own the n'th mutex.
Definition: rpl_gtid.h:985
~Mutex_cond_array()
Destroy this object.
Definition: rpl_gtid_mutex_cond_array.cc:48
void assert_owner(int n) const
Assert that this thread owns the n'th mutex.
Definition: rpl_gtid.h:976
void unlock(int n) const
Unlock the n'th mutex.
Definition: rpl_gtid.h:964
void lock(int n) const
Lock the n'th mutex.
Definition: rpl_gtid.h:959
Mutex_cond * get_mutex_cond(int n) const
Return the Nth Mutex_cond object.
Definition: rpl_gtid.h:1061
Iterator over all gtids in a Owned_gtids set.
Definition: rpl_gtid.h:2757
rpl_sidno max_sidno
Max SIDNO of the current iterator.
Definition: rpl_gtid.h:2812
Node * node
Current node on current SIDNO hash.
Definition: rpl_gtid.h:2819
malloc_unordered_multimap< rpl_gno, unique_ptr_my_free< Node > >::const_iterator node_it
Current node iterator on current SIDNO hash.
Definition: rpl_gtid.h:2817
const Owned_gtids * owned_gtids
The Owned_gtids set we iterate over.
Definition: rpl_gtid.h:2808
Node * get_node() const
Return the current GTID Node, or NULL if we reached the end.
Definition: rpl_gtid.h:2804
Gtid_iterator(const Owned_gtids *og)
Definition: rpl_gtid.h:2759
Gtid get() const
Return next GTID, or {0,0} if we reached the end.
Definition: rpl_gtid.h:2795
void next()
Advance to next GTID.
Definition: rpl_gtid.h:2769
rpl_sidno sidno
The SIDNO of the current element, or 1 in the initial iteration.
Definition: rpl_gtid.h:2810
malloc_unordered_multimap< rpl_gno, unique_ptr_my_free< Node > > * hash
Current SIDNO hash.
Definition: rpl_gtid.h:2814
Represents the set of GTIDs that are owned by some thread.
Definition: rpl_gtid.h:2565
size_t get_max_string_length() const
Return an upper bound on the length of the string representation of this Owned_gtids.
Definition: rpl_gtid.h:2661
Checkable_rwlock * tsid_lock
Read-write lock that protects updates to the number of TSIDs.
Definition: rpl_gtid.h:2734
char * to_string() const
Debug only: return a newly allocated string representation of this Owned_gtids.
Definition: rpl_gtid.h:2693
bool thread_owns_anything(my_thread_id thd_id) const
Return true if the given thread is the owner of any gtids.
Definition: rpl_gtid.h:2677
enum_return_status add_gtid_owner(const Gtid >id, my_thread_id owner)
Add a GTID to this Owned_gtids.
Definition: rpl_gtid_owned.cc:70
bool is_intersection_nonempty(const Gtid_set *other) const
Returns true if there is a least one element of this Owned_gtids set in the other Gtid_set.
Definition: rpl_gtid_owned.cc:104
bool is_owned_by(const Gtid >id, const my_thread_id thd_id) const
If thd_id==0, returns true when gtid is not owned by any thread.
Definition: rpl_gtid_owned.cc:138
bool is_empty() const
Returns true if this Owned_gtids is empty.
Definition: rpl_gtid.h:2617
int to_string(char *out) const
Write a string representation of this Owned_gtids to the given buffer.
Definition: rpl_gtid.h:2635
rpl_sidno get_max_sidno() const
Returns the maximal sidno that this Owned_gtids currently has space for.
Definition: rpl_gtid.h:2622
malloc_unordered_multimap< rpl_gno, unique_ptr_my_free< Node > > * get_hash(rpl_sidno sidno) const
Returns the hash for the given SIDNO.
Definition: rpl_gtid.h:2736
Prealloced_array< malloc_unordered_multimap< rpl_gno, unique_ptr_my_free< Node > > *, 8 > sidno_to_hash
Growable array of hashes.
Definition: rpl_gtid.h:2750
Owned_gtids(Checkable_rwlock *tsid_lock)
Constructs a new, empty Owned_gtids object.
Definition: rpl_gtid_owned.cc:39
void dbug_print(const char *text="") const
Print this Owned_gtids to the trace file if debug is enabled; no-op otherwise.
Definition: rpl_gtid.h:2711
void get_gtids(Gtid_set >id_set) const
Definition: rpl_gtid_owned.cc:117
bool contains_gtid(const Gtid >id) const
Return true iff this Owned_gtids object contains the given gtid.
Definition: rpl_gtid_owned.cc:131
~Owned_gtids()
Destroys this Owned_gtids.
Definition: rpl_gtid_owned.cc:43
void print() const
Debug only: print this Owned_gtids to stdout.
Definition: rpl_gtid.h:2701
enum_return_status ensure_sidno(rpl_sidno sidno)
Ensures that this Owned_gtids object can accommodate SIDNOs up to the given SIDNO.
Definition: rpl_gtid_owned.cc:56
void remove_gtid(const Gtid >id, const my_thread_id owner)
Removes the given GTID.
Definition: rpl_gtid_owned.cc:89
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:167
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Represents a bidirectional map between TSID and SIDNO.
Definition: rpl_gtid.h:749
rpl_sidno add_tsid(const Tsid &tsid)
Add the given TSID to this map if it does not already exist.
Definition: rpl_gtid_tsid_map.cc:61
enum_return_status copy(Tsid_map *dest)
Deep copy this Tsid_map to dest.
Definition: rpl_gtid_tsid_map.cc:145
Tsid_to_sidno_map::const_iterator Tsid_to_sidno_it
Definition: rpl_gtid.h:773
~Tsid_map()
Destroy this Tsid_map.
Definition: rpl_gtid_tsid_map.cc:51
Tsid_map(Checkable_rwlock *tsid_lock)
Create this Tsid_map.
Definition: rpl_gtid_tsid_map.cc:46
rpl_sidno get_max_sidno() const
Return the biggest sidno in this Tsid_map.
Definition: rpl_gtid.h:866
Checkable_rwlock * get_tsid_lock() const
Return the tsid_lock.
Definition: rpl_gtid.h:872
Tsid_to_sidno_umap _tsid_to_sidno
Hash that maps TSID to SIDNO.
Definition: rpl_gtid.h:915
rpl_sidno tsid_to_sidno(const Tsid &tsid) const
Get the SIDNO for a given TSID.
Definition: rpl_gtid.h:801
Tsid_to_sidno_map _sorted
Data structure that maps numbers in the interval [0, get_max_sidno()-1] to SIDNOs,...
Definition: rpl_gtid.h:922
Sidno_to_tsid_cont _sidno_to_tsid
Array that maps SIDNO to TSID; the element at index N points to a Node with SIDNO N-1.
Definition: rpl_gtid.h:909
enum_return_status clear()
Clears this Tsid_map (for RESET REPLICA)
Definition: rpl_gtid_tsid_map.cc:53
const rpl_sidno & get_sidno(const Tsid_to_sidno_it &it) const
Definition: rpl_gtid.h:850
Checkable_rwlock * tsid_lock
Read-write lock that protects updates to the number of SIDNOs.
Definition: rpl_gtid.h:903
const Tsid & get_tsid(const Tsid_to_sidno_it &it) const
Definition: rpl_gtid.h:855
const Tsid & sidno_to_tsid(rpl_sidno sidno, bool need_lock=false) const
Get the TSID for a given SIDNO.
Definition: rpl_gtid.h:827
std::vector< Tsid_ref, Malloc_allocator< Tsid_ref > > Sidno_to_tsid_cont
Definition: rpl_gtid.h:775
std::reference_wrapper< const Tsid > Tsid_ref
Definition: rpl_gtid.h:774
enum_return_status add_node(rpl_sidno sidno, const Tsid &tsid)
Create a Node from the given SIDNO and a TSID and add it to _sidno_to_tsid, _tsid_to_sidno,...
Definition: rpl_gtid_tsid_map.cc:101
Map_myalloc< Tsid, rpl_sidno > Tsid_to_sidno_map
Definition: rpl_gtid.h:772
const Tsid_to_sidno_map & get_sorted_sidno() const
Returns TSID to SID map.
Definition: rpl_gtid.h:848
Set that keeps track of TSID locks taken in the current scope.
Definition: locked_sidno_set.h:45
std::unordered_multimap, but with my_malloc, so that you can track the memory used using PSI memory k...
Definition: map_helpers.h:198
Represents a MySQL Global Transaction Identifier.
Definition: gtid.h:51
Representation of the GTID tag.
Definition: tag.h:51
Represents Transaction Source Identifier which is composed of source UUID and transaction tag.
Definition: tsid.h:47
std::string to_string() const
Returns textual representation of Transaction Source Identifier.
Definition: tsid.cpp:34
#define mysql_cond_wait(C, M)
Definition: mysql_cond.h:48
#define mysql_cond_timedwait(C, M, T)
Definition: mysql_cond.h:51
#define mysql_mutex_lock(M)
Definition: mysql_mutex.h:50
#define mysql_mutex_unlock(M)
Definition: mysql_mutex.h:57
#define mysql_rwlock_rdlock(T)
Definition: mysql_rwlock.h:61
#define mysql_rwlock_unlock(T)
Definition: mysql_rwlock.h:91
#define mysql_rwlock_init(K, T)
Definition: mysql_rwlock.h:41
#define mysql_rwlock_tryrdlock(T)
Definition: mysql_rwlock.h:81
#define mysql_rwlock_destroy(T)
Definition: mysql_rwlock.h:51
#define mysql_rwlock_trywrlock(T)
Definition: mysql_rwlock.h:86
#define mysql_rwlock_wrlock(T)
Definition: mysql_rwlock.h:71
static char buf[MAX_BUF]
Definition: conf_to_src.cc:73
const char * p
Definition: ctype-mb.cc:1235
#define MY_WME
Definition: my_sys.h:128
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
unsigned int PSI_mutex_key
Instrumented mutex key.
Definition: psi_mutex_bits.h:52
unsigned int PSI_rwlock_key
Instrumented rwlock key.
Definition: psi_rwlock_bits.h:44
#define mysql_mutex_assert_not_owner(M)
Wrapper, to use safe_mutex_assert_not_owner with instrumented mutexes.
Definition: mysql_mutex.h:126
#define mysql_mutex_assert_owner(M)
Wrapper, to use safe_mutex_assert_owner with instrumented mutexes.
Definition: mysql_mutex.h:112
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:180
A better implementation of the UNIX ctype(3) library.
std::map< Key, Value, Compare, Map_allocator_type< Key, Value > > Map_myalloc
Map using custom Malloc_allocator allocator.
Definition: map_helpers.h:147
#define DBUG_PRINT(keyword, arglist)
Definition: my_dbug.h:181
#define DBUG_TRACE
Definition: my_dbug.h:146
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
int64_t int64
Definition: my_inttypes.h:68
#define MYF(v)
Definition: my_inttypes.h:97
int32_t int32
Definition: my_inttypes.h:66
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
#define HAVE_PSI_INTERFACE
Definition: my_psi_config.h:39
static int is_timeout(int e)
Definition: my_thread.h:57
uint32 my_thread_id
Definition: my_thread_local.h:34
int(* mysql_cond_broadcast)(mysql_cond_t *that, const char *src_file, unsigned int src_line)
Definition: mysql_cond_service.h:52
void copy(Shards< COUNT > &dst, const Shards< COUNT > &src) noexcept
Copy the counters, overwrite destination.
Definition: ut0counter.h:354
Type sub(Shards< COUNT > &shards, size_t id, size_t n)
Decrement the counter for a shard by n.
Definition: ut0counter.h:280
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: buf0block_hint.cc:30
Definition: locked_sidno_set.cc:26
int rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: sidno.h:27
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
Provides atomic access in shared-exclusive modes.
Definition: shared_spin_lock.h:79
static bool timeout(bool(*wait_condition)())
Timeout function.
Definition: log0meb.cc:498
type
Definition: base.h:40
constexpr auto tsid_max_length
Maximum TSID text length (without null character)
Definition: tsid.h:41
Gtid_format
Gtid binary format indicator.
Definition: gtid_format.h:38
std::int64_t gno_t
Definition: global.h:37
Return_status
Simple, strongly-typed enumeration to indicate internal status: ok, error.
Definition: return_status.h:41
HARNESS_EXPORT std::string string_format(const char *format,...)
Definition: utilities.cc:64
size_t size(const char *const c)
Definition: base64.h:46
static mysql_service_status_t flush(reference_caching_cache cache) noexcept
Definition: component.cc:114
Cursor end()
A past-the-end Cursor.
Definition: rules_table_service.cc:192
mode
Definition: file_handle.h:61
std::set< Key, Compare, ut::allocator< Key > > set
Specialization of set which uses ut_allocator.
Definition: ut0new.h:2882
static std::mutex lock
Definition: net_ns.cc:56
#define NODISCARD
The function attribute [[NODISCARD]] is a replacement for [[nodiscard]] to workaround a gcc bug.
Definition: nodiscard.h:47
Instrumentation helpers for conditions.
Instrumentation helpers for rwlock.
PSI_memory_key key_memory_tsid_map_Node
Definition: rpl_gtid_tsid_map.cc:44
required uint32 status
Definition: replication_asynchronous_connection_failover.proto:61
repeated Action action
Definition: replication_group_member_actions.proto:43
rpl_gno get_last_executed_gno(rpl_sidno sidno)
Return last gno for a given sidno, see Gtid_state::get_last_executed_gno() for details.
Definition: rpl_gtid_misc.cc:303
const int MAX_THREAD_ID_TEXT_LENGTH
The maximal possible length of thread_id when printed in decimal.
Definition: rpl_gtid.h:288
const rpl_gno GNO_WARNING_THRESHOLD
If the GNO goes above the number, generate a warning.
Definition: rpl_gtid.h:284
ulong _gtid_consistency_mode
Current value for ENFORCE_GTID_CONSISTENCY.
Definition: rpl_gtid_misc.cc:63
const rpl_gno GNO_END
One-past-the-max value of GNO.
Definition: rpl_gtid.h:282
enum_return_status map_macro_enum(int status)
enum to map the result of Uuid::parse to the above Macros
Definition: rpl_gtid.h:234
enum_gtid_consistency_mode get_gtid_consistency_mode()
Return the current value of ENFORCE_GTID_CONSISTENCY.
Definition: rpl_gtid_misc.cc:70
void gtid_state_commit_or_rollback(THD *thd, bool needs_to, bool do_commit)
The function commits or rolls back the gtid state if it needs to.
Definition: rpl_gtid.h:4307
PSI_memory_key key_memory_Gtid_cache_to_string
mysql::gtid::gno_t rpl_gno
GNO, the second (numeric) component of a GTID, is an alias of mysql::gtid::gno_t.
Definition: rpl_gtid.h:112
enum_return_status
Generic return type for many functions that can succeed or fail.
Definition: rpl_gtid.h:137
@ RETURN_STATUS_OK
The function completed successfully.
Definition: rpl_gtid.h:139
@ RETURN_STATUS_UNREPORTED_ERROR
The function completed with error but did not report it.
Definition: rpl_gtid.h:141
@ RETURN_STATUS_REPORTED_ERROR
The function completed with error and has called my_error.
Definition: rpl_gtid.h:143
bool set_gtid_next(THD *thd, const Gtid_specification &spec)
Acquire ownership of the given Gtid_specification.
Definition: rpl_gtid_execution.cc:46
const char * gtid_consistency_mode_names[]
Strings holding the enumeration values for gtid_consistency_mode_names.
Definition: rpl_gtid_misc.cc:64
const mysql::gtid::Tsid & get_tsid_from_global_tsid_map(rpl_sidno sidno)
Return Tsid for a given sidno on the global_tsid_map.
Definition: rpl_gtid_misc.cc:297
int format_gno(char *s, rpl_gno gno)
Formats a GNO as a string.
Definition: rpl_gtid_set.cc:422
mysql::gtid::Uuid rpl_sid
Definition: rpl_gtid.h:308
Gtid_mode global_gtid_mode
The one and only instance of Gtid_mode.
Definition: rpl_gtid_mode.cc:31
const int MAX_GNO_TEXT_LENGTH
The length of MAX_GNO when printed in decimal.
Definition: rpl_gtid.h:286
PSI_memory_key key_memory_Gtid_state_group_commit_sidno
Definition: rpl_gtid_state.cc:52
bool is_already_logged_transaction(const THD *thd)
Check if current transaction should be skipped, that is, if GTID_NEXT was already logged.
Definition: rpl_gtid_execution.cc:332
void gtid_set_performance_schema_values(const THD *thd)
Definition: rpl_gtid_execution.cc:607
bool gtid_reacquire_ownership_if_anonymous(THD *thd)
If gtid_next=ANONYMOUS or NOT_YET_DETERMINED, but the thread does not hold anonymous ownership,...
Definition: rpl_gtid_execution.cc:391
enum_gtid_statement_status
Indicates if a statement should be skipped or not.
Definition: rpl_gtid.h:4158
@ GTID_STATEMENT_CANCEL
Statement should be cancelled.
Definition: rpl_gtid.h:4162
@ GTID_STATEMENT_EXECUTE
Statement can execute.
Definition: rpl_gtid.h:4160
@ GTID_STATEMENT_SKIP
Statement should be skipped, but there may be an implicit commit after the statement if gtid_commit i...
Definition: rpl_gtid.h:4167
bool gtid_pre_statement_post_implicit_commit_checks(THD *thd)
Perform GTID-related checks before executing a statement, but after executing an implicit commit befo...
Definition: rpl_gtid_execution.cc:577
int64 rpl_binlog_pos
Definition: rpl_gtid.h:113
rpl_gno parse_gno(const char **s)
Parse a GNO from a string.
Definition: rpl_gtid_set.cc:414
PSI_memory_key key_memory_Gtid_set_Interval_chunk
Definition: rpl_gtid_set.cc:68
Tsid_map * global_tsid_map
Definition: mysqld.cc:1825
const char * get_gtid_consistency_mode_string(enum_gtid_consistency_mode mode)
Return the given GTID_CONSISTENCY_MODE as a string.
Definition: rpl_gtid.h:268
Gtid_state * gtid_state
Global state of GTIDs.
Definition: mysqld.cc:1826
PSI_memory_key key_memory_Gtid_set_to_string
Definition: rpl_gtid_set.cc:67
#define RETURN_OK
Returns RETURN_STATUS_OK.
Definition: rpl_gtid.h:225
std::ostream & operator<<(std::ostream &oss, Gtid_mode::value_type const &mode)
Definition: rpl_gtid_mode.cc:72
enum_gtid_consistency_mode
Possible values for ENFORCE_GTID_CONSISTENCY.
Definition: rpl_gtid.h:245
@ GTID_CONSISTENCY_MODE_ON
Definition: rpl_gtid.h:247
@ GTID_CONSISTENCY_MODE_WARN
Definition: rpl_gtid.h:248
@ GTID_CONSISTENCY_MODE_OFF
Definition: rpl_gtid.h:246
PSI_memory_key key_memory_Owned_gtids_to_string
Definition: psi_memory_key.cc:67
rpl_sidno get_sidno_from_global_tsid_map(const mysql::gtid::Tsid &tsid)
Return sidno for a given tsid, see Tsid_map::add_sid() for details.
Definition: rpl_gtid_misc.cc:287
Checkable_rwlock * global_tsid_lock
Protects Gtid_state. See comment above gtid_state for details.
Definition: mysqld.cc:1824
enum_gtid_type
Enumeration of different types of values for Gtid_specification, i.e, the different internal states t...
Definition: rpl_gtid.h:3860
@ UNDEFINED_GTID
GTID_NEXT is set to this state after a transaction with GTID_NEXT=='UUID:NUMBER' is committed.
Definition: rpl_gtid.h:3929
@ ANONYMOUS_GTID
Specifies that the transaction is anonymous, i.e., it does not have a GTID and will never be assigned...
Definition: rpl_gtid.h:3895
@ ASSIGNED_GTID
Specifies that the transaction has been assigned a GTID (UUID:NUMBER).
Definition: rpl_gtid.h:3885
@ PRE_GENERATE_GTID
The applier sets GTID_NEXT this state internally, when it processes an Anonymous_gtid_log_event on a ...
Definition: rpl_gtid.h:3966
@ NOT_YET_DETERMINED_GTID
Definition: rpl_gtid.h:3956
@ AUTOMATIC_GTID
Specifies that the GTID has not been generated yet; it will be generated on commit.
Definition: rpl_gtid.h:3877
void check_return_status(enum_return_status status, const char *action, const char *status_name, int allow_unreported)
Definition: rpl_gtid_misc.cc:260
enum_gtid_statement_status gtid_pre_statement_checks(THD *thd)
Perform GTID-related checks before executing a statement:
Definition: rpl_gtid_execution.cc:469
cs::index::rpl_sidno rpl_sidno
Type of SIDNO (source ID number, first component of GTID)
Definition: rpl_gtid.h:108
#define RETURN_UNREPORTED_ERROR
Does a DBUG_PRINT and returns RETURN_STATUS_UNREPORTED_ERROR.
Definition: rpl_gtid.h:229
PSI_memory_key key_memory_Gtid_state_to_string
Definition: psi_memory_key.cc:50
mysql::gtid::Tsid Tsid
Definition: rpl_gtid_state.cc:56
#define MAX_SLAVE_ERRMSG
Maximum size of an error message from a slave thread.
Definition: rpl_reporting.h:42
Holds information about a GTID interval: the sidno, the first gno and the last gno of this interval.
Definition: rpl_gtid.h:1077
rpl_gno gno_start
Definition: rpl_gtid.h:1081
rpl_gno gno_end
Definition: rpl_gtid.h:1083
void set(rpl_sidno sid_no, rpl_gno start, rpl_gno end)
Definition: rpl_gtid.h:1084
rpl_sidno sidno
Definition: rpl_gtid.h:1079
Contains a list of intervals allocated by this Gtid_set.
Definition: rpl_gtid.h:2253
Interval intervals[1]
Definition: rpl_gtid.h:2255
Interval_chunk * next
Definition: rpl_gtid.h:2254
Represents one element in the linked list of intervals associated with a SIDNO.
Definition: rpl_gtid.h:2019
rpl_gno start
The first GNO of this interval.
Definition: rpl_gtid.h:2022
rpl_gno end
The first GNO after this interval.
Definition: rpl_gtid.h:2024
bool equals(const Interval &other) const
Return true iff this interval is equal to the given interval.
Definition: rpl_gtid.h:2026
Interval * next
Pointer to next interval in list.
Definition: rpl_gtid.h:2030
Holds information about a Gtid_set.
Definition: rpl_gtid.h:2518
Gtid_set * gtid_set
Pointer to the Gtid_set.
Definition: rpl_gtid.h:2520
Gtid_set * set_non_null(Tsid_map *sm)
Do nothing if this object is non-null; set to empty set otherwise.
Definition: rpl_gtid.h:2533
Gtid_set * get_gtid_set() const
Return NULL if this is NULL, otherwise return the Gtid_set.
Definition: rpl_gtid.h:2524
void set_null()
Set this Gtid_set to NULL.
Definition: rpl_gtid.h:2544
bool is_non_null
True if this Gtid_set is NULL.
Definition: rpl_gtid.h:2522
This struct represents a specification of a GTID for a statement to be executed: either "AUTOMATIC",...
Definition: rpl_gtid.h:3977
static constexpr auto str_anonymous
Definition: rpl_gtid.h:3984
void set_not_yet_determined()
Set the type to NOT_YET_DETERMINED_GTID.
Definition: rpl_gtid.h:4063
mysql::utils::Return_status parse(Tsid_map *tsid_map, const char *text)
Parses the given string and stores in this Gtid_specification.
Definition: rpl_gtid_specification.cc:62
static constexpr auto str_automatic_tagged
Definition: rpl_gtid.h:3980
static constexpr auto str_automatic
Definition: rpl_gtid.h:3979
enum_gtid_type type
The type of this GTID.
Definition: rpl_gtid.h:3990
bool is_undefined() const
Helper function indicating whether this is an undefined GTID.
Definition: rpl_gtid.h:4029
static bool is_valid(const char *text)
Returns true if the given string is a valid Gtid_specification.
Definition: rpl_gtid_specification.cc:98
Gtid gtid
The GTID: { SIDNO, GNO } if type == GTID; { 0, 0 } if type == AUTOMATIC or ANONYMOUS.
Definition: rpl_gtid.h:3996
bool is_assigned() const
Helper function indicating whether this is an assigned GTID.
Definition: rpl_gtid.h:4033
static constexpr auto str_pre_generated
Definition: rpl_gtid.h:3982
static constexpr auto str_automatic_sep
Definition: rpl_gtid.h:3981
bool equals(const Gtid_specification &other) const
Return true if this Gtid_specification is equal to 'other'.
Definition: rpl_gtid.h:4074
Tag_plain automatic_tag
Tag defined by the user while specifying GTID_NEXT="AUTOMATIC:TAG".
Definition: rpl_gtid.h:4001
bool is_automatic_tagged() const
Helper function indicating whether this is to-be-generated GTID with a tag assigned.
Definition: rpl_gtid_specification.cc:58
static bool is_tagged(const char *text)
Returns true if the given string is a tagged Gtid_specification.
Definition: rpl_gtid_specification.cc:116
void set(const Gtid >id_param)
Set the type to ASSIGNED_GTID and TSID, GNO to the given Gtid.
Definition: rpl_gtid.h:4047
mysql::gtid::Tag Tag
Definition: rpl_gtid.h:3987
bool is_automatic() const
Helper function indicating whether this is to-be-generated GTID.
Definition: rpl_gtid.h:4025
static const int MAX_TEXT_LENGTH
Definition: rpl_gtid.h:4104
void dbug_print(const char *text="", bool need_lock=false) const
Print this Gtid_specification to the trace file if debug is enabled; no-op otherwise.
Definition: rpl_gtid.h:4141
std::size_t automatic_to_string(char *buf) const
Prints automatic tag specification to the given buffer.
Definition: rpl_gtid_specification.cc:133
void set_anonymous()
Set the type to ANONYMOUS_GTID.
Definition: rpl_gtid.h:4058
void set_undefined()
Set to undefined. Must only be called if the type is ASSIGNED_GTID.
Definition: rpl_gtid.h:4068
int to_string(const Tsid_map *tsid_map, char *buf, bool need_lock=false) const
Writes this Gtid_specification to the given string buffer.
Definition: rpl_gtid_specification.cc:180
void set_automatic()
Set the type to AUTOMATIC_GTID.
Definition: rpl_gtid.h:4049
void set(rpl_sidno sidno, rpl_gno gno)
Set the type to ASSIGNED_GTID and SIDNO, GNO to the given values.
Definition: rpl_gtid.h:4009
static constexpr auto str_not_yet_determined
Definition: rpl_gtid.h:3983
bool equals(const Gtid &other_gtid) const
Return true if this Gtid_specification is a ASSIGNED_GTID with the same TSID, GNO as 'other_gtid'.
Definition: rpl_gtid.h:4082
static bool is_automatic(const enum_gtid_type &type)
Helper function indicating whether this is to-be-generated GTID.
Definition: rpl_gtid.h:4019
void print() const
Debug only: print this Gtid_specification to stdout.
Definition: rpl_gtid.h:4131
Tag generate_tag() const
Returns tag object generated from internal tag data.
Definition: rpl_gtid_specification.cc:56
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11.
Definition: rpl_gtid.h:1100
static const int MAX_TEXT_LENGTH
The maximal length of the textual representation of a TSID, not including the terminating '\0'.
Definition: rpl_gtid.h:1137
mysql::utils::Return_status parse(Tsid_map *tsid_map, const char *text)
Parses the given string and stores in this Gtid.
Definition: rpl_gtid_misc.cc:186
bool is_empty() const
Return true if sidno is zero (and assert that gno is zero too in this case).
Definition: rpl_gtid.h:1125
int to_string_gno(char *buf) const
Converts internal gno into the string.
Definition: rpl_gtid_misc.cc:205
void set(rpl_sidno sidno_arg, rpl_gno gno_arg)
Set both components to the given, positive values.
Definition: rpl_gtid.h:1114
void clear()
Set both components to 0.
Definition: rpl_gtid.h:1109
void print(const Tsid_map *tsid_map) const
Debug only: print this Gtid to stdout.
Definition: rpl_gtid.h:1202
void dbug_print(const Tsid_map *tsid_map, const char *text="", bool need_lock=false) const
Print this Gtid to the trace file if debug is enabled; no-op otherwise.
Definition: rpl_gtid.h:1209
rpl_gno gno
GNO of this Gtid.
Definition: rpl_gtid.h:1106
static std::tuple< mysql::utils::Return_status, rpl_sid, std::size_t > parse_sid_str(const char *text, std::size_t pos)
Parses SID from a textual representation of the GTID.
Definition: rpl_gtid_misc.cc:84
static constexpr auto gtid_separator
Definition of GTID separator (colon) which separates UUID and GNO.
Definition: rpl_gtid.h:1198
static void report_parsing_error(const char *text)
Helper used to report BINLOG error.
Definition: rpl_gtid_misc.cc:136
static std::pair< mysql::utils::Return_status, std::size_t > parse_gtid_separator(const char *text, std::size_t pos)
Parses GTID separator from a textual representation of the GTID (text)
Definition: rpl_gtid_misc.cc:142
static std::pair< mysql::utils::Return_status, mysql::gtid::Gtid > parse_gtid_from_cstring(const char *text)
Parses GTID from text.
Definition: rpl_gtid_misc.cc:156
static std::pair< Tag, std::size_t > parse_tag_str(const char *text, std::size_t pos)
Parses TAG from a textual representation of the GTID (text)
Definition: rpl_gtid_misc.cc:101
rpl_sidno sidno
SIDNO of this Gtid.
Definition: rpl_gtid.h:1104
static std::size_t skip_whitespace(const char *text, std::size_t pos)
Helper function used to skip whitespaces in GTID specification.
Definition: rpl_gtid_misc.cc:76
bool equals(const Gtid &other) const
Returns true if this Gtid has the same sid and gno as 'other'.
Definition: rpl_gtid.h:1165
static std::tuple< mysql::utils::Return_status, rpl_gno, std::size_t > parse_gno_str(const char *text, std::size_t pos)
Parses GNO from a textual representation of the GTID (text)
Definition: rpl_gtid_misc.cc:111
static bool is_valid(const char *text)
Returns true if parse() would succeed, but doesn't store the result anywhere.
Definition: rpl_gtid_misc.cc:252
int to_string(const Tsid &tsid, char *buf) const
Convert a Gtid to a string.
Definition: rpl_gtid_misc.cc:214
Struct representing a duration.
Definition: my_time.h:228
A mutex/cond pair.
Definition: rpl_gtid.h:1056
mysql_mutex_t mutex
Definition: rpl_gtid.h:1057
mysql_cond_t cond
Definition: rpl_gtid.h:1058
Represents one owned GTID.
Definition: rpl_gtid.h:2727
my_thread_id owner
Owner of the GTID.
Definition: rpl_gtid.h:2731
rpl_gno gno
GNO of the GTID.
Definition: rpl_gtid.h:2729
Stage instrument information.
Definition: psi_stage_bits.h:74
Structure to store the GTID and timing information.
Definition: rpl_gtid.h:1262
Trx_monitoring_info & operator=(const Trx_monitoring_info &)=default
uint last_transient_error_number
Number of the last transient error of this transaction.
Definition: rpl_gtid.h:1278
ulonglong last_transient_error_timestamp
Timestamp in microseconds of the last transient error of this transaction.
Definition: rpl_gtid.h:1282
Gtid gtid
GTID being monitored.
Definition: rpl_gtid.h:1264
ulonglong end_time
When the GTID transaction finished to be processed.
Definition: rpl_gtid.h:1272
void copy_to_ps_table(Tsid_map *tsid_map, char *gtid_arg, uint *gtid_length_arg, ulonglong *original_commit_ts_arg, ulonglong *immediate_commit_ts_arg, ulonglong *start_time_arg) const
Copies this transaction monitoring information to the output parameters passed as input,...
Definition: rpl_gtid_misc.cc:352
ulonglong immediate_commit_timestamp
ICT of the GTID being monitored.
Definition: rpl_gtid.h:1268
bool is_retrying
True when the transaction is retrying.
Definition: rpl_gtid.h:1286
mysql::binlog::event::compression::type compression_type
The compression type.
Definition: rpl_gtid.h:1288
bool skipped
True if the GTID is being applied but will be skipped.
Definition: rpl_gtid.h:1274
void clear()
Clear all fields of the structure.
Definition: rpl_gtid_misc.cc:334
ulonglong original_commit_timestamp
OCT of the GTID being monitored.
Definition: rpl_gtid.h:1266
ulong transaction_retries
Number of times this transaction was retried.
Definition: rpl_gtid.h:1284
Trx_monitoring_info()
Constructor.
Definition: rpl_gtid_misc.cc:313
ulonglong uncompressed_bytes
The uncompressed bytes.
Definition: rpl_gtid.h:1292
ulonglong compressed_bytes
The compressed bytes.
Definition: rpl_gtid.h:1290
char last_transient_error_message[MAX_SLAVE_ERRMSG]
Message of the last transient error of this transaction.
Definition: rpl_gtid.h:1280
bool is_info_set
True when this information contains useful data.
Definition: rpl_gtid.h:1276
ulonglong start_time
When the GTID transaction started to be processed.
Definition: rpl_gtid.h:1270
Tag representation so that:
Definition: tag_plain.h:48
void clear()
Clear this tag.
Definition: tag_plain.cpp:37
Uuid is a trivial and of standard layout The structure contains the following components.
Definition: uuid.h:64
An instrumented cond structure.
Definition: mysql_cond_bits.h:50
An instrumented mutex structure.
Definition: mysql_mutex_bits.h:50
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:51
int n
Definition: xcom_base.cc:509