MySQL 8.0.39
Source Code Documentation
Gtid_table_persistor Class Reference

#include <rpl_gtid_persist.h>

Public Member Functions

 Gtid_table_persistor ()=default
 
virtual ~Gtid_table_persistor ()=default
 
int save (THD *thd, const Gtid *gtid)
 Insert the gtid into table. More...
 
int save (const Gtid_set *gtid_set, bool compress=true)
 Insert the gtid set into table. More...
 
int reset (THD *thd)
 Delete all rows from the table. More...
 
int fetch_gtids (Gtid_set *gtid_set)
 Fetch gtids from gtid_executed table and store them into gtid_executed set. More...
 
int compress (THD *thd)
 Compress the gtid_executed table completely by employing one or more transactions. More...
 
int warn_or_err_on_explicit_modification (THD *thd, Table_ref *table)
 Push a warning to client if user is modifying the gtid_executed table explicitly by a non-XA transaction. More...
 

Static Public Attributes

static const uint number_fields = 3
 

Private Member Functions

int compress_in_single_transaction (THD *thd, bool &is_complete)
 Compress the gtid_executed table, read each row by the PK(sid, gno_start) in increasing order, compress the first consecutive range of gtids within a single transaction. More...
 
int compress_first_consecutive_range (TABLE *table, bool &is_complete)
 Read each row by the PK(sid, gno_start) in increasing order, compress the first consecutive range of gtids. More...
 
int fill_fields (Field **fields, const char *sid, rpl_gno gno_start, rpl_gno gno_end)
 Fill a gtid interval into fields of the gtid_executed table. More...
 
int write_row (TABLE *table, const char *sid, rpl_gno gno_start, rpl_gno gno_end)
 Write a gtid interval into the gtid_executed table. More...
 
int update_row (TABLE *table, const char *sid, rpl_gno gno_start, rpl_gno new_gno_end)
 Update a gtid interval in the gtid_executed table. More...
 
int delete_all (TABLE *table)
 Delete all rows in the gtid_executed table. More...
 
std::string encode_gtid_text (TABLE *table)
 Encode the current row fetched from the table into gtid text. More...
 
void get_gtid_interval (TABLE *table, std::string &sid, rpl_gno &gno_start, rpl_gno &gno_end)
 Get gtid interval from the the current row of the table. More...
 
int save (TABLE *table, const Gtid_set *gtid_set)
 Insert the gtid set into table. More...
 
Gtid_table_persistoroperator= (const Gtid_table_persistor &info)
 
 Gtid_table_persistor (const Gtid_table_persistor &info)
 

Private Attributes

std::atomic< int64m_atomic_count {0}
 

Constructor & Destructor Documentation

◆ Gtid_table_persistor() [1/2]

Gtid_table_persistor::Gtid_table_persistor ( )
default

◆ ~Gtid_table_persistor()

virtual Gtid_table_persistor::~Gtid_table_persistor ( )
virtualdefault

◆ Gtid_table_persistor() [2/2]

Gtid_table_persistor::Gtid_table_persistor ( const Gtid_table_persistor info)
private

Member Function Documentation

◆ compress()

int Gtid_table_persistor::compress ( THD thd)

Compress the gtid_executed table completely by employing one or more transactions.

Parameters
thdThread requesting to compress the table
Return values
0OK
1The table was not found.
-1Error

◆ compress_first_consecutive_range()

int Gtid_table_persistor::compress_first_consecutive_range ( TABLE table,
bool &  is_complete 
)
private

Read each row by the PK(sid, gno_start) in increasing order, compress the first consecutive range of gtids.

For example, 1 1 2 2 3 3 6 6 7 7 8 8 After the compression, the gtids in the table is compressed as following: 1 3 6 6 7 7 8 8

Parameters
tableReference to a table object.
[out]is_completeTrue if the gtid_executed table is compressd completely.
Return values
0OK.
-1Error.

◆ compress_in_single_transaction()

int Gtid_table_persistor::compress_in_single_transaction ( THD thd,
bool &  is_complete 
)
private

Compress the gtid_executed table, read each row by the PK(sid, gno_start) in increasing order, compress the first consecutive range of gtids within a single transaction.

Parameters
thdThread requesting to compress the table
[out]is_completeTrue if the gtid_executed table is compressd completely.
Return values
0OK
1The table was not found.
-1Error

◆ delete_all()

int Gtid_table_persistor::delete_all ( TABLE table)
private

Delete all rows in the gtid_executed table.

Parameters
tableReference to a table object.
Return values
0OK.
-1Error.

◆ encode_gtid_text()

string Gtid_table_persistor::encode_gtid_text ( TABLE table)
private

Encode the current row fetched from the table into gtid text.

Parameters
tableReference to a table object.
Return values
Returnthe encoded gtid text.

◆ fetch_gtids()

int Gtid_table_persistor::fetch_gtids ( Gtid_set gtid_set)

Fetch gtids from gtid_executed table and store them into gtid_executed set.

Parameters
[out]gtid_setstore gtids fetched from the gtid_executed table.
Return values
0OK
1The table was not found.
-1Error

◆ fill_fields()

int Gtid_table_persistor::fill_fields ( Field **  fields,
const char *  sid,
rpl_gno  gno_start,
rpl_gno  gno_end 
)
private

Fill a gtid interval into fields of the gtid_executed table.

Parameters
fieldsReference to table fields.
sidThe source id of the gtid interval.
gno_startThe first GNO of the gtid interval.
gno_endThe last GNO of the gtid interval.
Return values
0OK.
-1Error.

◆ get_gtid_interval()

void Gtid_table_persistor::get_gtid_interval ( TABLE table,
std::string &  sid,
rpl_gno gno_start,
rpl_gno gno_end 
)
private

Get gtid interval from the the current row of the table.

Parameters
tableReference to a table object.
[out]sidThe source id of the gtid interval.
[out]gno_startThe first GNO of the gtid interval.
[out]gno_endThe last GNO of the gtid interval.

◆ operator=()

Gtid_table_persistor & Gtid_table_persistor::operator= ( const Gtid_table_persistor info)
private

◆ reset()

int Gtid_table_persistor::reset ( THD thd)

Delete all rows from the table.

Parameters
thdThread requesting to reset the table
Return values
0OK
1The table was not found.
-1Error

◆ save() [1/3]

int Gtid_table_persistor::save ( const Gtid_set gtid_set,
bool  compress = true 
)

Insert the gtid set into table.

Parameters
gtid_setcontains a set of gtid, which holds the sidno and the gno.
compressnotify to compress gtid_executed table
Return values
0OK
-1Error

◆ save() [2/3]

int Gtid_table_persistor::save ( TABLE table,
const Gtid_set gtid_set 
)
private

Insert the gtid set into table.

Parameters
tableThe gtid_executed table.
gtid_setContains a set of gtid, which holds the sidno and the gno.
Return values
0OK
-1Error

◆ save() [3/3]

int Gtid_table_persistor::save ( THD thd,
const Gtid gtid 
)

Insert the gtid into table.

Parameters
thdThread requesting to save gtid into the table
gtidholds the sidno and the gno.
Return values
0OK
1The table was not found.
-1Error

◆ update_row()

int Gtid_table_persistor::update_row ( TABLE table,
const char *  sid,
rpl_gno  gno_start,
rpl_gno  new_gno_end 
)
private

Update a gtid interval in the gtid_executed table.

  • locate the gtid interval by primary key (sid, gno_start) to update it with the new_gno_end.
Parameters
tableReference to a table object.
sidThe source id of the gtid interval.
gno_startThe first GNO of the gtid interval.
new_gno_endThe new last GNO of the gtid interval.
Return values
0OK.
-1Error.

◆ warn_or_err_on_explicit_modification()

int Gtid_table_persistor::warn_or_err_on_explicit_modification ( THD thd,
Table_ref table 
)
inline

Push a warning to client if user is modifying the gtid_executed table explicitly by a non-XA transaction.

Push an error to client if user is modifying it explicitly by a XA transaction.

Parameters
thdThread requesting to access the table
tableThe table is being accessed.
Return values
0No warning or error was pushed to the client.
1Push a warning to client.
2Push an error to client.

◆ write_row()

int Gtid_table_persistor::write_row ( TABLE table,
const char *  sid,
rpl_gno  gno_start,
rpl_gno  gno_end 
)
private

Write a gtid interval into the gtid_executed table.

Parameters
tableReference to a table object.
sidThe source id of the gtid interval.
gno_startThe first GNO of the gtid interval.
gno_endThe last GNO of the gtid interval.
Return values
0OK.
-1Error.

Member Data Documentation

◆ m_atomic_count

std::atomic<int64> Gtid_table_persistor::m_atomic_count {0}
private

◆ number_fields

const uint Gtid_table_persistor::number_fields = 3
static

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