MySQL 8.4.2
Source Code Documentation
|
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11. More...
#include <rpl_gtid.h>
Public Types | |
using | Tsid = mysql::gtid::Tsid |
using | Tag = mysql::gtid::Tag |
Public Member Functions | |
void | clear () |
Set both components to 0. More... | |
void | set (rpl_sidno sidno_arg, rpl_gno gno_arg) |
Set both components to the given, positive values. More... | |
bool | is_empty () const |
Return true if sidno is zero (and assert that gno is zero too in this case). More... | |
int | to_string (const Tsid &tsid, char *buf) const |
Convert a Gtid to a string. More... | |
int | to_string (const Tsid_map *tsid_map, char *buf, bool need_lock=false) const |
Convert this Gtid to a string. More... | |
bool | equals (const Gtid &other) const |
Returns true if this Gtid has the same sid and gno as 'other'. More... | |
mysql::utils::Return_status | parse (Tsid_map *tsid_map, const char *text) |
Parses the given string and stores in this Gtid. More... | |
void | print (const Tsid_map *tsid_map) const |
Debug only: print this Gtid to stdout. More... | |
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. More... | |
Static Public Member Functions | |
static bool | is_valid (const char *text) |
Returns true if parse() would succeed, but doesn't store the result anywhere. More... | |
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) More... | |
static void | report_parsing_error (const char *text) |
Helper used to report BINLOG error. More... | |
static std::pair< mysql::utils::Return_status, mysql::gtid::Gtid > | parse_gtid_from_cstring (const char *text) |
Parses GTID from text. More... | |
Public Attributes | |
rpl_sidno | sidno |
SIDNO of this Gtid. More... | |
rpl_gno | gno |
GNO of this Gtid. More... | |
Static Public Attributes | |
static const int | MAX_TEXT_LENGTH |
The maximal length of the textual representation of a TSID, not including the terminating '\0'. More... | |
static constexpr auto | gtid_separator = ':' |
Definition of GTID separator (colon) which separates UUID and GNO. More... | |
Protected Member Functions | |
int | to_string_gno (char *buf) const |
Converts internal gno into the string. More... | |
Static Protected Member Functions | |
static std::size_t | skip_whitespace (const char *text, std::size_t pos) |
Helper function used to skip whitespaces in GTID specification. More... | |
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. More... | |
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) More... | |
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) More... | |
TODO: Move this structure to mysql/binlog/event/control_events.h when we start using C++11.
Holds information about a GTID: the sidno and the gno.
This is a POD. It has to be a POD because it is part of Gtid_specification, which has to be a POD because it is used in THD::variables.
using Gtid::Tag = mysql::gtid::Tag |
using Gtid::Tsid = mysql::gtid::Tsid |
|
inline |
Set both components to 0.
|
inline |
Print this Gtid to the trace file if debug is enabled; no-op otherwise.
|
inline |
Returns true if this Gtid has the same sid and gno as 'other'.
|
inline |
Return true if sidno is zero (and assert that gno is zero too in this case).
|
static |
Returns true if parse() would succeed, but doesn't store the result anywhere.
Return_status Gtid::parse | ( | Tsid_map * | tsid_map, |
const char * | text | ||
) |
Parses the given string and stores in this Gtid.
tsid_map | tsid_map to use when converting TSID to a sidno. |
text | The text to parse |
|
staticprotected |
Parses GNO from a textual representation of the GTID (text)
[in] | text | String with full GTID specification |
[in] | pos | Current position within a text |
|
static |
Parses GTID from text.
In case GTID is valid, it will return "ok" status code and a valid mysql::gtid::Gtid object. Otherwise, it will return an empty Gtid and error
[in] | text | Text containing textual representation of a GTID |
|
staticprotected |
Parses GTID separator from a textual representation of the GTID (text)
[in] | text | String with full GTID specification |
[in] | pos | Current position within a text |
|
staticprotected |
Parses SID from a textual representation of the GTID.
[in] | text | String with full GTID specification |
[in] | pos | Current position within a text |
|
static |
Parses TAG from a textual representation of the GTID (text)
[in] | text | String with full GTID specification |
[in] | pos | Current position within a text |
|
inline |
Debug only: print this Gtid to stdout.
|
static |
Helper used to report BINLOG error.
[in] | text | String with full GTID specification |
Set both components to the given, positive values.
|
staticprotected |
Helper function used to skip whitespaces in GTID specification.
[in] | text | String with full GTID specification |
[in] | pos | Current position within a text |
int Gtid::to_string | ( | const Tsid & | tsid, |
char * | buf | ||
) | const |
Convert a Gtid to a string.
tsid | the TSID to use. This overrides the sidno of this Gtid. | |
[out] | buf | Buffer to store the Gtid in (normally MAX_TEXT_LENGTH+1 bytes long). |
int Gtid::to_string | ( | const Tsid_map * | tsid_map, |
char * | buf, | ||
bool | need_lock = false |
||
) | const |
Convert this Gtid to a string.
tsid_map | tsid_map to use when converting sidno to a TSID. | |
[out] | buf | Buffer to store the Gtid in (normally MAX_TEXT_LENGTH+1 bytes long). |
need_lock | If true, the function will acquire tsid_map->tsid_lock; otherwise it will assert that the lock is held. |
|
protected |
Converts internal gno into the string.
[out] | buf | Buffer to store the GNO in |
rpl_gno Gtid::gno |
GNO of this Gtid.
|
staticconstexpr |
Definition of GTID separator (colon) which separates UUID and GNO.
|
static |
The maximal length of the textual representation of a TSID, not including the terminating '\0'.
rpl_sidno Gtid::sidno |
SIDNO of this Gtid.