MXS-1845 New algorithm for finding the master server

Not yet used, as more is needed to replace the old code. The
algorithm is based on counting the total number of slave nodes
a server has, possibly in multiple layers and/or cycles.
This commit is contained in:
Esa Korhonen
2018-06-05 18:17:29 +03:00
parent 8094c67ac2
commit 3f82c25c62
5 changed files with 247 additions and 21 deletions

View File

@ -56,21 +56,27 @@ MariaDBServer::MariaDBServer(MXS_MONITORED_SERVER* monitored_server)
NodeData::NodeData()
: index(INDEX_NOT_VISITED)
, lowest_index(INDEX_NOT_VISITED)
, cycle(INDEX_NOT_VISITED)
, in_stack(false)
, cycle(CYCLE_NONE)
, reach(REACH_UNKNOWN)
{}
void NodeData::reset()
void NodeData::reset_results()
{
index = INDEX_NOT_VISITED;
lowest_index = INDEX_NOT_VISITED;
cycle = INDEX_NOT_VISITED;
in_stack = false;
cycle = CYCLE_NONE;
reach = REACH_UNKNOWN;
parents.clear();
children.clear();
external_masters.clear();
}
void NodeData::reset_indexes()
{
index = INDEX_NOT_VISITED;
lowest_index = INDEX_NOT_VISITED;
in_stack = false;
}
int64_t MariaDBServer::relay_log_events()
{
/* The events_ahead-call below ignores domains where current_pos is ahead of io_pos. This situation is