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

@ -63,6 +63,7 @@ const char CN_MONITORUSER[] = "monitoruser";
const char CN_PERSISTMAXTIME[] = "persistmaxtime";
const char CN_PERSISTPOOLMAX[] = "persistpoolmax";
const char CN_PROXY_PROTOCOL[] = "proxy_protocol";
const char CN_RANK[] = "rank";
namespace
{
@ -252,6 +253,11 @@ Server* Server::server_alloc(const char* name, MXS_CONFIG_PARAMETER* params)
server->last_event = SERVER_UP_EVENT;
server->status = SERVER_RUNNING;
if ((server->m_settings.rank = params->get_integer(CN_RANK)) == -1)
{
server->m_settings.rank = std::numeric_limits<int>::max();
}
if (!monuser.empty())
{
mxb_assert(!monpw.empty());