MXS-2167: Add support for extra_port

This allows MaxScale to connect to the server even when max_connections
has been reached.
This commit is contained in:
Markus Mäkelä
2018-11-15 12:51:36 +02:00
parent 598edea203
commit cbe1483028
7 changed files with 40 additions and 0 deletions

View File

@ -30,6 +30,7 @@
#include <maxscale/alloc.h>
#include <maxscale/config.h>
#include <maxscale/log.h>
#include <maxbase/atomic.hh>
namespace
{
@ -191,6 +192,13 @@ MYSQL* mxs_mysql_real_connect(MYSQL* con, SERVER* server, const char* user, cons
}
MYSQL* mysql = mysql_real_connect(con, server->address, user, passwd, NULL, server->port, NULL, 0);
auto extra_port = mxb::atomic::load(&server->extra_port, mxb::atomic::RELAXED);
if (!mysql && extra_port)
{
mysql = mysql_real_connect(con, server->address, user, passwd, NULL, extra_port, NULL, 0);
MXS_WARNING("Could not connect with normal port to server '%s', using extra_port", server->name);
}
if (mysql)
{