MXS-2313: Add server ranks

The servers now accept a rank parameter that tells which servers to
prioritize.
This commit is contained in:
Markus Mäkelä
2019-03-08 10:55:00 +02:00
parent 9e9cd0c596
commit 0693514047
5 changed files with 34 additions and 0 deletions

View File

@ -62,6 +62,11 @@ public:
m_settings.persistmaxtime = persistmaxtime;
}
void set_rank(int rank)
{
m_settings.rank = rank;
}
bool have_disk_space_limits() const override
{
std::lock_guard<std::mutex> guard(m_settings.lock);
@ -117,6 +122,11 @@ public:
return m_settings.authenticator;
}
int rank() const override
{
return m_settings.rank;
}
/**
* Get a DCB from the persistent connection pool, if possible
*
@ -331,6 +341,8 @@ private:
long persistpoolmax = 0; /**< Maximum size of persistent connections pool */
long persistmaxtime = 0; /**< Maximum number of seconds connection can live */
int rank; /*< The ranking of this server, used to prioritize certain servers over others */
/** Disk space thresholds. Can be queried from modules at any time so access must be protected
* by mutex. */
DiskSpaceLimits disk_space_limits;