MySQL 9.1.0
Source Code Documentation
Group_member_info_manager Class Reference

Implementation of the interface Group_member_info_manager_interface. More...

#include <member_info.h>

Inheritance diagram for Group_member_info_manager:
[legend]

Public Member Functions

 Group_member_info_manager (Group_member_info *local_member_info, PSI_mutex_key psi_mutex_key=key_GR_LOCK_group_member_info_manager_update_lock)
 
 ~Group_member_info_manager () override
 
void * operator new (size_t size, const std::nothrow_t &) noexcept
 
void operator delete (void *ptr, const std::nothrow_t &) noexcept
 
void * operator new (size_t size) noexcept
 Allocate memory on the heap with instrumented memory allocation, so that memory consumption can be tracked. More...
 
void operator delete (void *ptr) noexcept
 Deallocate memory on the heap with instrumented memory allocation, so that memory consumption can be tracked. More...
 
size_t get_number_of_members () override
 Number of members in the group. More...
 
size_t get_number_of_members_online () override
 Number of ONLINE members in the group. More...
 
bool is_member_info_present (const std::string &uuid) override
 Is the member present in the group info. More...
 
bool get_group_member_info (const std::string &uuid, Group_member_info &member_info_arg) override
 Retrieves a registered Group member by its uuid. More...
 
bool get_group_member_info_by_index (int idx, Group_member_info &member_info_arg) override
 Retrieves a registered Group member by an index function. More...
 
Member_version get_group_lowest_online_version () override
 Return lowest member version. More...
 
bool get_group_member_info_by_member_id (const Gcs_member_identifier &id, Group_member_info &member_info_arg) override
 Retrieves a registered Group member by its backbone GCS identifier. More...
 
std::pair< bool, std::string > get_group_member_uuid_from_member_id (const Gcs_member_identifier &id) override
 Returns the member-uuid of the given GCS identifier. More...
 
Group_member_info::Group_member_status get_group_member_status_by_member_id (const Gcs_member_identifier &id) override
 Return the status of the member with the given GCS identifier. More...
 
Group_member_info_listget_all_members () override
 Retrieves all Group members managed by this site. More...
 
std::list< Gcs_member_identifier > * get_online_members_with_guarantees (const Gcs_member_identifier &exclude_member) override
 Retrieves all ONLINE Group members managed by this site, or NULL if any group member version is from a version lower than TRANSACTION_WITH_GUARANTEES_VERSION. More...
 
void add (Group_member_info *new_member) override
 Adds a new member to be managed by this Group manager. More...
 
void update (Group_member_info *update_local_member) override
 Removes all members of the group and update new local member. More...
 
void update (Group_member_info_list *new_members) override
 Updates all members of the group. More...
 
void update_member_status (const std::string &uuid, Group_member_info::Group_member_status new_status, Notification_context &ctx) override
 Updates the status of a single member. More...
 
void set_member_unreachable (const std::string &uuid) override
 Sets the identified member as unreachable. More...
 
void set_member_reachable (const std::string &uuid) override
 Sets the identified member as reachable. More...
 
void update_gtid_sets (const std::string &uuid, std::string &gtid_executed, std::string &purged_gtids, std::string &gtid_retrieved) override
 Updates the GTID sets on a single member. More...
 
void update_member_role (const std::string &uuid, Group_member_info::Group_member_role new_role, Notification_context &ctx) override
 Updates the role of a single member. More...
 
void update_group_primary_roles (const std::string &uuid, Notification_context &ctx) override
 Updates the primary/secondary roles of the group. More...
 
void update_member_weight (const std::string &uuid, uint member_weight) override
 Updates the weight of a single member. More...
 
void update_primary_member_flag (bool in_primary_mode) override
 Changes the primary flag on all members. More...
 
void update_enforce_everywhere_checks_flag (bool enforce_everywhere) override
 Set the enforces_update_everywhere_checks flag on all members. More...
 
void encode (std::vector< uchar > *to_encode) override
 Encodes this object to send via the network. More...
 
Group_member_info_listdecode (const uchar *to_decode, size_t length) override
 Decodes the raw format of this object. More...
 
bool is_conflict_detection_enabled () override
 Check if some member of the group has the conflict detection enable. More...
 
bool get_primary_member_uuid (std::string &primary_member_uuid) override
 Return the uuid for the for the primary. More...
 
bool get_primary_member_info (Group_member_info &member_info_arg) override
 Return the group member info for the current group primary. More...
 
bool is_majority_unreachable () override
 Check if majority of the group is unreachable. More...
 
bool is_unreachable_member_present () override
 Check if an unreachable member exists. More...
 
bool is_recovering_member_present () override
 Check if a member in recovery exists in the group. More...
 
std::string get_string_current_view_active_hosts () const override
 This method returns all ONLINE and RECOVERING members comma separated host and port in string format. More...
 
mysql_mutex_tget_update_lock () override
 This method returns the update lock for consistent read of member state. More...
 
- Public Member Functions inherited from Group_member_info_manager_interface
virtual ~Group_member_info_manager_interface ()=default
 

Private Member Functions

void clear_members ()
 
Group_member_infoget_group_member_info_by_member_id_internal (const Gcs_member_identifier &id)
 

Private Attributes

Group_member_info_mapmembers
 
Group_member_infolocal_member_info
 
mysql_mutex_t update_lock
 

Detailed Description

Implementation of the interface Group_member_info_manager_interface.

Constructor & Destructor Documentation

◆ Group_member_info_manager()

Group_member_info_manager::Group_member_info_manager ( Group_member_info local_member_info,
PSI_mutex_key  psi_mutex_key = key_GR_LOCK_group_member_info_manager_update_lock 
)

◆ ~Group_member_info_manager()

Group_member_info_manager::~Group_member_info_manager ( )
override

Member Function Documentation

◆ add()

void Group_member_info_manager::add ( Group_member_info new_member)
overridevirtual

Adds a new member to be managed by this Group manager.

Parameters
[in]new_membernew group member

Implements Group_member_info_manager_interface.

◆ clear_members()

void Group_member_info_manager::clear_members ( )
private

◆ decode()

Group_member_info_list * Group_member_info_manager::decode ( const uchar to_decode,
size_t  length 
)
overridevirtual

Decodes the raw format of this object.

Parameters
[in]to_decoderaw encoded data
[in]lengthraw encoded data length
Returns
a vector of Group_member_info references

Implements Group_member_info_manager_interface.

◆ encode()

void Group_member_info_manager::encode ( std::vector< uchar > *  to_encode)
overridevirtual

Encodes this object to send via the network.

Parameters
[out]to_encodeout parameter to receive the encoded data

Implements Group_member_info_manager_interface.

◆ get_all_members()

Group_member_info_list * Group_member_info_manager::get_all_members ( )
overridevirtual

Retrieves all Group members managed by this site.

Returns
a vector with copies to all managed Group_member_info

Implements Group_member_info_manager_interface.

◆ get_group_lowest_online_version()

Member_version Group_member_info_manager::get_group_lowest_online_version ( )
overridevirtual

Return lowest member version.

Returns
group lowest version, if used at place where member can be OFFLINE or in ERROR state, version 0xFFFFFF may be returned(not found)

Implements Group_member_info_manager_interface.

◆ get_group_member_info()

bool Group_member_info_manager::get_group_member_info ( const std::string &  uuid,
Group_member_info member_info_arg 
)
overridevirtual

Retrieves a registered Group member by its uuid.

Parameters
[in]uuiduuid to retrieve
[out]member_info_arga member info reference local to the method caller that is updated when the member is found.
Returns
true if the member is not found. false if the member is found.

Implements Group_member_info_manager_interface.

◆ get_group_member_info_by_index()

bool Group_member_info_manager::get_group_member_info_by_index ( int  idx,
Group_member_info member_info_arg 
)
overridevirtual

Retrieves a registered Group member by an index function.

One is free to determine the index function. Nevertheless, it should have the same result regardless of the member of the group where it is called

Parameters
[in]idxthe index
[out]member_info_arga member info reference local to the method caller that is updated when the member is found.
Returns
true if the member is not found. false if the member is found.

Implements Group_member_info_manager_interface.

◆ get_group_member_info_by_member_id()

bool Group_member_info_manager::get_group_member_info_by_member_id ( const Gcs_member_identifier id,
Group_member_info member_info_arg 
)
overridevirtual

Retrieves a registered Group member by its backbone GCS identifier.

Parameters
[in]idthe GCS identifier
[out]member_info_arga member info reference local to the method caller that is updated when the member is found.
Returns
true if the member is not found. false if the member is found.

Implements Group_member_info_manager_interface.

◆ get_group_member_info_by_member_id_internal()

Group_member_info * Group_member_info_manager::get_group_member_info_by_member_id_internal ( const Gcs_member_identifier id)
private

◆ get_group_member_status_by_member_id()

Group_member_info::Group_member_status Group_member_info_manager::get_group_member_status_by_member_id ( const Gcs_member_identifier id)
overridevirtual

Return the status of the member with the given GCS identifier.

Parameters
[in]idthe GCS identifier
Returns
status of the member, Group_member_info::MEMBER_END if the member does not exist.

Implements Group_member_info_manager_interface.

◆ get_group_member_uuid_from_member_id()

std::pair< bool, std::string > Group_member_info_manager::get_group_member_uuid_from_member_id ( const Gcs_member_identifier id)
overridevirtual

Returns the member-uuid of the given GCS identifier.

Parameters
[in]idthe GCS identifier
Returns
false if success and the member-uuid true if fails and the member-uuid is empty.

Implements Group_member_info_manager_interface.

◆ get_number_of_members()

size_t Group_member_info_manager::get_number_of_members ( )
overridevirtual

Number of members in the group.

Returns
number of members

Implements Group_member_info_manager_interface.

◆ get_number_of_members_online()

size_t Group_member_info_manager::get_number_of_members_online ( )
overridevirtual

Number of ONLINE members in the group.

UNREACHABLE members are included.

Returns
number of ONLINE members

Implements Group_member_info_manager_interface.

◆ get_online_members_with_guarantees()

std::list< Gcs_member_identifier > * Group_member_info_manager::get_online_members_with_guarantees ( const Gcs_member_identifier exclude_member)
overridevirtual

Retrieves all ONLINE Group members managed by this site, or NULL if any group member version is from a version lower than TRANSACTION_WITH_GUARANTEES_VERSION.

Returns
list of all ONLINE members, if all members have version equal or greater than TRANSACTION_WITH_GUARANTEES_VERSION otherwise NULL
Note
the memory allocated for the list ownership belongs to the caller

Implements Group_member_info_manager_interface.

◆ get_primary_member_info()

bool Group_member_info_manager::get_primary_member_info ( Group_member_info member_info_arg)
overridevirtual

Return the group member info for the current group primary.

Parameters
[out]member_info_arga member info reference local to the method caller that is updated when the member is found.
Returns
true if the member is not found. false if the member is found.

Implements Group_member_info_manager_interface.

◆ get_primary_member_uuid()

bool Group_member_info_manager::get_primary_member_uuid ( std::string &  primary_member_uuid)
overridevirtual

Return the uuid for the for the primary.

Parameters
[out]primary_member_uuidthe uuid of the primary will be assigned here.
Note
If there is no primary or the member is on error state, the returned uuid is "UNDEFINED". If not on primary mode it returns an empty string.
Returns
true if the member is in primary mode, false if it is not.

Implements Group_member_info_manager_interface.

◆ get_string_current_view_active_hosts()

std::string Group_member_info_manager::get_string_current_view_active_hosts ( ) const
overridevirtual

This method returns all ONLINE and RECOVERING members comma separated host and port in string format.

Returns
hosts and port of all ONLINE and RECOVERING members

Implements Group_member_info_manager_interface.

◆ get_update_lock()

mysql_mutex_t * Group_member_info_manager::get_update_lock ( )
inlineoverridevirtual

This method returns the update lock for consistent read of member state.

Returns
update_lock reference

Implements Group_member_info_manager_interface.

◆ is_conflict_detection_enabled()

bool Group_member_info_manager::is_conflict_detection_enabled ( )
overridevirtual

Check if some member of the group has the conflict detection enable.

Returns
true if at least one member has conflict detection enabled

Implements Group_member_info_manager_interface.

◆ is_majority_unreachable()

bool Group_member_info_manager::is_majority_unreachable ( )
overridevirtual

Check if majority of the group is unreachable.

This approach is optimistic, right after return the majority can be reestablish or go away.

Returns
true if majority of the group is unreachable

Implements Group_member_info_manager_interface.

◆ is_member_info_present()

bool Group_member_info_manager::is_member_info_present ( const std::string &  uuid)
overridevirtual

Is the member present in the group info.

Parameters
[in]uuiduuid to check
Returns
true if present, false otherwise

Implements Group_member_info_manager_interface.

◆ is_recovering_member_present()

bool Group_member_info_manager::is_recovering_member_present ( )
overridevirtual

Check if a member in recovery exists in the group.

This approach is optimistic, right after return a member can enter the group

Returns
true if a member in recovery exists

Implements Group_member_info_manager_interface.

◆ is_unreachable_member_present()

bool Group_member_info_manager::is_unreachable_member_present ( )
overridevirtual

Check if an unreachable member exists.

This approach is optimistic, right after return a member can be marked as reachable/unreachable

Returns
true if an unreachable member exists

Implements Group_member_info_manager_interface.

◆ operator delete() [1/2]

void Group_member_info_manager::operator delete ( void *  ptr)
inlinenoexcept

Deallocate memory on the heap with instrumented memory allocation, so that memory consumption can be tracked.

Parameters
[in]ptrpointer to the allocated memory

◆ operator delete() [2/2]

void Group_member_info_manager::operator delete ( void *  ptr,
const std::nothrow_t &   
)
inlinenoexcept

◆ operator new() [1/2]

void * Group_member_info_manager::operator new ( size_t  size)
inlinenoexcept

Allocate memory on the heap with instrumented memory allocation, so that memory consumption can be tracked.

Parameters
[in]sizememory size to be allocated
Returns
pointer to the allocated memory, or NULL if memory could not be allocated.

◆ operator new() [2/2]

void * Group_member_info_manager::operator new ( size_t  size,
const std::nothrow_t &   
)
inlinenoexcept

◆ set_member_reachable()

void Group_member_info_manager::set_member_reachable ( const std::string &  uuid)
overridevirtual

Sets the identified member as reachable.

Parameters
[in]uuidmember uuid

Implements Group_member_info_manager_interface.

◆ set_member_unreachable()

void Group_member_info_manager::set_member_unreachable ( const std::string &  uuid)
overridevirtual

Sets the identified member as unreachable.

Parameters
[in]uuidmember uuid

Implements Group_member_info_manager_interface.

◆ update() [1/2]

void Group_member_info_manager::update ( Group_member_info update_local_member)
overridevirtual

Removes all members of the group and update new local member.

Parameters
[in]update_local_membernew Group member

Implements Group_member_info_manager_interface.

◆ update() [2/2]

void Group_member_info_manager::update ( Group_member_info_list new_members)
overridevirtual

Updates all members of the group.

Typically used after a view change.

Parameters
[in]new_membersnew Group members

Implements Group_member_info_manager_interface.

◆ update_enforce_everywhere_checks_flag()

void Group_member_info_manager::update_enforce_everywhere_checks_flag ( bool  enforce_everywhere)
overridevirtual

Set the enforces_update_everywhere_checks flag on all members.

Parameters
enforce_everywhereare the update everywhere checks active or not

Implements Group_member_info_manager_interface.

◆ update_group_primary_roles()

void Group_member_info_manager::update_group_primary_roles ( const std::string &  uuid,
Notification_context ctx 
)
overridevirtual

Updates the primary/secondary roles of the group.

This method allows for all roles to be updated at once in the same method

Parameters
[in]uuidthe primary member uuid
[in,out]ctxThe notification context to update.

Implements Group_member_info_manager_interface.

◆ update_gtid_sets()

void Group_member_info_manager::update_gtid_sets ( const std::string &  uuid,
std::string &  gtid_executed,
std::string &  purged_gtids,
std::string &  gtid_retrieved 
)
overridevirtual

Updates the GTID sets on a single member.

Parameters
[in]uuidmember uuid
[in]gtid_executedthe member executed GTID set
[in]purged_gtidsthe server purged GTID set
[in]gtid_retrievedthe member retrieved GTID set for the applier

Implements Group_member_info_manager_interface.

◆ update_member_role()

void Group_member_info_manager::update_member_role ( const std::string &  uuid,
Group_member_info::Group_member_role  new_role,
Notification_context ctx 
)
overridevirtual

Updates the role of a single member.

Parameters
[in]uuidmember uuid
[in]new_rolerole to change to
[in,out]ctxThe notification context to update.

Implements Group_member_info_manager_interface.

◆ update_member_status()

void Group_member_info_manager::update_member_status ( const std::string &  uuid,
Group_member_info::Group_member_status  new_status,
Notification_context ctx 
)
overridevirtual

Updates the status of a single member.

Parameters
[in]uuidmember uuid
[in]new_statusstatus to change to
[in,out]ctxThe notification context to update.

Implements Group_member_info_manager_interface.

◆ update_member_weight()

void Group_member_info_manager::update_member_weight ( const std::string &  uuid,
uint  member_weight 
)
overridevirtual

Updates the weight of a single member.

Parameters
[in]uuidmember uuid
[in]member_weightthe new weight

Implements Group_member_info_manager_interface.

◆ update_primary_member_flag()

void Group_member_info_manager::update_primary_member_flag ( bool  in_primary_mode)
overridevirtual

Changes the primary flag on all members.

Parameters
in_primary_modeis the member in primary mode

Implements Group_member_info_manager_interface.

Member Data Documentation

◆ local_member_info

Group_member_info* Group_member_info_manager::local_member_info
private

◆ members

Group_member_info_map* Group_member_info_manager::members
private

◆ update_lock

mysql_mutex_t Group_member_info_manager::update_lock
private

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