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:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user