MySQL 8.0.40
Source Code Documentation
Gtid_specification Struct Reference

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

#include <rpl_gtid.h>

Public Member Functions

void set (rpl_sidno sidno, rpl_gno gno)
 Set the type to ASSIGNED_GTID and SID, GNO to the given values. More...
 
void set (const Gtid &gtid_param)
 Set the type to ASSIGNED_GTID and SID, GNO to the given Gtid. More...
 
void set_automatic ()
 Set the type to AUTOMATIC_GTID. 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 SID, GNO as 'other_gtid'. More...
 
enum_return_status parse (Sid_map *sid_map, const char *text)
 Parses the given string and stores in this Gtid_specification. More...
 
int to_string (const Sid_map *sid_map, char *buf, bool need_lock=false) const
 Writes this Gtid_specification to the given string buffer. More...
 
int to_string (const rpl_sid *sid, 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_valid (const char *text)
 Returns true if the given string is a valid 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...
 

Static Public Attributes

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", "ANONYMOUS", or "SID:GNO".

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

Member Function Documentation

◆ 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 SID, 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'.

◆ is_valid()

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

Returns true if the given string is a valid Gtid_specification.

◆ parse()

enum_return_status Gtid_specification::parse ( Sid_map sid_map,
const char *  text 
)

Parses the given string and stores in this Gtid_specification.

Parameters
sid_mapsid_map to use when converting SID to a sidno.
textThe text to parse
Returns
RETURN_STATUS_OK or RETURN_STATUS_REPORTED_ERROR.

◆ print()

void Gtid_specification::print ( ) const
inline

Debug only: print this Gtid_specification to stdout.

◆ set() [1/2]

void Gtid_specification::set ( const Gtid gtid_param)
inline

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

◆ set() [2/2]

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

Set the type to ASSIGNED_GTID and SID, 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 rpl_sid sid,
char *  buf 
) const

Writes this Gtid_specification to the given string buffer.

Parameters
sidSID 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 Sid_map sid_map,
char *  buf,
bool  need_lock = false 
) const

Writes this Gtid_specification to the given string buffer.

Parameters
sid_mapSid_map to use if the type of this Gtid_specification is ASSIGNED_GTID.
[out]bufThe buffer
need_lockIf true, this function acquires global_sid_lock before looking up the sidno in sid_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

◆ 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

◆ type

enum_gtid_type Gtid_specification::type

The type of this GTID.


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