MXS-2220 server_alloc returns internal type

Also adds default initializers to SERVER fields.
This commit is contained in:
Esa Korhonen 2018-12-11 15:27:52 +02:00
parent 3f81a37e70
commit 6209d737e9
16 changed files with 135 additions and 154 deletions

View File

@ -19,12 +19,6 @@
#include <maxscale/config.hh>
#include <maxscale/dcb.hh>
#define MAX_SERVER_ADDRESS_LEN 1024
#define MAX_SERVER_MONUSER_LEN 1024
#define MAX_SERVER_MONPW_LEN 1024
#define MAX_SERVER_VERSION_LEN 256
#define MAX_NUM_SLAVES 128 /**< Maximum number of slaves under a single server*/
/**
* Server configuration parameters names
*/
@ -43,9 +37,6 @@ const int MAINTENANCE_ON = 100;
const int MAINTENANCE_FLAG_NOCHECK = 0;
const int MAINTENANCE_FLAG_CHECK = -1;
// Default replication lag value
const int MXS_RLAG_UNDEFINED = -1;
/* Custom server parameters. These can be used by modules for e.g. weighting routing decisions. */
struct SERVER_PARAM
{
@ -58,13 +49,13 @@ struct SERVER_PARAM
/* Server connection and usage statistics */
struct SERVER_STATS
{
int n_connections; /**< Number of connections */
int n_current; /**< Current connections */
int n_current_ops; /**< Current active operations */
int n_persistent; /**< Current persistent pool */
uint64_t n_new_conn; /**< Times the current pool was empty */
uint64_t n_from_pool; /**< Times when a connection was available from the pool */
uint64_t packets; /**< Number of packets routed to this server */
int n_connections = 0; /**< Number of connections */
int n_current = 0; /**< Current connections */
int n_current_ops = 0; /**< Current active operations */
int n_persistent = 0; /**< Current persistent pool */
uint64_t n_new_conn = 0; /**< Times the current pool was empty */
uint64_t n_from_pool = 0; /**< Times when a connection was available from the pool */
uint64_t packets = 0; /**< Number of packets routed to this server */
};
/* Server version */
@ -106,56 +97,63 @@ static uint64_t server_encode_version(const SERVER_VERSION* server_version)
class SERVER
{
public:
// Base settings
char* name; /**< Server config name */
char address[MAX_SERVER_ADDRESS_LEN]; /**< Server hostname/IP-address */
unsigned short port; /**< Server port */
unsigned short extra_port; /**< Server extra_port */
char* protocol; /**< Backend protocol module name */
char* authenticator; /**< Authenticator module name */
// Other settings
char monuser[MAX_SERVER_MONUSER_LEN]; /**< Monitor username, overrides monitor setting */
char monpw[MAX_SERVER_MONPW_LEN]; /**< Monitor password, overrides monitor setting */
long persistpoolmax; /**< Maximum size of persistent connections pool */
long persistmaxtime; /**< Maximum number of seconds connection can live */
bool proxy_protocol; /**< Send proxy-protocol header to backends when connecting
* routing sessions. */
SERVER_PARAM* parameters; /**< Additional custom parameters which may affect routing
* decisions. */
// Base variables
bool is_active; /**< Server is active and has not been "destroyed" */
void* auth_instance; /**< Authenticator instance data */
SSL_LISTENER* server_ssl; /**< SSL data */
DCB** persistent; /**< List of unused persistent connections to the server */
uint8_t charset; /**< Server character set. Read from backend and sent to client. */
// Statistics and events
SERVER_STATS stats; /**< The server statistics, e.g. number of connections */
int persistmax; /**< Maximum pool size actually achieved since startup */
int last_event; /**< The last event that occurred on this server */
int64_t triggered_at; /**< Time when the last event was triggered */
// Status descriptors. Updated automatically by a monitor or manually by the admin
uint64_t status; /**< Current status flag bitmap */
int maint_request; /**< Is admin requesting Maintenance=ON/OFF on the
* server? */
char version_string[MAX_SERVER_VERSION_LEN]; /**< Server version string as given by backend */
uint64_t version; /**< Server version numeric representation */
server_type_t server_type; /**< Server type (MariaDB or MySQL), deduced from
* version string */
long node_id; /**< Node id, server_id for M/S or local_index for
* Galera */
int rlag; /**< Replication Lag for Master/Slave replication
* */
unsigned long node_ts; /**< Last timestamp set from M/S monitor module */
long master_id; /**< Master server id of this node */
// Misc fields
bool master_err_is_logged; /**< If node failed, this indicates whether it is logged. Only
* used
* by rwsplit. TODO: Move to rwsplit */
bool warn_ssl_not_enabled;/**< SSL not used for an SSL enabled server */
static const int MAX_ADDRESS_LEN = 1024;
static const int MAX_MONUSER_LEN = 1024;
static const int MAX_MONPW_LEN = 1024;
static const int MAX_VERSION_LEN = 256;
static const int RLAG_UNDEFINED = -1; // Default replication lag value
virtual ~SERVER()
{
}
// Base settings
char* name = nullptr; /**< Server config name */
char* protocol = nullptr; /**< Backend protocol module name */
char* authenticator = nullptr; /**< Authenticator module name */
char address[MAX_ADDRESS_LEN] = {'\0'}; /**< Server hostname/IP-address */
unsigned short port = 0; /**< Server port */
unsigned short extra_port = 0; /**< Alternative monitor port if normal port fails */
// Other settings
char monuser[MAX_MONUSER_LEN] = {'\0'}; /**< Monitor username, overrides monitor setting */
char monpw[MAX_MONPW_LEN] = {'\0'}; /**< Monitor password, overrides monitor setting */
long persistpoolmax = 0; /**< Maximum size of persistent connections pool */
long persistmaxtime = 0; /**< Maximum number of seconds connection can live */
bool proxy_protocol = false; /**< Send proxy-protocol header to backends when connecting
* routing sessions. */
SERVER_PARAM* parameters = nullptr; /**< Additional custom parameters which may affect routing
* decisions. */
// Base variables
bool is_active = false; /**< Server is active and has not been "destroyed" */
void* auth_instance = nullptr; /**< Authenticator instance data */
SSL_LISTENER* server_ssl = nullptr; /**< SSL data */
DCB** persistent = nullptr; /**< List of unused persistent connections to the server */
uint8_t charset = DEFAULT_CHARSET;/**< Character set. Read from backend and sent to client. */
// Statistics and events
SERVER_STATS stats; /**< The server statistics, e.g. number of connections */
int persistmax = 0; /**< Maximum pool size actually achieved since startup */
int last_event = 0; /**< The last event that occurred on this server */
int64_t triggered_at = 0; /**< Time when the last event was triggered */
// Status descriptors. Updated automatically by a monitor or manually by the admin
uint64_t status = 0; /**< Current status flag bitmap */
int maint_request = MAINTENANCE_NO_CHANGE; /**< Is admin requesting Maintenance=ON/OFF on the
* server? */
char version_string[MAX_VERSION_LEN] = {'\0'}; /**< Server version string as given by backend */
uint64_t version = 0; /**< Server version numeric representation */
server_type_t server_type = SERVER_TYPE_MARIADB; /**< Server type (MariaDB or MySQL), deduced from
* version string */
long node_id = -1; /**< Node id, server_id for M/S or local_index for Galera */
long master_id = -1; /**< Master server id of this node */
int rlag = RLAG_UNDEFINED;/**< Replication Lag for Master/Slave replication */
unsigned long node_ts = 0; /**< Last timestamp set from M/S monitor module */
// Misc fields
bool master_err_is_logged = false; /**< If node failed, this indicates whether it is logged. Only
* used by rwsplit. TODO: Move to rwsplit */
bool warn_ssl_not_enabled = true; /**< SSL not used for an SSL enabled server */
virtual ~SERVER() = default;
/**
* Check if server has disk space threshold settings.
@ -177,6 +175,13 @@ public:
* @param new_limits New limits
*/
virtual void set_disk_space_limits(const MxsDiskSpaceThreshold& new_limits) = 0;
protected:
SERVER()
{
}
private:
static const int DEFAULT_CHARSET = 0x08; /** The latin1 charset */
};
/**
@ -372,20 +377,6 @@ inline bool server_is_disk_space_exhausted(const SERVER* server)
return status_is_disk_space_exhausted(server->status);
}
/**
* @brief Allocate a new server
*
* This will create a new server that represents a backend server that services
* can use. This function will add the server to the running configuration but
* will not persist the changes.
*
* @param name Unique server name
* @param params Parameters for the server
*
* @return The newly created server or NULL if an error occurred
*/
extern SERVER* server_alloc(const char* name, MXS_CONFIG_PARAMETER* params);
/**
* @brief Serialize a server to a file
*
@ -506,6 +497,6 @@ namespace maxscale
{
std::string server_status(uint64_t flags);
std::string server_status(const SERVER*);
bool server_set_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
bool server_set_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL);
}

View File

@ -63,6 +63,7 @@
#include "internal/filter.hh"
#include "internal/modules.hh"
#include "internal/monitor.hh"
#include "internal/server.hh"
#include "internal/service.hh"
using std::set;
@ -3717,7 +3718,7 @@ int create_new_server(CONFIG_CONTEXT* obj)
return 1;
}
if (SERVER* server = server_alloc(obj->object, obj->parameters))
if (Server* server = Server::server_alloc(obj->object, obj->parameters))
{
const char* disk_space_threshold = config_get_value(obj->parameters, CN_DISK_SPACE_THRESHOLD);
if (disk_space_threshold)

View File

@ -39,6 +39,7 @@
#include "internal/modules.hh"
#include "internal/monitor.hh"
#include "internal/query_classifier.hh"
#include "internal/server.hh"
typedef std::set<std::string> StringSet;
typedef std::vector<std::string> StringVector;
@ -241,7 +242,7 @@ bool runtime_create_server(const char* name,
config_replace_param(&ctx, "authenticator", authenticator);
}
SERVER* server = server_alloc(name, ctx.parameters);
Server* server = Server::server_alloc(name, ctx.parameters);
if (server && server_serialize(server))
{

View File

@ -32,11 +32,8 @@ class Server : public SERVER
{
public:
Server()
: m_response_time(maxbase::EMAverage {0.04, 0.35, 500})
{
}
~Server() override
: SERVER()
, m_response_time(maxbase::EMAverage {0.04, 0.35, 500})
{
}
@ -77,6 +74,20 @@ public:
*/
void print_to_dcb(DCB* dcb) const;
/**
* @brief Allocate a new server
*
* This will create a new server that represents a backend server that services
* can use. This function will add the server to the running configuration but
* will not persist the changes.
*
* @param name Unique server name
* @param params Parameters for the server
*
* @return The newly created server or NULL if an error occurred
*/
static Server* server_alloc(const char* name, MXS_CONFIG_PARAMETER* params);
/**
* @brief Find a server with the specified name
*

View File

@ -1133,9 +1133,8 @@ static void mon_append_node_names(MXS_MONITOR* mon,
MXS_MONITORED_SERVER* servers = mon->monitored_servers;
const char* separator = "";
char arr[MAX_SERVER_MONUSER_LEN
+ MAX_SERVER_MONPW_LEN
+ MAX_SERVER_ADDRESS_LEN + 64]; // Some extra space for port and separator
// Some extra space for port and separator
char arr[SERVER::MAX_MONUSER_LEN + SERVER::MAX_MONPW_LEN + SERVER::MAX_ADDRESS_LEN + 64];
dest[0] = '\0';
while (servers && len)

View File

@ -63,9 +63,6 @@ using maxscale::RoutingWorker;
using std::string;
using Guard = std::lock_guard<std::mutex>;
/** The latin1 charset */
#define SERVER_DEFAULT_CHARSET 0x08
const char CN_MONITORPW[] = "monitorpw";
const char CN_MONITORUSER[] = "monitoruser";
const char CN_PERSISTMAXTIME[] = "persistmaxtime";
@ -81,7 +78,7 @@ static const char WRN_REQUEST_OVERWRITTEN[] = "Previous maintenance request was
static void server_parameter_free(SERVER_PARAM* tofree);
SERVER* server_alloc(const char* name, MXS_CONFIG_PARAMETER* params)
Server* Server::server_alloc(const char* name, MXS_CONFIG_PARAMETER* params)
{
const char* monuser = config_get_string(params, CN_MONITORUSER);
const char* monpw = config_get_string(params, CN_MONITORPW);
@ -156,32 +153,15 @@ SERVER* server_alloc(const char* name, MXS_CONFIG_PARAMETER* params)
server->extra_port = config_get_integer(params, CN_EXTRA_PORT);
server->protocol = my_protocol;
server->authenticator = my_authenticator;
server->monuser[0] = '\0';
server->monpw[0] = '\0';
server->persistpoolmax = config_get_integer(params, CN_PERSISTPOOLMAX);
server->persistmaxtime = config_get_integer(params, CN_PERSISTMAXTIME);
server->proxy_protocol = config_get_bool(params, CN_PROXY_PROTOCOL);
server->parameters = NULL;
server->is_active = true;
server->auth_instance = auth_instance;
server->server_ssl = ssl;
server->persistent = persistent;
server->charset = SERVER_DEFAULT_CHARSET;
memset(&server->stats, 0, sizeof(server->stats));
server->persistmax = 0;
server->last_event = SERVER_UP_EVENT;
server->triggered_at = 0;
server->status = SERVER_RUNNING;
server->maint_request = MAINTENANCE_NO_CHANGE;
memset(server->version_string, '\0', MAX_SERVER_VERSION_LEN);
server->version = 0;
server->server_type = SERVER_TYPE_MARIADB;
server->node_id = -1;
server->rlag = MXS_RLAG_UNDEFINED;
server->node_ts = 0;
server->master_id = -1;
server->master_err_is_logged = false;
server->warn_ssl_not_enabled = true;
if (*monuser && *monpw)
{
@ -1064,9 +1044,9 @@ void server_set_version_string(SERVER* server, const char* version_string)
// Strictly speaking, this is not fool-proof as writes may not appear in order to the reader.
size_t old_len = strlen(server->version_string);
size_t new_len = strlen(version_string);
if (new_len >= MAX_SERVER_VERSION_LEN)
if (new_len >= SERVER::MAX_VERSION_LEN)
{
new_len = MAX_SERVER_VERSION_LEN - 1;
new_len = SERVER::MAX_VERSION_LEN - 1;
}
if (new_len < old_len)

View File

@ -57,14 +57,13 @@ static mxs::ParamList params(
*/
static int test1()
{
SERVER* server;
int result;
std::string status;
using mxs::server_status;
/* Server tests */
fprintf(stderr, "testserver : creating server called MyServer");
server = server_alloc("uniquename", params.params());
Server* server = Server::server_alloc("uniquename", params.params());
mxb_assert_message(server, "Allocating the server should not fail");
char buf[120];
@ -122,7 +121,7 @@ bool test_load_config(const char* input, SERVER* server)
TEST(strcmp(server->authenticator, config_get_param(param, "authenticator")->value) == 0,
"Server authenticators differ");
TEST(server->port == atoi(config_get_param(param, "port")->value), "Server ports differ");
TEST(server_alloc(obj->object, obj->parameters), "Failed to create server from loaded config");
TEST(Server::server_alloc(obj->object, obj->parameters), "Failed to create server from loaded config");
duplicate_context_finish(&dcontext);
config_context_free(obj);
}
@ -138,7 +137,7 @@ bool test_serialize()
char old_config_name[] = "serialized-server.cnf.old";
char* persist_dir = MXS_STRDUP_A("./");
set_config_persistdir(persist_dir);
SERVER* server = server_alloc(name, params.params());
Server* server = Server::server_alloc(name, params.params());
TEST(server, "Server allocation failed");
/** Make sure the files don't exist */

View File

@ -484,7 +484,7 @@ void MariaDBMonitor::assign_server_roles()
for (auto server : m_servers)
{
server->clear_status(remove_bits);
server->m_replication_lag = MXS_RLAG_UNDEFINED;
server->m_replication_lag = SERVER::RLAG_UNDEFINED;
}
// Check the the master node, label it as the [Master] if
@ -636,8 +636,8 @@ void MariaDBMonitor::assign_slave_and_relay_master(MariaDBServer* start_node)
// leading to the master or a relay.
int curr_rlag = slave->m_replication_lag;
int new_rlag = sstatus->seconds_behind_master;
if (new_rlag != MXS_RLAG_UNDEFINED
&& (curr_rlag == MXS_RLAG_UNDEFINED || new_rlag < curr_rlag))
if (new_rlag != SERVER::RLAG_UNDEFINED
&& (curr_rlag == SERVER::RLAG_UNDEFINED || new_rlag < curr_rlag))
{
slave->m_replication_lag = new_rlag;
}

View File

@ -330,7 +330,7 @@ bool MariaDBServer::do_show_slave_status(string* errmsg_out)
auto rlag = result->get_uint(i_seconds_behind_master);
// If slave connection is stopped, the value given by the backend is null -> -1.
new_row.seconds_behind_master = (rlag < 0) ? MXS_RLAG_UNDEFINED :
new_row.seconds_behind_master = (rlag < 0) ? SERVER::RLAG_UNDEFINED :
(rlag > INT_MAX) ? INT_MAX : rlag;
if (all_slaves_status)

View File

@ -126,7 +126,7 @@ public:
/* Replication lag of the server. Used during calculation so that the actual SERVER struct is
* only written to once. */
int m_replication_lag = MXS_RLAG_UNDEFINED;
int m_replication_lag = SERVER::RLAG_UNDEFINED;
/* Copy of same field in monitor object. TODO: pass in struct when adding concurrent updating. */
bool m_assume_unique_hostnames = true;
/* Has anything that could affect replication topology changed this iteration?

View File

@ -74,9 +74,8 @@ json_t* SlaveStatus::to_json() const
"slave_io_running",
json_string(slave_io_to_string(slave_io_running).c_str()));
json_object_set_new(result, "slave_sql_running", json_string(slave_sql_running ? "Yes" : "No"));
json_object_set_new(result,
"seconds_behing_master",
seconds_behind_master == MXS_RLAG_UNDEFINED ? json_null() :
json_object_set_new(result, "seconds_behing_master",
seconds_behind_master == SERVER::RLAG_UNDEFINED ? json_null() :
json_integer(seconds_behind_master));
json_object_set_new(result, "master_server_id", json_integer(master_server_id));
json_object_set_new(result, "last_io_or_sql_error", json_string(last_error.c_str()));

View File

@ -170,30 +170,28 @@ public:
SLAVE_IO_NO,
};
std::string owning_server; /* Server name of the owner */
bool seen_connected = false; /* Has this slave connection been seen connected,
* meaning that the master server id
* is correct? */
std::string name; /* Slave connection name. Must be unique for
* the server.*/
int64_t master_server_id = SERVER_ID_UNKNOWN; /* The master's server_id value. Valid ids are
* 32bit unsigned. -1 is unread/error. */
std::string master_host; /* Master server host name. */
int master_port = PORT_UNKNOWN; /* Master server port. */
slave_io_running_t slave_io_running = SLAVE_IO_NO; /* Slave I/O thread running state: * "Yes",
* "Connecting" or "No" */
bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes"
* */
GtidList gtid_io_pos; /* Gtid I/O position of the slave thread. */
std::string last_error; /* Last IO or SQL error encountered. */
int seconds_behind_master = MXS_RLAG_UNDEFINED; /* How much behind the slave is. */
int64_t received_heartbeats = 0; /* How many heartbeats the connection has received
* */
std::string owning_server; /* Server name of the owner */
bool seen_connected = false; /* Has this slave connection been seen connected,
* meaning that the master server id is correct? */
std::string name; /* Slave connection name. Must be unique for
* the server.*/
int64_t master_server_id = SERVER_ID_UNKNOWN; /* The master's server_id value. Valid ids are
* 32bit unsigned. -1 is unread/error. */
std::string master_host; /* Master server host name. */
int master_port = PORT_UNKNOWN; /* Master server port. */
slave_io_running_t slave_io_running = SLAVE_IO_NO; /* Slave I/O thread running state: * "Yes",
* "Connecting" or "No" */
bool slave_sql_running = false; /* Slave SQL thread running state, true if "Yes" */
GtidList gtid_io_pos; /* Gtid I/O position of the slave thread. */
std::string last_error; /* Last IO or SQL error encountered. */
int64_t received_heartbeats = 0; /* How many heartbeats the connection has
* received */
int seconds_behind_master = SERVER::RLAG_UNDEFINED; /* How much behind the slave is. */
/* Time of the latest gtid event or heartbeat the slave connection has received, timed by the monitor. */
maxbase::Clock::time_point last_data_time = maxbase::Clock::now();
std::string to_string() const;
json_t* to_json() const;

View File

@ -50,6 +50,7 @@
#include <maxscale/utils.h>
#include <maxscale/utils.hh>
#include <maxscale/paths.h>
#include "../../../core/internal/server.hh"
/* The router entry points */
static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params);
@ -810,7 +811,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
{"authenticator", "MySQLBackendAuth"}
}, config_server_params);
SERVER* server = server_alloc("binlog_router_master_host", p.params());
Server* server = Server::server_alloc("binlog_router_master_host", p.params());
if (server == NULL)
{

View File

@ -40,6 +40,7 @@
#include <maxscale/utils.hh>
#include "../../../../core/internal/modules.hh"
#include "../../../../core/internal/config.hh"
#include "../../../../core/internal/server.hh"
#include <maxscale/protocol/mysql.hh>
#include <ini.h>
@ -142,7 +143,7 @@ int main(int argc, char** argv)
{"authenticator", "MySQLBackendAuth"}
}, config_server_params);
SERVER* server = server_alloc("binlog_router_master_host", p.params());
Server* server = Server::server_alloc("binlog_router_master_host", p.params());
if (server == NULL)
{
printf("Failed to allocate 'server' object\n");

View File

@ -481,7 +481,7 @@ static void closeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_sessio
/** Log routing failure due to closed session */
static void log_closed_session(mxs_mysql_cmd_t mysql_command, SERVER_REF* ref)
{
char msg[MAX_SERVER_ADDRESS_LEN + 200] = ""; // Extra space for message
char msg[SERVER::MAX_ADDRESS_LEN + 200] = ""; // Extra space for message
if (server_is_down(ref->server))
{

View File

@ -551,7 +551,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
*/
static inline bool rpl_lag_is_ok(RWBackend* backend, int max_rlag)
{
return max_rlag == MXS_RLAG_UNDEFINED || backend->server()->rlag <= max_rlag;
return max_rlag == SERVER::RLAG_UNDEFINED || backend->server()->rlag <= max_rlag;
}
RWBackend* RWSplitSession::get_hinted_backend(char* name)
@ -724,7 +724,7 @@ int RWSplitSession::get_max_replication_lag()
RWBackend* RWSplitSession::handle_hinted_target(GWBUF* querybuf, route_target_t route_target)
{
char* named_server = NULL;
int rlag_max = MXS_RLAG_UNDEFINED;
int rlag_max = SERVER::RLAG_UNDEFINED;
HINT* hint = querybuf->hint;
@ -756,7 +756,7 @@ RWBackend* RWSplitSession::handle_hinted_target(GWBUF* querybuf, route_target_t
hint = hint->next;
} /*< while */
if (rlag_max == MXS_RLAG_UNDEFINED) /*< no rlag max hint, use config */
if (rlag_max == SERVER::RLAG_UNDEFINED) /*< no rlag max hint, use config */
{
rlag_max = get_max_replication_lag();
}
@ -861,7 +861,7 @@ void RWSplitSession::log_master_routing_failure(bool found,
|| old_master->dcb()->role == DCB::Role::BACKEND);
mxb_assert(!curr_master || !curr_master->in_use()
|| curr_master->dcb()->role == DCB::Role::BACKEND);
char errmsg[MAX_SERVER_ADDRESS_LEN * 2 + 100]; // Extra space for error message
char errmsg[SERVER::MAX_ADDRESS_LEN * 2 + 100]; // Extra space for error message
if (m_config.delayed_retry && m_retry_duration >= m_config.delayed_retry_timeout)
{
@ -959,7 +959,7 @@ bool RWSplitSession::should_migrate_trx(RWBackend* target)
*/
bool RWSplitSession::handle_master_is_target(RWBackend** dest)
{
RWBackend* target = get_target_backend(BE_MASTER, NULL, MXS_RLAG_UNDEFINED);
RWBackend* target = get_target_backend(BE_MASTER, NULL, SERVER::RLAG_UNDEFINED);
bool succp = true;
if (should_replace_master(target))