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

@ -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))