MySQL 9.0.0
Source Code Documentation
DestinationStatusComponent Class Reference

Shared component representing status of the routing destinations. More...

#include <destination_status_component.h>

Public Member Functions

 DestinationStatusComponent (DestinationStatusComponent const &)=delete
 
void operator= (DestinationStatusComponent const &)=delete
 
 DestinationStatusComponent (DestinationStatusComponent &&)=delete
 
void operator= (DestinationStatusComponent &&)=delete
 
 ~DestinationStatusComponent ()
 
void init (std::chrono::seconds quarantine_interval, uint32_t qurantine_threshold)
 Initialize the component with the configured options. More...
 
void register_quarantine_callbacks (QuarantineRoutingCallbacks &&routing_callbacks)
 Register callbacks requied by the quarantine mechanism (start/stop acceptor etc.). More...
 
void unregister_quarantine_callbacks ()
 Unregister callbacks requied by the quarantine mechanism. More...
 
void register_route (const std::string &name)
 Register routing instance in the quarantine mechanism. More...
 
bool report_connection_result (const mysql_harness::TCPAddress &dest, bool success)
 Register the connection error or success to a given destination. More...
 
bool is_destination_quarantined (const mysql_harness::TCPAddress &dest)
 Query the quarantined destination candidates set and check if the given destination candidate is quarantined. More...
 
void stop_unreachable_destinations_quarantine ()
 Stop all async operations and clear the quarantine list. More...
 
void refresh_destinations_quarantine (const std::string &instance_name, const bool nodes_changed_on_md_refresh, const AllowedNodes &new_destinations)
 Refresh the quarantined destination candidates list on metadata refresh. More...
 

Static Public Member Functions

static DestinationStatusComponentget_instance ()
 Get the singleton instance object of our class. More...
 

Private Member Functions

 DestinationStatusComponent ()
 

Private Attributes

std::unique_ptr< UnreachableDestinationsQuarantineunreachable_destinations_quarantine_
 

Detailed Description

Shared component representing status of the routing destinations.

Constructor & Destructor Documentation

◆ DestinationStatusComponent() [1/3]

DestinationStatusComponent::DestinationStatusComponent ( DestinationStatusComponent const &  )
delete

◆ DestinationStatusComponent() [2/3]

DestinationStatusComponent::DestinationStatusComponent ( DestinationStatusComponent &&  )
delete

◆ ~DestinationStatusComponent()

DestinationStatusComponent::~DestinationStatusComponent ( )
default

◆ DestinationStatusComponent() [3/3]

DestinationStatusComponent::DestinationStatusComponent ( )
private

Member Function Documentation

◆ get_instance()

DestinationStatusComponent & DestinationStatusComponent::get_instance ( )
static

Get the singleton instance object of our class.

◆ init()

void DestinationStatusComponent::init ( std::chrono::seconds  quarantine_interval,
uint32_t  qurantine_threshold 
)

Initialize the component with the configured options.

Parameters
quarantine_intervalinterval after which the quarantined destinations are checked for availability
qurantine_thresholdnumber of invalid connect attempts after which the destination is added to the quarantine

◆ is_destination_quarantined()

bool DestinationStatusComponent::is_destination_quarantined ( const mysql_harness::TCPAddress dest)

Query the quarantined destination candidates set and check if the given destination candidate is quarantined.

Parameters
[in]destDestination candidate address.
Returns
true if the destination candidate is quarantined, false otherwise.

◆ operator=() [1/2]

void DestinationStatusComponent::operator= ( DestinationStatusComponent &&  )
delete

◆ operator=() [2/2]

void DestinationStatusComponent::operator= ( DestinationStatusComponent const &  )
delete

◆ refresh_destinations_quarantine()

void DestinationStatusComponent::refresh_destinations_quarantine ( const std::string &  instance_name,
const bool  nodes_changed_on_md_refresh,
const AllowedNodes new_destinations 
)

Refresh the quarantined destination candidates list on metadata refresh.

1) if the destination candidates list got updated we have to go through the quarantined destinations and check if there are still routing plugins that references them. 2) for each destination returned in the metadata (which is available from the md perspective) check if it is still unreachable and should be quarantined.

Parameters
[in]instance_nameRouting plugin instance name.
[in]nodes_changed_on_md_refreshInformation if the destination candidates have been updated for the given routing plugin.
[in]new_destinationsList of destination candidates that are available for the given routing plugin after metadata refresh.

◆ register_quarantine_callbacks()

void DestinationStatusComponent::register_quarantine_callbacks ( QuarantineRoutingCallbacks &&  routing_callbacks)

Register callbacks requied by the quarantine mechanism (start/stop acceptor etc.).

Parameters
routing_callbacksobject defining the callbacks

◆ register_route()

void DestinationStatusComponent::register_route ( const std::string &  name)

Register routing instance in the quarantine mechanism.

Parameters
namename of the route

◆ report_connection_result()

bool DestinationStatusComponent::report_connection_result ( const mysql_harness::TCPAddress dest,
bool  success 
)

Register the connection error or success to a given destination.

If registering a success it will set the number of reported errors to a given connection to 0.

If registering a failure it will increment the number of reported failed connections to the destination. If the number reached the quarantine_threshold the destination will be added to the quarantine. If the destination candidate is not quarantine yet it will starting the async handler for it, otherwise it will just update the referencing plugins list.

Parameters
[in]destReported destination address.
[in]successIndicates if the reported connection result is success of failure.
Returns
true if the destination got added to the quarantine, false otherwise

◆ stop_unreachable_destinations_quarantine()

void DestinationStatusComponent::stop_unreachable_destinations_quarantine ( )

Stop all async operations and clear the quarantine list.

◆ unregister_quarantine_callbacks()

void DestinationStatusComponent::unregister_quarantine_callbacks ( )

Unregister callbacks requied by the quarantine mechanism.

Member Data Documentation

◆ unreachable_destinations_quarantine_

std::unique_ptr<UnreachableDestinationsQuarantine> DestinationStatusComponent::unreachable_destinations_quarantine_
private

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