MySQL 9.1.0
Source Code Documentation
|
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 DestinationStatusComponent & | get_instance () |
Get the singleton instance object of our class. More... | |
Private Member Functions | |
DestinationStatusComponent () | |
Private Attributes | |
std::unique_ptr< UnreachableDestinationsQuarantine > | unreachable_destinations_quarantine_ |
Shared component representing status of the routing destinations.
|
delete |
|
delete |
|
default |
|
private |
|
static |
Get the singleton instance object of our class.
void DestinationStatusComponent::init | ( | std::chrono::seconds | quarantine_interval, |
uint32_t | qurantine_threshold | ||
) |
Initialize the component with the configured options.
quarantine_interval | interval after which the quarantined destinations are checked for availability |
qurantine_threshold | number of invalid connect attempts after which the destination is added to the quarantine |
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.
[in] | dest | Destination candidate address. |
|
delete |
|
delete |
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.
[in] | instance_name | Routing plugin instance name. |
[in] | nodes_changed_on_md_refresh | Information if the destination candidates have been updated for the given routing plugin. |
[in] | new_destinations | List of destination candidates that are available for the given routing plugin after metadata refresh. |
void DestinationStatusComponent::register_quarantine_callbacks | ( | QuarantineRoutingCallbacks && | routing_callbacks | ) |
Register callbacks requied by the quarantine mechanism (start/stop acceptor etc.).
routing_callbacks | object defining the callbacks |
void DestinationStatusComponent::register_route | ( | const std::string & | name | ) |
Register routing instance in the quarantine mechanism.
name | name of the route |
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.
[in] | dest | Reported destination address. |
[in] | success | Indicates if the reported connection result is success of failure. |
void DestinationStatusComponent::stop_unreachable_destinations_quarantine | ( | ) |
Stop all async operations and clear the quarantine list.
void DestinationStatusComponent::unregister_quarantine_callbacks | ( | ) |
Unregister callbacks requied by the quarantine mechanism.
|
private |