MySQL 9.1.0
Source Code Documentation
|
Class that is responsible for holding available GTIDs and assigning GTID blocks to specific group members. More...
#include <gtid_generator_for_sidno.h>
Public Member Functions | |
Gtid_generator_for_sidno (rpl_sidno sidno, std::size_t block_size) | |
Constructs Gtid_generator_for_sidno for a given sidno and block_size. More... | |
std::pair< rpl_gno, mysql::utils::Return_status > | get_next_available_gtid (const char *member_uuid, const Gtid_set >id_set) |
Generates gno for transaction originating from server identified with the 'member_uuid' When needed, function will consult gtid_set for the list of available GTIDs. More... | |
void | compute_group_available_gtid_intervals (const Gtid_set >id_set) |
For a given sidno, clear the assigned blocks for all members, and compute the available GTID intervals for the sidno. More... | |
Private Types | |
enum class | Gno_generation_result { ok , gno_exhausted , gtid_block_overflow , error } |
Represents result of GNO generation function. More... | |
using | Interval_container_type = std::list< Gtid_set::Interval > |
Interval container type, list of intervals. More... | |
using | Assigned_intervals_container_type = std::unordered_map< std::string, Gtid_set::Interval > |
Container type hold currently assigned intervals (value) for the given member (key) More... | |
using | Assigned_intervals_it = Assigned_intervals_container_type::iterator |
Type of iterator of assigned_gtids. More... | |
Private Member Functions | |
Gtid_set::Interval | reserve_gtid_block (longlong block_size, const Gtid_set >id_set) |
This function reserves a block of GTIDs from the list of available GTIDs. More... | |
std::pair< rpl_gno, Gno_generation_result > | get_next_available_gtid_candidate (rpl_gno start, rpl_gno end, const Gtid_set >id_set) const |
Generate the candidate GNO for the current transaction. More... | |
Assigned_intervals_it | get_assigned_interval (const std::string &member_uuid, const Gtid_set >id_set) |
gets Interval assigned to the given member More... | |
Assigned_intervals_it | reserve_gtid_block (const std::string &member_uuid, const Gtid_set >id_set) |
Allocates GTID block for the given member. More... | |
Private Attributes | |
rpl_sidno | m_sidno |
Sidno for which this map has been created. More... | |
long | m_block_size |
Block size used to assign GTIDs. More... | |
std::size_t | m_counter |
The number of assigned GTIDs. More... | |
Interval_container_type | m_available_intervals |
Free intervals. More... | |
Assigned_intervals_container_type | m_assigned_intervals |
Holds currently assigned intervals for the given member. More... | |
Class that is responsible for holding available GTIDs and assigning GTID blocks to specific group members.
|
private |
Container type hold currently assigned intervals (value) for the given member (key)
|
private |
Type of iterator of assigned_gtids.
|
private |
Interval container type, list of intervals.
|
strongprivate |
gr::Gtid_generator_for_sidno::Gtid_generator_for_sidno | ( | rpl_sidno | sidno, |
std::size_t | block_size | ||
) |
Constructs Gtid_generator_for_sidno for a given sidno and block_size.
sidno | Sidno assigned to this object |
block_size | Object will reserve blocks of this size |
void gr::Gtid_generator_for_sidno::compute_group_available_gtid_intervals | ( | const Gtid_set & | gtid_set | ) |
For a given sidno, clear the assigned blocks for all members, and compute the available GTID intervals for the sidno.
Clearing the assigned blocks implies that subsequent GTID assignments will assign new blocks for any member that commits a transaction, picking them from the available intervals for the sidno. The available intervals for the sidno, which this function also recomputes, consists of the list of intervals that are not in the given gtid_set, i.e., the complement of the set for that sidno. For example, if gtid_set is equal to UUID1:11-47,UUID2:1-100, and sidno corresponds to UUID1, then this will compute the set consisting of the two intervals [1,10] and [48,MAX_GNO].
gtid_set | Gtid set under consideration |
|
private |
gets Interval assigned to the given member
member_uuid | UUID of a group member |
gtid_set | Gtid set under consideration |
std::pair< rpl_gno, mysql::utils::Return_status > gr::Gtid_generator_for_sidno::get_next_available_gtid | ( | const char * | member_uuid, |
const Gtid_set & | gtid_set | ||
) |
Generates gno for transaction originating from server identified with the 'member_uuid' When needed, function will consult gtid_set for the list of available GTIDs.
member_uuid | UUID of a group member from which trx originates |
gtid_set | Currently used GTID set |
|
private |
Generate the candidate GNO for the current transaction.
The candidate will be on the interval [start, end] or a error be returned. This method will consult group_gtid_executed (or group_gtid_extracted) to avoid generate the same value twice.
start | The first possible value for the GNO |
end | The last possible value for the GNO |
gtid_set | Gtid set under consideration |
This method walks through available intervals for the given sidno until it finds the correct one. Returns a free GTID or one of the error codes.
|
private |
Allocates GTID block for the given member.
member_uuid | UUID of a group member |
gtid_set | Gtid set under consideration |
|
private |
This function reserves a block of GTIDs from the list of available GTIDs.
block_size | Size of the reserved block |
gtid_set | Gtid set under consideration |
|
private |
Holds currently assigned intervals for the given member.
|
private |
Free intervals.
|
private |
Block size used to assign GTIDs.
|
private |
The number of assigned GTIDs.
|
private |
Sidno for which this map has been created.