MySQL 9.1.0
Source Code Documentation
Gtid_specification Struct Reference

This struct represents a specification of a GTID for a statement to be executed: either "AUTOMATIC", "AUTOMATIC:<tag>", "ANONYMOUS" or "TSID:GNO". More...

#include <rpl_gtid.h>

Public Types

using Tsid = mysql::gtid::Tsid
 
using Tag = mysql::gtid::Tag
 
using Tag_plain = mysql::gtid::Tag_plain
 

Public Member Functions

std::size_t automatic_to_string (char *buf) const
 Prints automatic tag specification to the given buffer. More...
 
void set (rpl_sidno sidno, rpl_gno gno)
 Set the type to ASSIGNED_GTID and SIDNO, GNO to the given values. More...
 
bool is_automatic () const
 Helper function indicating whether this is to-be-generated GTID. More...
 
bool is_undefined () const
 Helper function indicating whether this is an undefined GTID. More...
 
bool is_assigned () const
 Helper function indicating whether this is an assigned GTID. More...
 
Tag generate_tag () const
 Returns tag object generated from internal tag data. More...
 
bool is_automatic_tagged () const
 Helper function indicating whether this is to-be-generated GTID with a tag assigned. More...
 
void set (const Gtid &gtid_param)
 Set the type to ASSIGNED_GTID and TSID, GNO to the given Gtid. More...
 
void set_automatic ()
 Set the type to AUTOMATIC_GTID. More...
 
void set (const Gtid_specification &other)
 Copy spec from other. More...
 
void set_anonymous ()
 Set the type to ANONYMOUS_GTID. More...
 
void set_not_yet_determined ()
 Set the type to NOT_YET_DETERMINED_GTID. More...
 
void set_undefined ()
 Set to undefined. Must only be called if the type is ASSIGNED_GTID. More...
 
bool equals (const Gtid_specification &other) const
 Return true if this Gtid_specification is equal to 'other'. More...
 
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'. More...
 
mysql::utils::Return_status parse (Tsid_map *tsid_map, const char *text)
 Parses the given string and stores in this Gtid_specification. More...
 
int to_string (const Tsid_map *tsid_map, char *buf, bool need_lock=false) const
 Writes this Gtid_specification to the given string buffer. More...
 
int to_string (const Tsid &tsid, char *buf) const
 Writes this Gtid_specification to the given string buffer. More...
 
void print () const
 Debug only: print this Gtid_specification to stdout. More...
 
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. More...
 

Static Public Member Functions

static bool is_automatic (const enum_gtid_type &type)
 Helper function indicating whether this is to-be-generated GTID. More...
 
static bool is_valid (const char *text)
 Returns true if the given string is a valid Gtid_specification. More...
 
static bool is_tagged (const char *text)
 Returns true if the given string is a tagged Gtid_specification. More...
 

Public Attributes

enum_gtid_type type
 The type of this GTID. More...
 
Gtid gtid
 The GTID: { SIDNO, GNO } if type == GTID; { 0, 0 } if type == AUTOMATIC or ANONYMOUS. More...
 
Tag_plain automatic_tag
 Tag defined by the user while specifying GTID_NEXT="AUTOMATIC:TAG". More...
 

Static Public Attributes

static constexpr auto str_automatic = "AUTOMATIC"
 
static constexpr auto str_automatic_tagged = "AUTOMATIC:"
 
static constexpr auto str_automatic_sep = ":"
 
static constexpr auto str_pre_generated = "PRE_GENERATE_GTID"
 
static constexpr auto str_not_yet_determined = "NOT_YET_DETERMINED"
 
static constexpr auto str_anonymous = "ANONYMOUS"
 
static const int MAX_TEXT_LENGTH = Gtid::MAX_TEXT_LENGTH
 

Detailed Description

This struct represents a specification of a GTID for a statement to be executed: either "AUTOMATIC", "AUTOMATIC:<tag>", "ANONYMOUS" or "TSID:GNO".

This is a POD. It has to be a POD because it is used in THD::variables.

Member Typedef Documentation

◆ Tag

◆ Tag_plain

◆ Tsid

Member Function Documentation

◆ automatic_to_string()

std::size_t Gtid_specification::automatic_to_string ( char *  buf) const

Prints automatic tag specification to the given buffer.

Parameters
[in,out]bufBuffer to write to, must be allocated
Returns
The number of bytes written to the buffer

◆ dbug_print()

void Gtid_specification::dbug_print ( const char *  text = "",
bool  need_lock = false 
) const
inline

Print this Gtid_specification to the trace file if debug is enabled; no-op otherwise.

◆ equals() [1/2]

bool Gtid_specification::equals ( const Gtid other_gtid) const
inline

Return true if this Gtid_specification is a ASSIGNED_GTID with the same TSID, GNO as 'other_gtid'.

◆ equals() [2/2]

bool Gtid_specification::equals ( const Gtid_specification other) const
inline

Return true if this Gtid_specification is equal to 'other'.

◆ generate_tag()

Tag Gtid_specification::generate_tag ( ) const

Returns tag object generated from internal tag data.

Returns
Tag object

◆ is_assigned()

bool Gtid_specification::is_assigned ( ) const
inline

Helper function indicating whether this is an assigned GTID.

Returns
Returns true for assigned GTIDs

◆ is_automatic() [1/2]

bool Gtid_specification::is_automatic ( ) const
inline

Helper function indicating whether this is to-be-generated GTID.

Return values
trueThis GTID will be generated
falseOther type of the GTID

◆ is_automatic() [2/2]

static bool Gtid_specification::is_automatic ( const enum_gtid_type type)
inlinestatic

Helper function indicating whether this is to-be-generated GTID.

Parameters
[in]typeType of the GTID
Return values
trueThis GTID will be generated
falseOther type of the GTID

◆ is_automatic_tagged()

bool Gtid_specification::is_automatic_tagged ( ) const

Helper function indicating whether this is to-be-generated GTID with a tag assigned.

Return values
trueThis GTID will be generated with assigned tag
falseOther type of the GTID

◆ is_tagged()

bool Gtid_specification::is_tagged ( const char *  text)
static

Returns true if the given string is a tagged Gtid_specification.

Parameters
[in]textTextual representation of the GTID specification

◆ is_undefined()

bool Gtid_specification::is_undefined ( ) const
inline

Helper function indicating whether this is an undefined GTID.

Returns
Returns true for undefined GTIDs

◆ is_valid()

bool Gtid_specification::is_valid ( const char *  text)
static

Returns true if the given string is a valid Gtid_specification.

Parameters
[in]textTextual representation of the GTID specification

◆ parse()

Return_status Gtid_specification::parse ( Tsid_map tsid_map,
const char *  text 
)

Parses the given string and stores in this Gtid_specification.

Parameters
tsid_maptsid_map to use when converting TSID to a sidno.
textThe text to parse
Returns
operation status

◆ print()

void Gtid_specification::print ( ) const
inline

Debug only: print this Gtid_specification to stdout.

◆ set() [1/3]

void Gtid_specification::set ( const Gtid gtid_param)
inline

Set the type to ASSIGNED_GTID and TSID, GNO to the given Gtid.

gtid_param GTID to copy from

◆ set() [2/3]

void Gtid_specification::set ( const Gtid_specification other)

Copy spec from other.

Parameters
[in]otherPattern to copy from

◆ set() [3/3]

void Gtid_specification::set ( rpl_sidno  sidno,
rpl_gno  gno 
)
inline

Set the type to ASSIGNED_GTID and SIDNO, GNO to the given values.

◆ set_anonymous()

void Gtid_specification::set_anonymous ( )
inline

Set the type to ANONYMOUS_GTID.

◆ set_automatic()

void Gtid_specification::set_automatic ( )
inline

Set the type to AUTOMATIC_GTID.

◆ set_not_yet_determined()

void Gtid_specification::set_not_yet_determined ( )
inline

Set the type to NOT_YET_DETERMINED_GTID.

◆ set_undefined()

void Gtid_specification::set_undefined ( )
inline

Set to undefined. Must only be called if the type is ASSIGNED_GTID.

◆ to_string() [1/2]

int Gtid_specification::to_string ( const Tsid tsid,
char *  buf 
) const

Writes this Gtid_specification to the given string buffer.

Parameters
tsidTSID to use if the type of this Gtid_specification is ASSIGNED_GTID. Can be NULL if this Gtid_specification is ANONYMOUS_GTID or AUTOMATIC_GTID.
[out]bufThe buffer
Return values
Thenumber of characters written.

◆ to_string() [2/2]

int Gtid_specification::to_string ( const Tsid_map tsid_map,
char *  buf,
bool  need_lock = false 
) const

Writes this Gtid_specification to the given string buffer.

Parameters
tsid_mapTsid_map to use if the type of this Gtid_specification is ASSIGNED_GTID.
[out]bufThe buffer
need_lockIf true, this function acquires global_tsid_lock before looking up the sidno in tsid_map, and then releases it. If false, this function asserts that the lock is held by the caller.
Return values
Thenumber of characters written.

Member Data Documentation

◆ automatic_tag

Tag_plain Gtid_specification::automatic_tag

Tag defined by the user while specifying GTID_NEXT="AUTOMATIC:TAG".

We must store here the information about tag, because automatic tagged GTID does not have sidno assigned

◆ gtid

Gtid Gtid_specification::gtid

The GTID: { SIDNO, GNO } if type == GTID; { 0, 0 } if type == AUTOMATIC or ANONYMOUS.

◆ MAX_TEXT_LENGTH

const int Gtid_specification::MAX_TEXT_LENGTH = Gtid::MAX_TEXT_LENGTH
static

◆ str_anonymous

constexpr auto Gtid_specification::str_anonymous = "ANONYMOUS"
staticconstexpr

◆ str_automatic

constexpr auto Gtid_specification::str_automatic = "AUTOMATIC"
staticconstexpr

◆ str_automatic_sep

constexpr auto Gtid_specification::str_automatic_sep = ":"
staticconstexpr

◆ str_automatic_tagged

constexpr auto Gtid_specification::str_automatic_tagged = "AUTOMATIC:"
staticconstexpr

◆ str_not_yet_determined

constexpr auto Gtid_specification::str_not_yet_determined = "NOT_YET_DETERMINED"
staticconstexpr

◆ str_pre_generated

constexpr auto Gtid_specification::str_pre_generated = "PRE_GENERATE_GTID"
staticconstexpr

◆ type

enum_gtid_type Gtid_specification::type

The type of this GTID.


The documentation for this struct was generated from the following files: