MySQL 8.0.39
Source Code Documentation
Gtid Struct Reference

TODO: Move this structure to libbinlogevents/include/control_events.h when we start using C++11. More...

#include <rpl_gtid.h>

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 rpl_sid &sid, char *buf) const
 Convert a Gtid to a string. More...
 
int to_string (const Sid_map *sid_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...
 
enum_return_status parse (Sid_map *sid_map, const char *text)
 Parses the given string and stores in this Gtid. More...
 
void print (const Sid_map *sid_map) const
 Debug only: print this Gtid to stdout. More...
 
void dbug_print (const Sid_map *sid_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)
 Return true if parse() would succeed, but don't store the result anywhere. 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 SID, not including the terminating '\0'. More...
 

Detailed Description

TODO: Move this structure to libbinlogevents/include/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.

Member Function Documentation

◆ clear()

void Gtid::clear ( )
inline

Set both components to 0.

◆ dbug_print()

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

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

◆ equals()

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

Returns true if this Gtid has the same sid and gno as 'other'.

◆ is_empty()

bool Gtid::is_empty ( ) const
inline

Return true if sidno is zero (and assert that gno is zero too in this case).

◆ is_valid()

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

Return true if parse() would succeed, but don't store the result anywhere.

◆ parse()

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

Parses the given string and stores in this Gtid.

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::print ( const Sid_map sid_map) const
inline

Debug only: print this Gtid to stdout.

◆ set()

void Gtid::set ( rpl_sidno  sidno_arg,
rpl_gno  gno_arg 
)
inline

Set both components to the given, positive values.

◆ to_string() [1/2]

int Gtid::to_string ( const rpl_sid sid,
char *  buf 
) const

Convert a Gtid to a string.

Parameters
sidthe sid to use. This overrides the sidno of this Gtid.
[out]bufBuffer to store the Gtid in (normally MAX_TEXT_LENGTH+1 bytes long).
Returns
Length of the string, not counting '\0'.

◆ to_string() [2/2]

int Gtid::to_string ( const Sid_map sid_map,
char *  buf,
bool  need_lock = false 
) const

Convert this Gtid to a string.

Parameters
sid_mapsid_map to use when converting sidno to a SID.
[out]bufBuffer to store the Gtid in (normally MAX_TEXT_LENGTH+1 bytes long).
need_lockIf true, the function will acquire sid_map->sid_lock; otherwise it will assert that the lock is held.
Returns
Length of the string, not counting '\0'.

Member Data Documentation

◆ gno

rpl_gno Gtid::gno

GNO of this Gtid.

◆ MAX_TEXT_LENGTH

const int Gtid::MAX_TEXT_LENGTH
static
Initial value:
=
const int MAX_GNO_TEXT_LENGTH
The length of MAX_GNO when printed in decimal.
Definition: rpl_gtid.h:271
static const size_t TEXT_LENGTH
The number of bytes in the textual representation of a Uuid.
Definition: uuid.h:160

The maximal length of the textual representation of a SID, not including the terminating '\0'.

◆ sidno

rpl_sidno Gtid::sidno

SIDNO of this Gtid.


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