MXS-2246 Remove duplicate info in SERVICE and Service
Both of them contained fields for the service and router names. Now the names are in SERVICE and they must be accessed via member function.
This commit is contained in:
parent
2528c5fa4d
commit
1fed465fdb
@ -94,11 +94,9 @@ inline bool server_ref_is_active(const SERVER_REF* ref)
|
||||
class SERVICE
|
||||
{
|
||||
public:
|
||||
const char* name; /**< The service name */
|
||||
int state; /**< The service state */
|
||||
int client_count; /**< Number of connected clients */
|
||||
int max_connections; /**< Maximum client connections */
|
||||
const char* routerModule; /**< Name of router module to use */
|
||||
struct mxs_router_object* router; /**< The router we are using */
|
||||
struct mxs_router* router_instance; /**< The router instance for this
|
||||
* service */
|
||||
@ -144,6 +142,28 @@ public:
|
||||
* active */
|
||||
int32_t retain_last_statements; /**< How many statements to retain per session,
|
||||
* -1 if not explicitly specified. */
|
||||
|
||||
const char* name() const
|
||||
{
|
||||
return m_name.c_str();
|
||||
}
|
||||
|
||||
const char* router_name() const
|
||||
{
|
||||
return m_router_name.c_str();
|
||||
}
|
||||
|
||||
protected:
|
||||
SERVICE(const std::string& name,
|
||||
const std::string& router_name)
|
||||
: m_name(name) /** Service name. */
|
||||
, m_router_name(router_name) /** Router module. */
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string m_name;
|
||||
const std::string m_router_name;
|
||||
};
|
||||
|
||||
typedef enum count_spec_t
|
||||
|
@ -3996,7 +3996,7 @@ int create_new_listener(CONFIG_CONTEXT* obj)
|
||||
MXS_ERROR("Creation of listener '%s' for service '%s' failed, because "
|
||||
"listener '%s' already listens on the %s %s.",
|
||||
obj->object,
|
||||
service->name,
|
||||
service->name(),
|
||||
l->name(),
|
||||
socket ? "socket" : "port",
|
||||
socket ? socket : port);
|
||||
|
@ -151,7 +151,7 @@ bool runtime_link_server(Server* server, const char* target)
|
||||
else
|
||||
{
|
||||
config_runtime_error("Service '%s' already uses server '%s'",
|
||||
service->name,
|
||||
service->name(),
|
||||
server->name());
|
||||
}
|
||||
}
|
||||
@ -159,7 +159,7 @@ bool runtime_link_server(Server* server, const char* target)
|
||||
{
|
||||
config_runtime_error("The servers of the service '%s' are defined by the monitor '%s'. "
|
||||
"Servers cannot explicitly be added to the service.",
|
||||
service->name,
|
||||
service->name(),
|
||||
service->m_monitor->m_name);
|
||||
}
|
||||
}
|
||||
@ -207,7 +207,7 @@ bool runtime_unlink_server(Server* server, const char* target)
|
||||
{
|
||||
config_runtime_error("The servers of the service '%s' are defined by the monitor '%s'. "
|
||||
"Servers cannot explicitly be removed from the service.",
|
||||
service->name,
|
||||
service->name(),
|
||||
service->m_monitor->m_name);
|
||||
}
|
||||
}
|
||||
@ -704,7 +704,7 @@ bool runtime_alter_monitor(Monitor* monitor, const char* key, const char* value)
|
||||
|
||||
bool runtime_alter_service(Service* service, const char* zKey, const char* zValue)
|
||||
{
|
||||
const MXS_MODULE* mod = get_module(service->routerModule, MODULE_ROUTER);
|
||||
const MXS_MODULE* mod = get_module(service->router_name(), MODULE_ROUTER);
|
||||
std::string key(zKey);
|
||||
std::string value(zValue);
|
||||
|
||||
@ -749,21 +749,21 @@ bool runtime_alter_service(Service* service, const char* zKey, const char* zValu
|
||||
rval = false;
|
||||
config_runtime_error("Reconfiguration of service '%s' failed. See log "
|
||||
"file for more details.",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rval = false;
|
||||
config_runtime_error("Router '%s' does not support reconfiguration.",
|
||||
service->routerModule);
|
||||
service->router_name());
|
||||
}
|
||||
}
|
||||
|
||||
if (rval)
|
||||
{
|
||||
service_serialize(service);
|
||||
MXS_NOTICE("Updated service '%s': %s=%s", service->name, key.c_str(), value.c_str());
|
||||
MXS_NOTICE("Updated service '%s': %s=%s", service->name(), key.c_str(), value.c_str());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -1125,7 +1125,7 @@ bool runtime_create_listener(Service* service,
|
||||
if (listener && listener_serialize(listener))
|
||||
{
|
||||
MXS_NOTICE("Created %slistener '%s' at %s:%s for service '%s'",
|
||||
ssl ? "TLS encrypted " : "", name, print_addr, port, service->name);
|
||||
ssl ? "TLS encrypted " : "", name, print_addr, port, service->name());
|
||||
|
||||
if (listener->listen())
|
||||
{
|
||||
@ -1181,8 +1181,8 @@ bool runtime_destroy_listener(Service* service, const char* name)
|
||||
|
||||
if (!service_remove_listener(service, name))
|
||||
{
|
||||
MXS_ERROR("Failed to destroy listener '%s' for service '%s'", name, service->name);
|
||||
config_runtime_error("Failed to destroy listener '%s' for service '%s'", name, service->name);
|
||||
MXS_ERROR("Failed to destroy listener '%s' for service '%s'", name, service->name());
|
||||
config_runtime_error("Failed to destroy listener '%s' for service '%s'", name, service->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1191,7 +1191,7 @@ bool runtime_destroy_listener(Service* service, const char* name)
|
||||
"will be removed after the next restart of MaxScale or "
|
||||
"when the associated service is destroyed.",
|
||||
name,
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -1402,7 +1402,7 @@ bool runtime_destroy_service(Service* service)
|
||||
{
|
||||
config_runtime_error("Service '%s' cannot be destroyed: Remove all servers and "
|
||||
"destroy all listeners first",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -2397,7 +2397,7 @@ bool service_to_filter_relations(Service* service, json_t* old_json, json_t* new
|
||||
}
|
||||
else
|
||||
{
|
||||
config_runtime_error("Invalid object relations for '%s'", service->name);
|
||||
config_runtime_error("Invalid object relations for '%s'", service->name());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -2502,7 +2502,7 @@ bool runtime_alter_service_relationships_from_json(Service* service, const char*
|
||||
|
||||
if (strcmp(type, CN_SERVERS) == 0)
|
||||
{
|
||||
rval = object_to_server_relations(service->name, old_json.get(), j.get());
|
||||
rval = object_to_server_relations(service->name(), old_json.get(), j.get());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2534,7 +2534,7 @@ bool runtime_alter_service_from_json(Service* service, json_t* new_json)
|
||||
mxb_assert(old_json.get());
|
||||
|
||||
if (is_valid_resource_body(new_json)
|
||||
&& object_to_server_relations(service->name, old_json.get(), new_json)
|
||||
&& object_to_server_relations(service->name(), old_json.get(), new_json)
|
||||
&& service_to_filter_relations(service, old_json.get(), new_json))
|
||||
{
|
||||
rval = true;
|
||||
@ -2555,7 +2555,7 @@ bool runtime_alter_service_from_json(Service* service, json_t* new_json)
|
||||
}
|
||||
}
|
||||
|
||||
const MXS_MODULE* mod = get_module(service->routerModule, MODULE_ROUTER);
|
||||
const MXS_MODULE* mod = get_module(service->router_name(), MODULE_ROUTER);
|
||||
|
||||
for (int i = 0; mod->parameters[i].name; i++)
|
||||
{
|
||||
|
@ -1374,7 +1374,7 @@ void dprintOneDCB(DCB* pdcb, DCB* dcb)
|
||||
{
|
||||
dcb_printf(pdcb,
|
||||
"\tService: %s\n",
|
||||
dcb->session->service->name);
|
||||
dcb->session->service->name());
|
||||
}
|
||||
if (dcb->remote)
|
||||
{
|
||||
@ -1469,7 +1469,7 @@ static bool dlist_dcbs_cb(DCB* dcb, void* data)
|
||||
" %-16p | %-26s | %-18s | %s\n",
|
||||
dcb,
|
||||
gw_dcb_state2string(dcb->state),
|
||||
((dcb->session && dcb->session->service) ? dcb->session->service->name : ""),
|
||||
((dcb->session && dcb->session->service) ? dcb->session->service->name() : ""),
|
||||
(dcb->remote ? dcb->remote : ""));
|
||||
return true;
|
||||
}
|
||||
@ -1505,7 +1505,7 @@ static bool dlist_clients_cb(DCB* dcb, void* data)
|
||||
(dcb->remote ? dcb->remote : ""),
|
||||
dcb,
|
||||
(dcb->session->service ?
|
||||
dcb->session->service->name : ""),
|
||||
dcb->session->service->name() : ""),
|
||||
dcb->session);
|
||||
}
|
||||
|
||||
@ -1546,7 +1546,7 @@ void dprintDCB(DCB* pdcb, DCB* dcb)
|
||||
{
|
||||
dcb_printf(pdcb,
|
||||
"\tService: %s\n",
|
||||
dcb->session->service->name);
|
||||
dcb->session->service->name());
|
||||
}
|
||||
if (dcb->remote)
|
||||
{
|
||||
@ -3069,8 +3069,8 @@ int poll_add_dcb(DCB* dcb)
|
||||
|
||||
if (dcb->role == DCB::Role::CLIENT)
|
||||
{
|
||||
if (strcasecmp(dcb->service->routerModule, "cli") == 0
|
||||
|| strcasecmp(dcb->service->routerModule, "maxinfo") == 0)
|
||||
if (strcasecmp(dcb->service->router_name(), "cli") == 0
|
||||
|| strcasecmp(dcb->service->router_name(), "maxinfo") == 0)
|
||||
{
|
||||
// If the DCB refers to an accepted maxadmin/maxinfo socket, we force it
|
||||
// to the main thread. That's done in order to prevent a deadlock
|
||||
|
@ -515,7 +515,7 @@ bool Listener::create_listener_config(const char* filename)
|
||||
dprintf(file, "[%s]\n", m_name.c_str());
|
||||
dprintf(file, "type=listener\n");
|
||||
dprintf(file, "protocol=%s\n", m_protocol.c_str());
|
||||
dprintf(file, "service=%s\n", m_service->name);
|
||||
dprintf(file, "service=%s\n", m_service->name());
|
||||
dprintf(file, "address=%s\n", m_address.c_str());
|
||||
dprintf(file, "port=%u\n", m_port);
|
||||
dprintf(file, "authenticator=%s\n", m_authenticator.c_str());
|
||||
@ -970,7 +970,7 @@ bool Listener::listen_shared(std::string config_bind)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("[%s] Failed to listen on %s", m_service->name, config_bind.c_str());
|
||||
MXS_ERROR("[%s] Failed to listen on %s", m_service->name(), config_bind.c_str());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -987,12 +987,12 @@ bool Listener::listen()
|
||||
{
|
||||
case MXS_AUTH_LOADUSERS_FATAL:
|
||||
MXS_ERROR("[%s] Fatal error when loading users for listener '%s', "
|
||||
"service is not started.", m_service->name, name());
|
||||
"service is not started.", m_service->name(), name());
|
||||
return false;
|
||||
|
||||
case MXS_AUTH_LOADUSERS_ERROR:
|
||||
MXS_WARNING("[%s] Failed to load users for listener '%s', authentication"
|
||||
" might not work.", m_service->name, name());
|
||||
" might not work.", m_service->name(), name());
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -276,7 +276,7 @@ static bool process_argument(const MODULECMD* cmd,
|
||||
if ((arg->value.service = service_find((char*)value)))
|
||||
{
|
||||
if (MODULECMD_ALLOW_NAME_MISMATCH(type)
|
||||
|| strcmp(cmd->domain, arg->value.service->routerModule) == 0)
|
||||
|| strcmp(cmd->domain, arg->value.service->router_name()) == 0)
|
||||
{
|
||||
arg->type.type = MODULECMD_ARG_SERVICE;
|
||||
rval = true;
|
||||
|
@ -114,7 +114,7 @@ Service* service_alloc(const char* name, const char* router, MXS_CONFIG_PARAMETE
|
||||
|
||||
if (service->router_instance == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Failed to create router instance. Service not started.", service->name);
|
||||
MXS_ERROR("%s: Failed to create router instance. Service not started.", service->name());
|
||||
service->active = false;
|
||||
delete service;
|
||||
return NULL;
|
||||
@ -174,11 +174,10 @@ void service_remove_server(Monitor* pMonitor, SERVER* pServer)
|
||||
}
|
||||
}
|
||||
|
||||
Service::Service(const std::string& service_name,
|
||||
Service::Service(const std::string& name,
|
||||
const std::string& router_name,
|
||||
MXS_CONFIG_PARAMETER* params)
|
||||
: m_name(service_name)
|
||||
, m_router_name(router_name)
|
||||
: SERVICE(name, router_name)
|
||||
, m_user(params->get_string(CN_USER))
|
||||
, m_password(params->get_string(CN_PASSWORD))
|
||||
, m_weightby(params->get_string(CN_WEIGHTBY))
|
||||
@ -194,9 +193,6 @@ Service::Service(const std::string& service_name,
|
||||
capabilities = module->module_capabilities;
|
||||
client_count = 0;
|
||||
n_dbref = 0;
|
||||
// TODO: Remove once the name and router module are not directly visible to modules
|
||||
name = m_name.c_str();
|
||||
routerModule = m_router_name.c_str();
|
||||
svc_config_param = NULL;
|
||||
svc_config_version = 0;
|
||||
stats.started = time(0);
|
||||
@ -306,7 +302,7 @@ void service_destroy(Service* service)
|
||||
sizeof(filename),
|
||||
"%s/%s.cnf",
|
||||
get_config_persistdir(),
|
||||
service->name);
|
||||
service->name());
|
||||
|
||||
if (unlink(filename) == -1 && errno != ENOENT)
|
||||
{
|
||||
@ -384,7 +380,7 @@ int serviceStartAllPorts(Service* service)
|
||||
service->stats.n_failed_starts++;
|
||||
int retry_after = MXS_MIN(service->stats.n_failed_starts * 10, service->max_retry_interval);
|
||||
MXS_NOTICE("Failed to start service %s, retrying in %d seconds.",
|
||||
service->name,
|
||||
service->name(),
|
||||
retry_after);
|
||||
|
||||
mxb::Worker* worker = mxb::Worker::get_current();
|
||||
@ -397,7 +393,7 @@ int serviceStartAllPorts(Service* service)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_WARNING("Service '%s' has no listeners defined.", service->name);
|
||||
MXS_WARNING("Service '%s' has no listeners defined.", service->name());
|
||||
listeners = 1; /** Set this to one to suppress errors */
|
||||
}
|
||||
|
||||
@ -458,11 +454,11 @@ bool service_launch_all()
|
||||
for (Service* service : this_unit.services)
|
||||
{
|
||||
n += (i = serviceInitialize(service));
|
||||
MXS_NOTICE("Service '%s' started (%d/%d)", service->name, curr_svc++, num_svc);
|
||||
MXS_NOTICE("Service '%s' started (%d/%d)", service->name(), curr_svc++, num_svc);
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
MXS_ERROR("Failed to start service '%s'.", service->name);
|
||||
MXS_ERROR("Failed to start service '%s'.", service->name());
|
||||
ok = false;
|
||||
}
|
||||
|
||||
@ -781,7 +777,7 @@ bool Service::set_filters(const std::vector<std::string>& filters)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Unable to find filter '%s' for service '%s'", f.c_str(), name);
|
||||
MXS_ERROR("Unable to find filter '%s' for service '%s'", f.c_str(), name());
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
@ -839,7 +835,7 @@ Service* service_internal_find(const char* name)
|
||||
|
||||
for (Service* s : this_unit.services)
|
||||
{
|
||||
if (strcmp(s->name, name) == 0 && atomic_load_int(&s->active))
|
||||
if (strcmp(s->name(), name) == 0 && atomic_load_int(&s->active))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
@ -888,8 +884,8 @@ void dprintService(DCB* dcb, SERVICE* svc)
|
||||
struct tm result;
|
||||
char timebuf[30];
|
||||
|
||||
dcb_printf(dcb, "\tService: %s\n", service->name);
|
||||
dcb_printf(dcb, "\tRouter: %s\n", service->routerModule);
|
||||
dcb_printf(dcb, "\tService: %s\n", service->name());
|
||||
dcb_printf(dcb, "\tRouter: %s\n", service->router_name());
|
||||
switch (service->state)
|
||||
{
|
||||
case SERVICE_STATE_STARTED:
|
||||
@ -986,8 +982,8 @@ void dListServices(DCB* dcb)
|
||||
mxb_assert(service->stats.n_current >= 0);
|
||||
dcb_printf(dcb,
|
||||
"%-25s | %-17s | %6d | %14d | ",
|
||||
service->name,
|
||||
service->routerModule,
|
||||
service->name(),
|
||||
service->router_name(),
|
||||
service->stats.n_current,
|
||||
service->stats.n_sessions);
|
||||
|
||||
@ -1047,7 +1043,7 @@ void dListListeners(DCB* dcb)
|
||||
dcb_printf(dcb,
|
||||
"%-20s | %-19s | %-18s | %-15s | %5d | %s\n",
|
||||
listener->name(),
|
||||
service->name,
|
||||
service->name(),
|
||||
listener->protocol(),
|
||||
(listener && *listener->address()) ? listener->address() : "*",
|
||||
listener->port(),
|
||||
@ -1224,7 +1220,7 @@ std::unique_ptr<ResultSet> serviceGetListenerList()
|
||||
{
|
||||
for (const auto& listener : listener_find_by_service(service))
|
||||
{
|
||||
set->add_row({service->name, listener->protocol(), listener->address(),
|
||||
set->add_row({service->name(), listener->protocol(), listener->address(),
|
||||
std::to_string(listener->port()), listener->state()});
|
||||
}
|
||||
}
|
||||
@ -1245,7 +1241,7 @@ std::unique_ptr<ResultSet> serviceGetList()
|
||||
|
||||
for (Service* s : this_unit.services)
|
||||
{
|
||||
set->add_row({s->name, s->routerModule, std::to_string(s->stats.n_current),
|
||||
set->add_row({s->name(), s->router_name(), std::to_string(s->stats.n_current),
|
||||
std::to_string(s->stats.n_sessions)});
|
||||
}
|
||||
|
||||
@ -1279,7 +1275,7 @@ bool service_all_services_have_listeners()
|
||||
{
|
||||
if (listener_find_by_service(service).empty())
|
||||
{
|
||||
MXS_ERROR("Service '%s' has no listeners.", service->name);
|
||||
MXS_ERROR("Service '%s' has no listeners.", service->name());
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
@ -1318,7 +1314,7 @@ static void service_calculate_weights(SERVICE* service)
|
||||
{
|
||||
MXS_WARNING("Weighting parameters for service '%s' will be ignored as "
|
||||
"no servers have (positive) values for the parameter '%s'.",
|
||||
service->name,
|
||||
service->name(),
|
||||
weightby);
|
||||
}
|
||||
else
|
||||
@ -1484,7 +1480,7 @@ bool service_serialize(const Service* service)
|
||||
sizeof(filename),
|
||||
"%s/%s.cnf.tmp",
|
||||
get_config_persistdir(),
|
||||
service->name);
|
||||
service->name());
|
||||
|
||||
if (unlink(filename) == -1 && errno != ENOENT)
|
||||
{
|
||||
@ -1577,7 +1573,7 @@ json_t* service_parameters_to_json(const SERVICE* service)
|
||||
{
|
||||
json_t* rval = json_object();
|
||||
|
||||
const MXS_MODULE* mod = get_module(service->routerModule, MODULE_ROUTER);
|
||||
const MXS_MODULE* mod = get_module(service->router_name(), MODULE_ROUTER);
|
||||
config_add_module_params_json(service->svc_config_param,
|
||||
{CN_TYPE, CN_ROUTER, CN_SERVERS, CN_FILTERS},
|
||||
config_service_params,
|
||||
@ -1628,7 +1624,7 @@ json_t* service_attributes(const SERVICE* service)
|
||||
{
|
||||
json_t* attr = json_object();
|
||||
|
||||
json_object_set_new(attr, CN_ROUTER, json_string(service->routerModule));
|
||||
json_object_set_new(attr, CN_ROUTER, json_string(service->router_name()));
|
||||
json_object_set_new(attr, CN_STATE, json_string(service_state_to_string(service->state)));
|
||||
|
||||
if (service->router && service->router_instance && service->router->diagnostics_json)
|
||||
@ -1699,11 +1695,11 @@ json_t* service_json_data(const SERVICE* svc, const char* host)
|
||||
json_t* rval = json_object();
|
||||
LockGuard guard(service->lock);
|
||||
|
||||
json_object_set_new(rval, CN_ID, json_string(service->name));
|
||||
json_object_set_new(rval, CN_ID, json_string(service->name()));
|
||||
json_object_set_new(rval, CN_TYPE, json_string(CN_SERVICES));
|
||||
json_object_set_new(rval, CN_ATTRIBUTES, service_attributes(service));
|
||||
json_object_set_new(rval, CN_RELATIONSHIPS, service->json_relationships(host));
|
||||
json_object_set_new(rval, CN_LINKS, mxs_json_self_link(host, CN_SERVICES, service->name));
|
||||
json_object_set_new(rval, CN_LINKS, mxs_json_self_link(host, CN_SERVICES, service->name()));
|
||||
|
||||
return rval;
|
||||
}
|
||||
@ -1711,7 +1707,7 @@ json_t* service_json_data(const SERVICE* svc, const char* host)
|
||||
json_t* service_to_json(const Service* service, const char* host)
|
||||
{
|
||||
string self = MXS_JSON_API_SERVICES;
|
||||
self += service->name;
|
||||
self += service->name();
|
||||
return mxs_json_resource(host, self.c_str(), service_json_data(service, host));
|
||||
}
|
||||
|
||||
@ -1720,7 +1716,7 @@ json_t* service_listener_list_to_json(const Service* service, const char* host)
|
||||
/** This needs to be done here as the listeners are sort of sub-resources
|
||||
* of the service. */
|
||||
string self = MXS_JSON_API_SERVICES;
|
||||
self += service->name;
|
||||
self += service->name();
|
||||
self += "/listeners";
|
||||
|
||||
return mxs_json_resource(host, self.c_str(), service_all_listeners_json_data(service));
|
||||
@ -1731,7 +1727,7 @@ json_t* service_listener_to_json(const Service* service, const char* name, const
|
||||
/** This needs to be done here as the listeners are sort of sub-resources
|
||||
* of the service. */
|
||||
string self = MXS_JSON_API_SERVICES;
|
||||
self += service->name;
|
||||
self += service->name();
|
||||
self += "/listeners/";
|
||||
self += name;
|
||||
|
||||
@ -1767,7 +1763,7 @@ json_t* service_relations_to_filter(const SFilterDef& filter, const char* host)
|
||||
{
|
||||
if (f == filter)
|
||||
{
|
||||
mxs_json_add_relation(rel, service->name, CN_SERVICES);
|
||||
mxs_json_add_relation(rel, service->name(), CN_SERVICES);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1789,7 +1785,7 @@ json_t* service_relations_to_server(const SERVER* server, const char* host)
|
||||
{
|
||||
if (ref->server == server && server_ref_is_active(ref))
|
||||
{
|
||||
names.push_back(service->name);
|
||||
names.push_back(service->name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ bool session_start(MXS_SESSION* session)
|
||||
{
|
||||
session->state = SESSION_STATE_TO_BE_FREED;
|
||||
MXS_ERROR("Failed to create new router session for service '%s'. "
|
||||
"See previous errors for more details.", session->service->name);
|
||||
"See previous errors for more details.", session->service->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ bool session_start(MXS_SESSION* session)
|
||||
if (!session_setup_filters(session))
|
||||
{
|
||||
session->state = SESSION_STATE_TO_BE_FREED;
|
||||
MXS_ERROR("Setting up filters failed. Terminating session %s.", session->service->name);
|
||||
MXS_ERROR("Setting up filters failed. Terminating session %s.", session->service->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ bool session_start(MXS_SESSION* session)
|
||||
mxb::atomic::add(&session->service->stats.n_current, 1, mxb::atomic::RELAXED);
|
||||
|
||||
MXS_INFO("Started %s client session [%" PRIu64 "] for '%s' from %s",
|
||||
session->service->name, session->ses_id,
|
||||
session->service->name(), session->ses_id,
|
||||
session->client_dcb->user ? session->client_dcb->user : "<no user>",
|
||||
session->client_dcb->remote);
|
||||
|
||||
@ -255,7 +255,7 @@ private:
|
||||
*/
|
||||
static void session_free(MXS_SESSION* session)
|
||||
{
|
||||
MXS_INFO("Stopped %s client session [%" PRIu64 "]", session->service->name, session->ses_id);
|
||||
MXS_INFO("Stopped %s client session [%" PRIu64 "]", session->service->name(), session->ses_id);
|
||||
Service* service = static_cast<Service*>(session->service);
|
||||
|
||||
session_final_free(session);
|
||||
@ -318,7 +318,7 @@ void printSession(MXS_SESSION* session)
|
||||
|
||||
printf("Session %p\n", session);
|
||||
printf("\tState: %s\n", session_state_to_string(session->state));
|
||||
printf("\tService: %s (%p)\n", session->service->name, session->service);
|
||||
printf("\tService: %s (%p)\n", session->service->name(), session->service);
|
||||
printf("\tClient DCB: %p\n", session->client_dcb);
|
||||
printf("\tConnected: %s\n",
|
||||
asctime_r(localtime_r(&session->stats.connect, &result), timebuf));
|
||||
@ -387,7 +387,7 @@ void dprintSession(DCB* dcb, MXS_SESSION* print_session)
|
||||
|
||||
dcb_printf(dcb, "Session %" PRIu64 "\n", print_session->ses_id);
|
||||
dcb_printf(dcb, "\tState: %s\n", session_state_to_string(print_session->state));
|
||||
dcb_printf(dcb, "\tService: %s\n", print_session->service->name);
|
||||
dcb_printf(dcb, "\tService: %s\n", print_session->service->name());
|
||||
|
||||
if (print_session->client_dcb && print_session->client_dcb->remote)
|
||||
{
|
||||
@ -427,8 +427,8 @@ bool dListSessions_cb(DCB* dcb, void* data)
|
||||
session->ses_id,
|
||||
session->client_dcb && session->client_dcb->remote ?
|
||||
session->client_dcb->remote : "",
|
||||
session->service && session->service->name ?
|
||||
session->service->name : "",
|
||||
session->service && session->service->name() ?
|
||||
session->service->name() : "",
|
||||
session_state_to_string(session->state));
|
||||
}
|
||||
|
||||
@ -601,7 +601,7 @@ bool dcb_iter_cb(DCB* dcb, void* data)
|
||||
char buf[20];
|
||||
snprintf(buf, sizeof(buf), "%p", ses);
|
||||
|
||||
set->add_row({buf, ses->client_dcb->remote, ses->service->name, session_state_to_string(ses->state)});
|
||||
set->add_row({buf, ses->client_dcb->remote, ses->service->name(), session_state_to_string(ses->state)});
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -731,7 +731,7 @@ json_t* session_json_data(const Session* session, const char* host)
|
||||
|
||||
/** Service relationship (one-to-one) */
|
||||
json_t* services = mxs_json_relationship(host, MXS_JSON_API_SERVICES);
|
||||
mxs_json_add_relation(services, session->service->name, CN_SERVICES);
|
||||
mxs_json_add_relation(services, session->service->name(), CN_SERVICES);
|
||||
json_object_set_new(rel, CN_SERVICES, services);
|
||||
|
||||
/** Filter relationships (one-to-many) */
|
||||
@ -1245,7 +1245,7 @@ bool Session::setup_filters(Service* service)
|
||||
{
|
||||
MXS_ERROR("Failed to create filter '%s' for service '%s'.\n",
|
||||
filter_def_get_name(it->filter.get()),
|
||||
service->name);
|
||||
service->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1263,7 +1263,7 @@ bool Session::setup_filters(Service* service)
|
||||
{
|
||||
MXS_ERROR("Failed to create filter '%s' for service '%s'.",
|
||||
filter_def_get_name(it->filter.get()),
|
||||
service->name);
|
||||
service->name());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ int ssl_authenticate_client(DCB* dcb, bool is_capable)
|
||||
{
|
||||
const char* user = dcb->user ? dcb->user : "";
|
||||
const char* remote = dcb->remote ? dcb->remote : "";
|
||||
const char* service = (dcb->service && dcb->service->name) ? dcb->service->name : "";
|
||||
const char* service = (dcb->service && dcb->service->name()) ? dcb->service->name() : "";
|
||||
|
||||
if (NULL == dcb->session->listener || NULL == dcb->session->listener->ssl())
|
||||
{
|
||||
|
@ -72,7 +72,7 @@ static int test1()
|
||||
|
||||
mxb_assert_message(NULL != service, "New service with valid router must not be null");
|
||||
mxb_assert_message(0 != service_isvalid(service), "Service must be valid after creation");
|
||||
mxb_assert_message(0 == strcmp("MyService", service->name), "Service must have given name");
|
||||
mxb_assert_message(0 == strcmp("MyService", service->name()), "Service must have given name");
|
||||
fprintf(stderr, "\t..done\nAdding protocol testprotocol.");
|
||||
mxb_assert_message(Listener::create(service,
|
||||
"TestProtocol",
|
||||
|
@ -96,7 +96,7 @@ static bool cdc_add_new_user(const MODULECMD_ARG* args, json_t** output)
|
||||
|
||||
SERVICE* service = args->argv[0].value.service;
|
||||
char path[PATH_MAX + 1];
|
||||
snprintf(path, PATH_MAX, "%s/%s/", get_datadir(), service->name);
|
||||
snprintf(path, PATH_MAX, "%s/%s/", get_datadir(), service->name());
|
||||
bool rval = false;
|
||||
|
||||
if (mxs_mkdir_all(path, 0777))
|
||||
@ -108,7 +108,7 @@ static bool cdc_add_new_user(const MODULECMD_ARG* args, json_t** output)
|
||||
{
|
||||
if (write(fd, final_data, sizeof(final_data)) == static_cast<int>(sizeof(final_data)))
|
||||
{
|
||||
MXS_NOTICE("Added user '%s' to service '%s'", user, service->name);
|
||||
MXS_NOTICE("Added user '%s' to service '%s'", user, service->name());
|
||||
rval = true;
|
||||
}
|
||||
else
|
||||
@ -282,7 +282,7 @@ static int cdc_auth_authenticate(DCB* dcb)
|
||||
{
|
||||
MXS_LOG_EVENT(maxscale::event::AUTHENTICATION_FAILURE,
|
||||
"%s: login attempt for user '%s', authentication failed.",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
client_data->user);
|
||||
}
|
||||
}
|
||||
@ -453,7 +453,7 @@ static int cdc_set_service_user(Listener* listener)
|
||||
{
|
||||
MXS_ERROR("decrypt password failed for service user %s, service %s",
|
||||
service_user,
|
||||
service->name);
|
||||
service->name());
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -551,7 +551,7 @@ int cdc_replace_users(Listener* listener)
|
||||
PATH_MAX,
|
||||
"%s/%s/%s",
|
||||
get_datadir(),
|
||||
listener->service()->name,
|
||||
listener->service()->name(),
|
||||
CDC_USERS_FILENAME);
|
||||
|
||||
int i = cdc_read_users(newusers, path);
|
||||
|
@ -736,7 +736,7 @@ static bool check_table_permissions(MYSQL* mysql,
|
||||
MXS_LOG_MESSAGE(log_priority,
|
||||
"[%s] User '%s' is missing SELECT privileges "
|
||||
"on %s table.%sMySQL error message: %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
user,
|
||||
table,
|
||||
message ? message : " ",
|
||||
@ -746,7 +746,7 @@ static bool check_table_permissions(MYSQL* mysql,
|
||||
{
|
||||
MXS_ERROR("[%s] Failed to query from %s table."
|
||||
" MySQL error message: %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
table,
|
||||
mysql_error(mysql));
|
||||
}
|
||||
@ -759,7 +759,7 @@ static bool check_table_permissions(MYSQL* mysql,
|
||||
{
|
||||
MXS_ERROR("[%s] Result retrieval failed when checking for permissions to "
|
||||
"the %s table: %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
table,
|
||||
mysql_error(mysql));
|
||||
}
|
||||
@ -818,7 +818,7 @@ static bool check_default_table_permissions(MYSQL* mysql,
|
||||
{
|
||||
MXS_WARNING("[%s] User '%s' is missing the SHOW DATABASES privilege. "
|
||||
"This means that MaxScale cannot see all databases and authentication can fail.",
|
||||
service->name,
|
||||
service->name(),
|
||||
user);
|
||||
}
|
||||
|
||||
@ -895,7 +895,7 @@ static bool check_server_permissions(SERVICE* service,
|
||||
|
||||
MXS_ERROR("[%s] Failed to connect to server '%s' ([%s]:%d) when"
|
||||
" checking authentication user credentials and permissions: %d %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
server->name(),
|
||||
server->address,
|
||||
server->port,
|
||||
@ -1027,7 +1027,7 @@ static bool roles_are_available(MYSQL* conn, SERVICE* service, SERVER* server)
|
||||
MXS_WARNING("The user for service '%s' might be missing the SELECT grant on "
|
||||
"`mysql.roles_mapping` or `mysql.user`. Use of default roles is disabled "
|
||||
"until the missing privileges are added. Error was: %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
mysql_error(conn));
|
||||
}
|
||||
}
|
||||
@ -1238,7 +1238,7 @@ static int get_users(Listener* listener, bool skip_local)
|
||||
"[%s:%i] for service [%s]. MySQL error %i, %s",
|
||||
server->server->address,
|
||||
server->server->port,
|
||||
service->name,
|
||||
service->name(),
|
||||
mysql_errno(con),
|
||||
mysql_error(con));
|
||||
mysql_close(con);
|
||||
@ -1274,7 +1274,7 @@ static int get_users(Listener* listener, bool skip_local)
|
||||
{
|
||||
MXS_ERROR("Unable to get user data from backend database for service [%s]."
|
||||
" Failed to connect to any of the backend databases.",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
|
||||
return total_users;
|
||||
|
@ -334,7 +334,7 @@ static int mysql_auth_authenticate(DCB* dcb)
|
||||
|
||||
MXS_LOG_EVENT(maxscale::event::AUTHENTICATION_FAILURE,
|
||||
"%s: login attempt for user '%s'@[%s]:%d, authentication failed. %s",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
client_data->user,
|
||||
dcb->remote,
|
||||
dcb_get_port(dcb),
|
||||
@ -346,7 +346,7 @@ static int mysql_auth_authenticate(DCB* dcb)
|
||||
MXS_NOTICE("If you have a wildcard grant that covers this address, "
|
||||
"try adding 'localhost_match_wildcard_host=true' for "
|
||||
"service '%s'. ",
|
||||
dcb->service->name);
|
||||
dcb->service->name());
|
||||
}
|
||||
}
|
||||
|
||||
@ -566,7 +566,7 @@ static bool add_service_user(Listener* port)
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("[%s] Failed to decrypt service user password.", port->service()->name);
|
||||
MXS_ERROR("[%s] Failed to decrypt service user password.", port->service()->name());
|
||||
}
|
||||
|
||||
return rval;
|
||||
@ -621,7 +621,7 @@ static int mysql_auth_load_users(Listener* port)
|
||||
if (loaded < 0)
|
||||
{
|
||||
MXS_ERROR("[%s] Unable to load users for listener %s listening at [%s]:%d.",
|
||||
service->name,
|
||||
service->name(),
|
||||
port->name(),
|
||||
*port->address() ? port->address() : "::",
|
||||
port->port());
|
||||
@ -633,7 +633,7 @@ static int mysql_auth_load_users(Listener* port)
|
||||
* if loading of the users fails */
|
||||
if (!add_service_user(port))
|
||||
{
|
||||
MXS_ERROR("[%s] Failed to inject service user.", port->service()->name);
|
||||
MXS_ERROR("[%s] Failed to inject service user.", port->service()->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -649,18 +649,18 @@ static int mysql_auth_load_users(Listener* port)
|
||||
MXS_NOTICE("[%s] No users were loaded but 'inject_service_user' is enabled. "
|
||||
"Enabling service credentials for authentication until "
|
||||
"database users have been successfully loaded.",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
}
|
||||
else if (loaded == 0 && !first_load)
|
||||
{
|
||||
MXS_WARNING("[%s]: failed to load any user information. Authentication"
|
||||
" will probably fail as a result.",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
else if (loaded > 0 && first_load)
|
||||
{
|
||||
MXS_NOTICE("[%s] Loaded %d MySQL users for listener %s.", service->name, loaded, port->name());
|
||||
MXS_NOTICE("[%s] Loaded %d MySQL users for listener %s.", service->name(), loaded, port->name());
|
||||
}
|
||||
|
||||
return rc;
|
||||
|
@ -220,7 +220,7 @@ int PamInstance::load_users(SERVICE* service)
|
||||
mxb_assert(mysql_num_fields(res) == PAM_USERS_QUERY_NUM_FIELDS);
|
||||
MXS_NOTICE("Loaded %llu users for service %s.",
|
||||
mysql_num_rows(res),
|
||||
service->name);
|
||||
service->name());
|
||||
MYSQL_ROW row;
|
||||
while ((row = mysql_fetch_row(res)))
|
||||
{
|
||||
|
@ -1519,7 +1519,7 @@ int DbfwSession::routeQuery(GWBUF* buffer)
|
||||
if (match && m_instance->get_log_bitmask() & FW_LOG_MATCH)
|
||||
{
|
||||
MXS_NOTICE("[%s] Rule '%s' for '%s' matched by %s@%s: %s",
|
||||
m_session->service->name,
|
||||
m_session->service->name(),
|
||||
rname,
|
||||
suser->name(),
|
||||
user().c_str(),
|
||||
@ -1529,7 +1529,7 @@ int DbfwSession::routeQuery(GWBUF* buffer)
|
||||
else if (!match && m_instance->get_log_bitmask() & FW_LOG_NO_MATCH)
|
||||
{
|
||||
MXS_NOTICE("[%s] Query for '%s' by %s@%s was not matched: %s",
|
||||
m_session->service->name,
|
||||
m_session->service->name(),
|
||||
suser->name(),
|
||||
user().c_str(),
|
||||
remote().c_str(),
|
||||
|
@ -190,7 +190,7 @@ QlaFilterSession::QlaFilterSession(QlaInstance& instance, MXS_SESSION* session)
|
||||
: m_instance(instance)
|
||||
, m_user(session_get_user(session))
|
||||
, m_remote(session_get_remote(session))
|
||||
, m_service(session->service->name)
|
||||
, m_service(session->service->name())
|
||||
, m_ses_id(session->ses_id)
|
||||
{
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ void Tee::diagnostics(DCB* dcb)
|
||||
}
|
||||
dcb_printf(dcb,
|
||||
"\t\tDuplicate statements to service %s\n",
|
||||
m_service->name);
|
||||
m_service->name());
|
||||
if (m_user.length())
|
||||
{
|
||||
dcb_printf(dcb,
|
||||
@ -153,7 +153,7 @@ json_t* Tee::diagnostics_json() const
|
||||
json_object_set_new(rval, "source", json_string(m_source.c_str()));
|
||||
}
|
||||
|
||||
json_object_set_new(rval, "service", json_string(m_service->name));
|
||||
json_object_set_new(rval, "service", json_string(m_service->name()));
|
||||
|
||||
if (m_user.length())
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ TeeSession* TeeSession::create(Tee* my_instance, MXS_SESSION* session)
|
||||
const char* extra = !listener_find_by_service(my_instance->get_service()).empty() ? "" :
|
||||
": Service has no network listeners";
|
||||
MXS_ERROR("Failed to create local client connection to '%s'%s",
|
||||
my_instance->get_service()->name, extra);
|
||||
my_instance->get_service()->name(), extra);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static int cdc_read_event(DCB* dcb)
|
||||
write_auth_ack(dcb);
|
||||
|
||||
MXS_INFO("%s: Client [%s] authenticated with user [%s]",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "",
|
||||
client_data->user);
|
||||
}
|
||||
@ -167,7 +167,7 @@ static int cdc_read_event(DCB* dcb)
|
||||
|
||||
write_auth_err(dcb);
|
||||
MXS_ERROR("%s: authentication failure from [%s], user [%s]",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "",
|
||||
client_data->user);
|
||||
|
||||
@ -182,7 +182,7 @@ static int cdc_read_event(DCB* dcb)
|
||||
if (strncmp((char*)GWBUF_DATA(head), "CLOSE", GWBUF_LENGTH(head)) == 0)
|
||||
{
|
||||
MXS_INFO("%s: Client [%s] has requested CLOSE action",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "");
|
||||
|
||||
// gwbuf_set_type(head, GWBUF_TYPE_CDC);
|
||||
@ -198,7 +198,7 @@ static int cdc_read_event(DCB* dcb)
|
||||
else
|
||||
{
|
||||
MXS_INFO("%s: Client [%s] requested [%.*s] action",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "",
|
||||
(int)GWBUF_LENGTH(head),
|
||||
(char*)GWBUF_DATA(head));
|
||||
@ -210,7 +210,7 @@ static int cdc_read_event(DCB* dcb)
|
||||
|
||||
default:
|
||||
MXS_INFO("%s: Client [%s] in unknown state %d",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "",
|
||||
protocol->state);
|
||||
gwbuf_free(head);
|
||||
@ -316,7 +316,7 @@ static int cdc_accept(DCB* client_dcb)
|
||||
protocol->state = CDC_STATE_WAIT_FOR_AUTH;
|
||||
|
||||
MXS_NOTICE("%s: new connection from [%s]",
|
||||
client_dcb->service->name,
|
||||
client_dcb->service->name(),
|
||||
client_dcb->remote != NULL ? client_dcb->remote : "");
|
||||
|
||||
return 1;
|
||||
|
@ -94,17 +94,17 @@ Avro* Avro::create(SERVICE* service, SRowEventHandler handler)
|
||||
|
||||
if (source)
|
||||
{
|
||||
if (strcmp(source->routerModule, "binlogrouter") == 0)
|
||||
if (strcmp(source->router_name(), "binlogrouter") == 0)
|
||||
{
|
||||
MXS_INFO("Using configuration options from service '%s'.", source->name);
|
||||
MXS_INFO("Using configuration options from service '%s'.", source->name());
|
||||
source_service = source;
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Service '%s' uses router module '%s' instead of "
|
||||
"'binlogrouter'.",
|
||||
source->name,
|
||||
source->routerModule);
|
||||
source->name(),
|
||||
source->router_name());
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ int AvroSession::routeQuery(GWBUF* queue)
|
||||
|
||||
state = AVRO_CLIENT_REGISTERED;
|
||||
MXS_INFO("%s: Client [%s] has completed REGISTRATION action",
|
||||
dcb->service->name,
|
||||
dcb->service->name(),
|
||||
dcb->remote != NULL ? dcb->remote : "");
|
||||
}
|
||||
break;
|
||||
|
@ -213,7 +213,7 @@ bool avro_load_conversion_state(Avro* router)
|
||||
return true;
|
||||
}
|
||||
|
||||
MXS_NOTICE("[%s] Loading stored conversion state: %s", router->service->name, filename);
|
||||
MXS_NOTICE("[%s] Loading stored conversion state: %s", router->service->name(), filename);
|
||||
|
||||
int rc = ini_parse(filename, conv_state_handler, router);
|
||||
|
||||
|
@ -358,13 +358,13 @@ bool avro_handle_convert(const MODULECMD_ARG* args, json_t** output)
|
||||
if (strcmp(args->argv[1].value.string, "start") == 0
|
||||
&& conversion_task_ctl((Avro*)args->argv[0].value.service->router_instance, true))
|
||||
{
|
||||
MXS_NOTICE("Started conversion for service '%s'.", args->argv[0].value.service->name);
|
||||
MXS_NOTICE("Started conversion for service '%s'.", args->argv[0].value.service->name());
|
||||
rval = true;
|
||||
}
|
||||
else if (strcmp(args->argv[1].value.string, "stop") == 0
|
||||
&& conversion_task_ctl((Avro*)args->argv[0].value.service->router_instance, false))
|
||||
{
|
||||
MXS_NOTICE("Stopped conversion for service '%s'.", args->argv[0].value.service->name);
|
||||
MXS_NOTICE("Stopped conversion for service '%s'.", args->argv[0].value.service->name());
|
||||
rval = true;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
{
|
||||
MXS_ERROR("%s: Error: Service is missing user credentials."
|
||||
" Add the missing username or passwd parameter to the service.",
|
||||
service->name);
|
||||
service->name());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -278,7 +278,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
MXS_WARNING("%s: backend database server is provided by master.ini file "
|
||||
"for use with the binlog router."
|
||||
" Server section is no longer required.",
|
||||
service->name);
|
||||
service->name());
|
||||
|
||||
MXS_FREE(service->dbref);
|
||||
service->dbref = NULL;
|
||||
@ -468,7 +468,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
{
|
||||
MXS_ERROR("Service %s, invalid server-id '%s'. "
|
||||
"Please configure it with a unique positive integer value (1..2^32-1)",
|
||||
service->name,
|
||||
service->name(),
|
||||
v.c_str());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
@ -563,7 +563,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
{
|
||||
MXS_ERROR("Service %s, invalid encryption_algorithm '%s'. "
|
||||
"Supported algorithms: %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
v.c_str(),
|
||||
blr_encryption_algorithm_list());
|
||||
free_instance(inst);
|
||||
@ -648,7 +648,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
{
|
||||
MXS_ERROR("%s: invalid Master ssl_cert_verification_depth %s."
|
||||
" Setting it to default value %i.",
|
||||
service->name,
|
||||
service->name(),
|
||||
v.c_str(),
|
||||
inst->ssl_cert_verification_depth);
|
||||
free_instance(inst);
|
||||
@ -658,7 +658,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
else
|
||||
{
|
||||
MXS_WARNING("%s: unsupported router option %s for binlog router.",
|
||||
service->name,
|
||||
service->name(),
|
||||
k.c_str());
|
||||
}
|
||||
}
|
||||
@ -677,7 +677,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (inst->heartbeat < 0)
|
||||
{
|
||||
MXS_ERROR("%s: invalid 'heartbeat' value.",
|
||||
service->name);
|
||||
service->name());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -690,7 +690,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (inst->retry_interval <= 0)
|
||||
{
|
||||
MXS_ERROR("%s: invalid 'connect_retry' value.",
|
||||
service->name);
|
||||
service->name());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -698,7 +698,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (inst->retry_limit <= 0)
|
||||
{
|
||||
MXS_ERROR("%s: invalid 'master_retry_count' value.",
|
||||
service->name);
|
||||
service->name());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -709,7 +709,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
&& !strlen(inst->binlogdir)))
|
||||
{
|
||||
MXS_ERROR("Service %s, binlog directory is not specified",
|
||||
service->name);
|
||||
service->name());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -719,7 +719,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
MXS_ERROR("Service %s, server_id is not configured. "
|
||||
"Please configure it with a unique positive "
|
||||
"integer value (1..2^32-1)",
|
||||
service->name);
|
||||
service->name());
|
||||
free_instance(inst);
|
||||
return NULL;
|
||||
}
|
||||
@ -742,7 +742,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (mkdir_rval == -1)
|
||||
{
|
||||
MXS_ERROR("Service %s, Failed to create binlog directory '%s': [%d] %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
inst->binlogdir,
|
||||
errno,
|
||||
mxs_strerror(errno));
|
||||
@ -778,7 +778,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
|
||||
/* Log binlog structure storage mode */
|
||||
MXS_NOTICE("%s: storing binlog files in %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
inst->storage_type == BLR_BINLOG_STORAGE_FLAT ?
|
||||
"'flat' mode" :
|
||||
"'tree' mode using GTID domain_id and server_id");
|
||||
@ -813,7 +813,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (server == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Error for server_alloc in createInstance",
|
||||
inst->service->name);
|
||||
inst->service->name());
|
||||
|
||||
sqlite3_close_v2(inst->gtid_maps);
|
||||
free_instance(inst);
|
||||
@ -826,7 +826,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
static_cast<SSL_LISTENER*>(MXS_CALLOC(1, sizeof(SSL_LISTENER)))) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Error allocating memory for SSL struct in createInstance",
|
||||
inst->service->name);
|
||||
inst->service->name());
|
||||
|
||||
MXS_FREE(service->dbref);
|
||||
sqlite3_close_v2(inst->gtid_maps);
|
||||
@ -875,7 +875,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
MXS_WARNING("%s: master.ini file not found in %s."
|
||||
" Master registration cannot be started."
|
||||
" Configure with CHANGE MASTER TO ...",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
inst->binlogdir);
|
||||
}
|
||||
else
|
||||
@ -883,7 +883,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
MXS_ERROR("%s: master.ini file with errors in %s."
|
||||
" Master registration cannot be started."
|
||||
" Fix errors in it or configure with CHANGE MASTER TO ...",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
inst->binlogdir);
|
||||
}
|
||||
}
|
||||
@ -908,11 +908,11 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
|
||||
if (inst->ssl_enabled)
|
||||
{
|
||||
MXS_INFO("%s: Replicating from master with SSL", service->name);
|
||||
MXS_INFO("%s: Replicating from master with SSL", service->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_DEBUG("%s: Replicating from master without SSL", service->name);
|
||||
MXS_DEBUG("%s: Replicating from master without SSL", service->name());
|
||||
/* Free the SSL struct because is not needed if MASTER_SSL = 0
|
||||
* Provided options, if any, are kept in inst->ssl_* vars
|
||||
* SHOW SLAVE STATUS can display those values
|
||||
@ -949,7 +949,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
if (blr_file_init(inst) == 0)
|
||||
{
|
||||
MXS_ERROR("%s: Service not started due to lack of binlog directory %s",
|
||||
service->name,
|
||||
service->name(),
|
||||
inst->binlogdir);
|
||||
|
||||
if (service->dbref && service->dbref->server)
|
||||
@ -984,14 +984,14 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
/*
|
||||
* Add tasks for statistic computation
|
||||
*/
|
||||
snprintf(task_name, BLRM_TASK_NAME_LEN, "%s stats", service->name);
|
||||
snprintf(task_name, BLRM_TASK_NAME_LEN, "%s stats", service->name());
|
||||
hktask_add(task_name, stats_func, inst, BLR_STATS_FREQ);
|
||||
|
||||
/* Log whether the transaction safety option value is on */
|
||||
if (inst->trx_safe)
|
||||
{
|
||||
MXS_NOTICE("%s: Service has transaction safety option set to ON",
|
||||
service->name);
|
||||
service->name());
|
||||
}
|
||||
|
||||
/* Log whether the binlog encryption option value is on */
|
||||
@ -999,7 +999,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
{
|
||||
MXS_NOTICE("%s: Service has binlog encryption set to ON, algorithm: %s,"
|
||||
" KEY len %lu bits",
|
||||
service->name,
|
||||
service->name(),
|
||||
blr_get_encryption_algorithm(inst->encryption.encryption_algorithm),
|
||||
8 * inst->encryption.key_len);
|
||||
}
|
||||
@ -1086,7 +1086,7 @@ static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params
|
||||
" and START SLAVE."
|
||||
" Existing binlogs might be overwritten.");
|
||||
MXS_ERROR("%s: %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
inst->m_errmsg);
|
||||
|
||||
return (MXS_ROUTER*)inst;
|
||||
@ -1306,7 +1306,7 @@ static void closeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_sessio
|
||||
*/
|
||||
MXS_NOTICE("%s: Master %s disconnected after %ld seconds. "
|
||||
"%lu events read,",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
time(0) - router->connect_time,
|
||||
router->stats.n_binlogs_ses);
|
||||
@ -1329,7 +1329,7 @@ static void closeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_sessio
|
||||
MXS_NOTICE("%s: Slave [%s]:%d, server id %d, disconnected after %ld seconds. "
|
||||
"%d SQL commands, %d events sent (%lu bytes), binlog '%s', "
|
||||
"last position %lu",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -1344,7 +1344,7 @@ static void closeSession(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_sessio
|
||||
{
|
||||
MXS_NOTICE("%s: Slave %s, server id %d, disconnected after %ld seconds. "
|
||||
"%d SQL commands",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
slave->serverid,
|
||||
time(0) - slave->connect_time,
|
||||
@ -2416,7 +2416,7 @@ static void errorReply(MXS_ROUTER* instance,
|
||||
|
||||
MXS_ERROR("%s: Master connection error %lu '%s' in state '%s', "
|
||||
"%s while connecting to master [%s]:%d. Replication is stopped.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->m_errno,
|
||||
router->m_errmsg,
|
||||
blrm_states[BLRM_TIMESTAMP],
|
||||
@ -2463,7 +2463,7 @@ static void errorReply(MXS_ROUTER* instance,
|
||||
|
||||
MXS_ERROR("%s: Master connection error %lu '%s' in state '%s', "
|
||||
"%sattempting reconnect to master [%s]:%d",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
mysql_errno,
|
||||
errmsg,
|
||||
blrm_states[router->master_state],
|
||||
@ -2476,7 +2476,7 @@ static void errorReply(MXS_ROUTER* instance,
|
||||
/* Stopped state, no reconnection */
|
||||
MXS_INFO("%s: Master connection has been closed. State is '%s', "
|
||||
"%snot retrying a new connection to master [%s]:%d",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
blrm_states[router->master_state],
|
||||
msg,
|
||||
router->service->dbref->server->address,
|
||||
@ -2505,7 +2505,7 @@ static void errorReply(MXS_ROUTER* instance,
|
||||
|
||||
MXS_NOTICE("%s: Master %s disconnected after %ld seconds. "
|
||||
"%lu events read.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
time(0) - router->connect_time,
|
||||
router->stats.n_binlogs_ses);
|
||||
@ -2964,8 +2964,8 @@ static void destroyInstance(MXS_ROUTER* instance)
|
||||
ROUTER_INSTANCE* inst = (ROUTER_INSTANCE*) instance;
|
||||
|
||||
MXS_DEBUG("Destroying instance of router %s for service %s",
|
||||
inst->service->routerModule,
|
||||
inst->service->name);
|
||||
inst->service->router_name(),
|
||||
inst->service->name());
|
||||
|
||||
/* Check whether master connection is active */
|
||||
if (inst->master)
|
||||
@ -2996,7 +2996,7 @@ static void destroyInstance(MXS_ROUTER* instance)
|
||||
|
||||
MXS_INFO("%s is being stopped by MaxScale shudown. Disconnecting from master [%s]:%d, "
|
||||
"read up to log %s, pos %lu, transaction safe pos %lu",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
inst->service->dbref->server->address,
|
||||
inst->service->dbref->server->port,
|
||||
inst->binlog_name,
|
||||
@ -3008,7 +3008,7 @@ static void destroyInstance(MXS_ROUTER* instance)
|
||||
{
|
||||
MXS_WARNING("%s stopped by shutdown: detected mid-transaction in binlog file %s, "
|
||||
"pos %lu, incomplete transaction starts at pos %lu",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
inst->binlog_name,
|
||||
inst->current_pos,
|
||||
inst->binlog_position);
|
||||
@ -3123,7 +3123,7 @@ bool blr_get_encryption_key(ROUTER_INSTANCE* router)
|
||||
{
|
||||
MXS_ERROR("Service %s, encryption key is not set. "
|
||||
"Please specify key filename with 'encryption_key_file'",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -3257,7 +3257,7 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
if (rc != SQLITE_OK)
|
||||
{
|
||||
MXS_ERROR("Service %s, failed to create GTID index table 'gtid_maps': %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
sqlite3_errmsg(inst->gtid_maps));
|
||||
sqlite3_free(errmsg);
|
||||
/* Close GTID maps database */
|
||||
@ -3288,7 +3288,7 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
{
|
||||
// Otherwise we bail out.
|
||||
MXS_ERROR("Service %s, failed to alter GTID index table 'gtid_map': %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
s.c_str());
|
||||
sqlite3_close_v2(inst->gtid_maps);
|
||||
return false;
|
||||
@ -3296,7 +3296,7 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
}
|
||||
|
||||
MXS_NOTICE("%s: Service has MariaDB GTID otion set to ON",
|
||||
inst->service->name);
|
||||
inst->service->name());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -3304,7 +3304,7 @@ static bool blr_open_gtid_maps_storage(ROUTER_INSTANCE* inst)
|
||||
void blr_log_disabled_heartbeat(const ROUTER_INSTANCE* inst)
|
||||
{
|
||||
MXS_WARNING("%s: %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
"MASTER_HEARTBEAT_PERIOD has been set to 0 (disabled): "
|
||||
"a master network inactivity will not be handled.");
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ bool blr_handle_one_event(MXS_ROUTER* instance, REP_HEADER& hdr, uint8_t* ptr, u
|
||||
MXS_DEBUG("%s: binlog record in file %s, pos %lu has "
|
||||
"SEMI_SYNC_ACK_REQ and needs a Semi-Sync ACK packet to "
|
||||
"be sent to the master server [%s]:%d",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name,
|
||||
router->current_pos,
|
||||
router->service->dbref->server->address,
|
||||
|
@ -260,18 +260,18 @@ int blr_file_init(ROUTER_INSTANCE* router)
|
||||
if (router->binlogdir == NULL)
|
||||
{
|
||||
const char* datadir = get_datadir();
|
||||
size_t len = strlen(datadir) + sizeof('/') + strlen(router->service->name);
|
||||
size_t len = strlen(datadir) + sizeof('/') + strlen(router->service->name());
|
||||
|
||||
if (len > PATH_MAX)
|
||||
{
|
||||
MXS_ERROR("The length of %s/%s is more than the maximum length %d.",
|
||||
datadir,
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
PATH_MAX);
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(path, sizeof(path), "%s/%s", datadir, router->service->name);
|
||||
snprintf(path, sizeof(path), "%s/%s", datadir, router->service->name());
|
||||
|
||||
if (access(path, R_OK) == -1)
|
||||
{
|
||||
@ -290,7 +290,7 @@ int blr_file_init(ROUTER_INSTANCE* router)
|
||||
if (access(path, R_OK) == -1)
|
||||
{
|
||||
MXS_ERROR("%s: Unable to read the binlog directory %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlogdir);
|
||||
return 0;
|
||||
}
|
||||
@ -308,7 +308,7 @@ int blr_file_init(ROUTER_INSTANCE* router)
|
||||
if ((dirp = opendir(path)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Unable to read the binlog directory %s, %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlogdir,
|
||||
mxs_strerror(errno));
|
||||
return 0;
|
||||
@ -384,7 +384,7 @@ int blr_file_init(ROUTER_INSTANCE* router)
|
||||
|| !last_gtid.gtid[0])
|
||||
{
|
||||
MXS_INFO("%s: cannot find any GTID in GTID maps repo",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -507,7 +507,7 @@ static int blr_file_create(ROUTER_INSTANCE* router, char* orig_file)
|
||||
{
|
||||
MXS_ERROR("Service %s, Failed to create binlog"
|
||||
" directory tree '%s': [%d] %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
path,
|
||||
errno,
|
||||
mxs_strerror(errno));
|
||||
@ -558,7 +558,7 @@ static int blr_file_create(ROUTER_INSTANCE* router, char* orig_file)
|
||||
{
|
||||
MXS_ERROR("%s: Failed to write magic string to "
|
||||
"created binlog file %s, %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
path,
|
||||
mxs_strerror(errno));
|
||||
close(fd);
|
||||
@ -566,7 +566,7 @@ static int blr_file_create(ROUTER_INSTANCE* router, char* orig_file)
|
||||
if (!unlink(path))
|
||||
{
|
||||
MXS_ERROR("%s: Failed to delete file %s, %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
path,
|
||||
mxs_strerror(errno));
|
||||
}
|
||||
@ -575,7 +575,7 @@ static int blr_file_create(ROUTER_INSTANCE* router, char* orig_file)
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Failed to create binlog file %s, %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
path,
|
||||
mxs_strerror(errno));
|
||||
}
|
||||
@ -645,7 +645,7 @@ void blr_file_append(ROUTER_INSTANCE* router, char* file)
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Could not write magic to binlog file.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -653,7 +653,7 @@ void blr_file_append(ROUTER_INSTANCE* router, char* file)
|
||||
/* If for any reason the file's length is between 1 and 3 bytes
|
||||
* then report an error. */
|
||||
MXS_ERROR("%s: binlog file %s has an invalid length %lu.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
path,
|
||||
router->current_pos);
|
||||
close(fd);
|
||||
@ -746,7 +746,7 @@ int blr_write_binlog_record(ROUTER_INSTANCE* router,
|
||||
{
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_position,
|
||||
router->binlog_name,
|
||||
mxs_strerror(errno));
|
||||
@ -754,7 +754,7 @@ int blr_write_binlog_record(ROUTER_INSTANCE* router,
|
||||
if (ftruncate(router->binlog_fd, router->binlog_position))
|
||||
{
|
||||
MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_position,
|
||||
router->binlog_name,
|
||||
mxs_strerror(errno));
|
||||
@ -3180,7 +3180,7 @@ int blr_handle_config_item(const char* name,
|
||||
{
|
||||
MXS_WARNING("Found invalid 'master_heartbeat_period' value"
|
||||
" for service '%s': %s, ignoring it.",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
value);
|
||||
heartbeat_period = -1;
|
||||
}
|
||||
@ -3194,7 +3194,7 @@ int blr_handle_config_item(const char* name,
|
||||
{
|
||||
MXS_WARNING("Found invalid 'master_connect_retry' value"
|
||||
" for service '%s': %s, ignoring it.",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
value);
|
||||
connect_retry = -1;
|
||||
}
|
||||
@ -3324,7 +3324,7 @@ int blr_handler_config(void* userdata, const char* section, const char* name, co
|
||||
section,
|
||||
SECTION_NAME,
|
||||
SECTION_NAME,
|
||||
inst->service->name);
|
||||
inst->service->name());
|
||||
rc = 0;
|
||||
}
|
||||
|
||||
@ -3347,7 +3347,7 @@ int blr_file_read_master_config(ROUTER_INSTANCE* router)
|
||||
blr_master_set_config(router, router->configs[0]);
|
||||
}
|
||||
|
||||
MXS_INFO("%s: %s parse result is %d", router->service->name, filename, rc);
|
||||
MXS_INFO("%s: %s parse result is %d", router->service->name(), filename, rc);
|
||||
|
||||
return rc;
|
||||
}
|
||||
@ -3726,7 +3726,7 @@ int blr_write_special_event(ROUTER_INSTANCE* router,
|
||||
{
|
||||
MXS_ERROR("%s: Failed to write %s special binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
new_event_desc,
|
||||
(unsigned long)file_offset,
|
||||
router->binlog_name,
|
||||
@ -3736,7 +3736,7 @@ int blr_write_special_event(ROUTER_INSTANCE* router,
|
||||
if (ftruncate(router->binlog_fd, router->binlog_position))
|
||||
{
|
||||
MXS_ERROR("%s: Failed to truncate %s special binlog record at %lu of %s, %s. ",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
new_event_desc,
|
||||
(unsigned long)file_offset,
|
||||
router->binlog_name,
|
||||
@ -4386,7 +4386,7 @@ bool blr_save_mariadb_gtid(ROUTER_INSTANCE* inst)
|
||||
{
|
||||
MXS_ERROR("Service %s: failed to update GTID %s for %s:%lu,%lu "
|
||||
"into gtid_maps database: %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
gtid_info.gtid,
|
||||
gtid_info.binlog_name,
|
||||
gtid_info.start,
|
||||
@ -4402,7 +4402,7 @@ bool blr_save_mariadb_gtid(ROUTER_INSTANCE* inst)
|
||||
{
|
||||
MXS_ERROR("Service %s: failed to insert GTID %s for %s:%lu,%lu "
|
||||
"into gtid_maps database: %s",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
gtid_info.gtid,
|
||||
gtid_info.binlog_name,
|
||||
gtid_info.start,
|
||||
@ -4878,7 +4878,7 @@ bool blr_binlog_file_exists(ROUTER_INSTANCE* router,
|
||||
{
|
||||
// No file found
|
||||
MXS_WARNING("%s: %s, missing binlog file '%s'",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
info_file == NULL ?
|
||||
"ROTATE_EVENT" :
|
||||
"Slave request",
|
||||
|
@ -147,13 +147,13 @@ static void blr_start_master(void* data)
|
||||
&& router->master_state != BLRM_CONNECTING)
|
||||
{
|
||||
MXS_ERROR("%s: Master Connect: Unexpected master state [%s]\n",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
blrm_states[router->master_state]);
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_NOTICE("%s: Master Connect: binlog current state is [%s]\n",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
blrm_states[router->master_state]);
|
||||
}
|
||||
|
||||
@ -176,7 +176,7 @@ static void blr_start_master(void* data)
|
||||
MXS_ERROR("%s: failure while connecting to master server '%s', "
|
||||
"reached %d maximum number of retries. "
|
||||
"Replication is stopped.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->name(),
|
||||
router->retry_limit);
|
||||
return;
|
||||
@ -245,7 +245,7 @@ static void blr_start_master(void* data)
|
||||
|
||||
MXS_ERROR("%s: failure while connecting to master server '%s', "
|
||||
"retrying in %d seconds",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->name(),
|
||||
connect_retry);
|
||||
return;
|
||||
@ -254,7 +254,7 @@ static void blr_start_master(void* data)
|
||||
|
||||
MXS_NOTICE("%s: attempting to connect to master"
|
||||
" server [%s]:%d, binlog='%s', pos=%lu%s%s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
router->service->dbref->server->port,
|
||||
router->binlog_name,
|
||||
@ -384,7 +384,7 @@ static void blr_restart_master(ROUTER_INSTANCE* router)
|
||||
MXS_ERROR("%s: failed to connect to master server '%s', "
|
||||
"reached %d maximum number of retries. "
|
||||
"Replication is stopped.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->name(),
|
||||
router->retry_limit);
|
||||
return;
|
||||
@ -418,7 +418,7 @@ static void blr_restart_master(ROUTER_INSTANCE* router)
|
||||
|
||||
MXS_ERROR("%s: failed to connect to master server '%s', "
|
||||
"retrying in %d seconds",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->name(),
|
||||
connect_retry);
|
||||
}
|
||||
@ -528,7 +528,7 @@ void blr_master_response(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
pthread_mutex_unlock(&router->lock);
|
||||
atomic_add(&router->handling_threads, -1);
|
||||
MXS_ERROR("%s: Pending reconnect in state %s.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
blrm_states[router->master_state]);
|
||||
blr_restart_master(router);
|
||||
return;
|
||||
@ -548,7 +548,7 @@ void blr_master_response(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
* they also request the GTID mode.
|
||||
*/
|
||||
MXS_ERROR("%s: Master server does not support GTID Mode.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
}
|
||||
else if (router->master_state != BLRM_BINLOGDUMP && MYSQL_RESPONSE_ERR(buf))
|
||||
{
|
||||
@ -571,7 +571,7 @@ void blr_master_response(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
|
||||
MXS_ERROR("%s: Received error: %lu, '%s' from master during '%s' phase "
|
||||
"of the master state machine.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
mysql_errno,
|
||||
msg_err ? msg_err : "(memory failure)",
|
||||
blrm_states[router->master_state]);
|
||||
@ -803,7 +803,7 @@ static bool verify_checksum(ROUTER_INSTANCE* router, size_t len, uint8_t* ptr)
|
||||
rval = false;
|
||||
MXS_ERROR("%s: Checksum error in event from master, "
|
||||
"binlog %s @ %lu. Closing master connection.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name,
|
||||
router->current_pos);
|
||||
router->stats.n_badcrc++;
|
||||
@ -1468,7 +1468,7 @@ static bool blr_check_last_master_event(void* inst)
|
||||
snprintf(task_name,
|
||||
BLRM_TASK_NAME_LEN,
|
||||
"%s heartbeat",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
|
||||
rval = false;
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ static void blr_log_identity(ROUTER_INSTANCE* router)
|
||||
/* Seen by the master */
|
||||
MXS_NOTICE("%s: identity seen by the master: "
|
||||
"Server_id: %d, Slave_UUID: %s, Host: %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->serverid,
|
||||
router->uuid == NULL ?
|
||||
"not available" :
|
||||
@ -1579,7 +1579,7 @@ static void blr_log_identity(ROUTER_INSTANCE* router)
|
||||
{
|
||||
MXS_NOTICE("%s: identity seen by the slaves: "
|
||||
"server_id: %d, hostname: %s, MySQL version: %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->masterid,
|
||||
(master_hostname == NULL ? "not available" : master_hostname),
|
||||
(master_version == NULL ? "not available" : master_version));
|
||||
@ -1588,7 +1588,7 @@ static void blr_log_identity(ROUTER_INSTANCE* router)
|
||||
{
|
||||
MXS_NOTICE("%s: identity seen by the slaves: "
|
||||
"server_id: %d, uuid: %s, hostname: %s, MySQL version: %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->masterid,
|
||||
master_uuid,
|
||||
(master_hostname == NULL ? "not available" : master_hostname),
|
||||
@ -1621,7 +1621,7 @@ int blr_write_data_into_binlog(ROUTER_INSTANCE* router, uint32_t data_len, uint8
|
||||
{
|
||||
MXS_ERROR("%s: Failed to write binlog record at %lu of %s, %s. "
|
||||
"Truncating to previous record.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_position,
|
||||
router->binlog_name,
|
||||
mxs_strerror(errno));
|
||||
@ -1630,7 +1630,7 @@ int blr_write_data_into_binlog(ROUTER_INSTANCE* router, uint32_t data_len, uint8
|
||||
if (ftruncate(router->binlog_fd, router->binlog_position))
|
||||
{
|
||||
MXS_ERROR("%s: Failed to truncate binlog record at %lu of %s, %s. ",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->last_written,
|
||||
router->binlog_name,
|
||||
mxs_strerror(errno));
|
||||
@ -2348,7 +2348,7 @@ static void blr_register_mxw_tables(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
static void blr_register_getsemisync(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
{
|
||||
MXS_NOTICE("%s: checking Semi-Sync replication capability for master server [%s]:%d",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
router->service->dbref->server->port);
|
||||
|
||||
@ -2383,7 +2383,7 @@ static bool blr_register_setsemisync(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
{
|
||||
/* not installed */
|
||||
MXS_NOTICE("%s: master server [%s]:%d doesn't have semi_sync capability",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
router->service->dbref->server->port);
|
||||
|
||||
@ -2399,7 +2399,7 @@ static bool blr_register_setsemisync(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
/* Installed but not enabled, right now */
|
||||
MXS_NOTICE("%s: master server [%s]:%d doesn't have semi_sync"
|
||||
" enabled right now, Request Semi-Sync Replication anyway",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
router->service->dbref->server->port);
|
||||
}
|
||||
@ -2408,7 +2408,7 @@ static bool blr_register_setsemisync(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
/* Installed and enabled */
|
||||
MXS_NOTICE("%s: master server [%s]:%d has semi_sync enabled,"
|
||||
" Requesting Semi-Sync Replication",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address,
|
||||
router->service->dbref->server->port);
|
||||
}
|
||||
@ -2822,7 +2822,7 @@ static void blr_start_master_registration(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
{
|
||||
MXS_NOTICE("%s: Request binlog records from %s at "
|
||||
"position %lu from master server [%s]:%d",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name,
|
||||
router->current_pos,
|
||||
router->service->dbref->server->address,
|
||||
@ -2848,7 +2848,7 @@ static void blr_start_master_registration(ROUTER_INSTANCE* router, GWBUF* buf)
|
||||
snprintf(task_name,
|
||||
BLRM_TASK_NAME_LEN,
|
||||
"%s heartbeat",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
hktask_add(task_name,
|
||||
blr_check_last_master_event,
|
||||
router,
|
||||
@ -2883,7 +2883,7 @@ static void blr_register_mariadb_gtid_request(ROUTER_INSTANCE* router,
|
||||
router->last_mariadb_gtid);
|
||||
|
||||
MXS_INFO("%s: Requesting GTID (%s) from master server.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->last_mariadb_gtid);
|
||||
// Send the request
|
||||
blr_register_send_command(router,
|
||||
@ -3258,7 +3258,7 @@ void blr_master_set_config(ROUTER_INSTANCE* inst, const ChangeMasterConfig& conf
|
||||
{
|
||||
MXS_ERROR("Found unknown optional parameter value for 'ssl_version' for"
|
||||
" service '%s': %s, ignoring it.",
|
||||
inst->service->name,
|
||||
inst->service->name(),
|
||||
config.ssl_version.c_str());
|
||||
}
|
||||
else
|
||||
|
@ -431,7 +431,7 @@ int blr_slave_request(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, GWBUF* queue
|
||||
snprintf(task_name,
|
||||
BLRM_TASK_NAME_LEN,
|
||||
"%s slaves heartbeat send",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
|
||||
/* Add slave heartbeat check task with 1 second frequency */
|
||||
hktask_add(task_name, blr_send_slave_heartbeat, router, 1);
|
||||
@ -641,14 +641,14 @@ static int blr_slave_query(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, GWBUF*
|
||||
} /* - 2 - Handle SELECT, SET, SHOW and Admin commands */
|
||||
else if ((word = strtok_r(query_text, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete query.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete query.", router->service->name());
|
||||
}
|
||||
else if (strcasecmp(word, "SELECT") == 0)
|
||||
{
|
||||
/* Handle SELECT */
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete select query.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete select query.", router->service->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2044,7 +2044,7 @@ static int blr_slave_binlog_dump(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, G
|
||||
MXS_ERROR("%s: Slave %s:%i, server-id %d, binlog '%s', blr_slave_binlog_dump failure: "
|
||||
"Requested binlog position %lu. Position is unsafe so disconnecting. "
|
||||
"Latest safe position %lu, end of binlog file %lu",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -2067,7 +2067,7 @@ static int blr_slave_binlog_dump(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, G
|
||||
|
||||
MXS_DEBUG("%s: Slave %s:%i, COM_BINLOG_DUMP: binlog name '%s', length %lu, "
|
||||
"from position %lu.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->binlog_name,
|
||||
@ -2224,7 +2224,7 @@ static int blr_slave_binlog_dump(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, G
|
||||
slave->state = BLRS_DUMPING;
|
||||
|
||||
MXS_NOTICE("%s: Slave [%s]:%d, server id %d requested binlog file %s from position %lu",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -2717,7 +2717,7 @@ int blr_slave_catchup(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, bool large)
|
||||
if (hdr.ok == SLAVE_POS_BAD_FD)
|
||||
{
|
||||
MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s%s', %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -2729,7 +2729,7 @@ int blr_slave_catchup(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, bool large)
|
||||
if (hdr.ok == SLAVE_POS_BEYOND_EOF)
|
||||
{
|
||||
MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s%s', %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -2752,7 +2752,7 @@ int blr_slave_catchup(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, bool large)
|
||||
if (hdr.ok == SLAVE_POS_READ_ERR)
|
||||
{
|
||||
MXS_ERROR("%s Slave %s:%i, server-id %d, binlog '%s%s', %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -2788,7 +2788,7 @@ int blr_slave_catchup(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave, bool large)
|
||||
|
||||
MXS_NOTICE("%s: Slave %s:%i, server-id %d, binlog '%s%s', read %d events, "
|
||||
"current committed transaction event being sent: %lu, %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -3603,7 +3603,7 @@ static int blr_slave_disconnect_server(ROUTER_INSTANCE* router,
|
||||
/* server_id found */
|
||||
server_found = 1;
|
||||
MXS_NOTICE("%s: Slave %s, server id %d, disconnected by %s@%s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
sptr->dcb->remote,
|
||||
server_id,
|
||||
slave->dcb->user,
|
||||
@ -3717,7 +3717,7 @@ static int blr_slave_disconnect_all(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave
|
||||
}
|
||||
|
||||
MXS_NOTICE("%s: Slave %s, server id %d, disconnected by %s@%s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
sptr->dcb->remote,
|
||||
sptr->serverid,
|
||||
slave->dcb->user,
|
||||
@ -3906,7 +3906,7 @@ static int blr_stop_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
|
||||
MXS_NOTICE("%s: STOP SLAVE executed by %s@%s. Disconnecting from master [%s]:%d, "
|
||||
"read up to log %s, pos %lu, transaction safe pos %lu",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->user,
|
||||
slave->dcb->remote,
|
||||
router->service->dbref->server->address,
|
||||
@ -4100,7 +4100,7 @@ static int blr_start_slave(ROUTER_INSTANCE* router, ROUTER_SLAVE* slave)
|
||||
|
||||
MXS_NOTICE("%s: START SLAVE executed by %s@%s. Trying connection to master [%s]:%d, "
|
||||
"binlog %s, pos %lu, transaction safe pos %lu",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->user,
|
||||
slave->dcb->remote,
|
||||
router->service->dbref->server->address,
|
||||
@ -4190,7 +4190,7 @@ bool ChangeMasterOptions::validate(ROUTER_INSTANCE* router,
|
||||
"Cannot use MASTER_USE_GTID. "
|
||||
"Enable 'mariadb10_master_gtid' option first.");
|
||||
|
||||
MXS_ERROR("%s: %s", router->service->name, error);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -4211,7 +4211,7 @@ bool ChangeMasterOptions::validate(ROUTER_INSTANCE* router,
|
||||
"(%d seconds).",
|
||||
BLR_HEARTBEAT_MAX_INTERVAL);
|
||||
|
||||
MXS_ERROR("%s: %s", router->service->name, error);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -4230,7 +4230,7 @@ bool ChangeMasterOptions::validate(ROUTER_INSTANCE* router,
|
||||
"interval is not valid: %s.",
|
||||
this->connect_retry.c_str());
|
||||
|
||||
MXS_ERROR("%s: %s", router->service->name, error);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -4248,7 +4248,7 @@ bool ChangeMasterOptions::validate(ROUTER_INSTANCE* router,
|
||||
"is not valid: %s.",
|
||||
this->port.c_str());
|
||||
|
||||
MXS_ERROR("%s: %s", router->service->name, error);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -4604,7 +4604,7 @@ int blr_handle_change_master(ROUTER_INSTANCE* router,
|
||||
&options) != 0)
|
||||
{
|
||||
MXS_ERROR("%s CHANGE MASTER TO parse error: %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
error);
|
||||
|
||||
return -1;
|
||||
@ -4658,7 +4658,7 @@ static int blr_set_master_hostname(ROUTER_INSTANCE* router, const char* hostname
|
||||
router->service->dbref->server->server_update_address(hostname);
|
||||
|
||||
MXS_INFO("%s: New MASTER_HOST is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->address);
|
||||
|
||||
return 1;
|
||||
@ -4687,7 +4687,7 @@ static int blr_set_master_port(ROUTER_INSTANCE* router, int port)
|
||||
router->service->dbref->server->update_port(port);
|
||||
|
||||
MXS_INFO("%s: New MASTER_PORT is [%i]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->service->dbref->server->port);
|
||||
|
||||
return 1;
|
||||
@ -4970,7 +4970,7 @@ static int blr_set_master_user(ROUTER_INSTANCE* router, const char* user)
|
||||
router->user = MXS_STRDUP_A(user);
|
||||
|
||||
MXS_INFO("%s: New MASTER_USER is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->user);
|
||||
|
||||
return 1;
|
||||
@ -5711,7 +5711,7 @@ static int blr_slave_handle_variables(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Missing LIKE clause in SHOW [GLOBAL] VARIABLES.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return -1;
|
||||
}
|
||||
else if (strcasecmp(word, "'SERVER_ID'") == 0)
|
||||
@ -5947,7 +5947,7 @@ static int blr_slave_handle_status_variables(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Missing LIKE clause in SHOW [GLOBAL] STATUS.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return -1;
|
||||
}
|
||||
else if (strcasecmp(word, "'Uptime'") == 0)
|
||||
@ -6599,7 +6599,7 @@ static bool blr_handle_simple_select_stmt(ROUTER_INSTANCE* router,
|
||||
|
||||
if ((word = strtok_r(select_stmt, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete select query.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete select query.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "UNIX_TIMESTAMP()") == 0)
|
||||
@ -7519,7 +7519,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
const char* sep = " \t,=";
|
||||
if ((word = strtok_r(show_stmt, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete show query.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete show query.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "WARNINGS") == 0)
|
||||
@ -7540,7 +7540,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
" 'mariadb10_slave_gtid' option to be set.";
|
||||
MXS_ERROR("%s: %s",
|
||||
errmsg,
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
|
||||
blr_slave_send_error_packet(slave,
|
||||
errmsg,
|
||||
@ -7560,7 +7560,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Expected VARIABLES in SHOW GLOBAL",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "VARIABLES") == 0)
|
||||
@ -7580,7 +7580,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Expected LIKE clause in SHOW GLOBAL VARIABLES.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7601,7 +7601,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Expected LIKE clause in SHOW GLOBAL STATUS.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7630,7 +7630,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Expected LIKE clause in SHOW VARIABLES.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7639,7 +7639,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Expected SHOW MASTER STATUS command",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "STATUS") == 0)
|
||||
@ -7664,7 +7664,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Expected SHOW SLAVE STATUS command",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "STATUS") == 0
|
||||
@ -7714,7 +7714,7 @@ static bool blr_handle_show_stmt(ROUTER_INSTANCE* router,
|
||||
else
|
||||
{
|
||||
MXS_ERROR("%s: Expected LIKE clause in SHOW STATUS.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -7743,7 +7743,7 @@ static bool blr_handle_set_stmt(ROUTER_INSTANCE* router,
|
||||
|
||||
if ((word = strtok_r(set_stmt, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete set command.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete set command.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if ((strcasecmp(word, "autocommit") == 0)
|
||||
@ -7991,7 +7991,7 @@ static bool blr_handle_set_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Truncated SET NAMES command.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "latin1") == 0)
|
||||
@ -8042,7 +8042,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
|
||||
if (admin_opts == NULL || !admin_opts[0])
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete admin command.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete admin command.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
/* Handle PURGE command */
|
||||
@ -8071,7 +8071,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
"'mariadb10_slave_gtid' option to be set.";
|
||||
MXS_ERROR("%s: %s",
|
||||
errmsg,
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
|
||||
blr_slave_send_error_packet(slave,
|
||||
errmsg,
|
||||
@ -8085,7 +8085,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
{
|
||||
if ((word = strtok_r(admin_opts, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete RESET command.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete RESET command.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
/* RESET the current configured master cfg */
|
||||
@ -8103,7 +8103,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
MXS_NOTICE("%s: 'RESET SLAVE executed'. Previous state MASTER_HOST='%s', "
|
||||
"MASTER_PORT=%i, MASTER_LOG_FILE='%s', MASTER_LOG_POS=%lu, "
|
||||
"MASTER_USER='%s'",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
current_master.host.c_str(),
|
||||
current_master.port,
|
||||
current_master.logfile.c_str(),
|
||||
@ -8128,7 +8128,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
path,
|
||||
mxs_strerror(errno),
|
||||
errno);
|
||||
MXS_ERROR("%s: %s", router->service->name, error_string);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error_string);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&router->lock);
|
||||
@ -8181,7 +8181,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(admin_opts, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete START command.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "SLAVE") == 0)
|
||||
@ -8195,7 +8195,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
{
|
||||
if ((word = strtok_r(admin_opts, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete STOP command.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete STOP command.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "SLAVE") == 0)
|
||||
@ -8209,7 +8209,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
{
|
||||
if ((word = strtok_r(admin_opts, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete CHANGE command.", router->service->name);
|
||||
MXS_ERROR("%s: Incomplete CHANGE command.", router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "MASTER") == 0)
|
||||
@ -8269,7 +8269,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
router->binlogdir,
|
||||
error);
|
||||
MXS_ERROR("%s: %s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
error_string);
|
||||
|
||||
blr_slave_send_error_packet(slave,
|
||||
@ -8313,7 +8313,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
&& blr_file_new_binlog(router, router->binlog_name))
|
||||
{
|
||||
MXS_INFO("%s: 'master.ini' created, binlog file '%s' created",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name);
|
||||
}
|
||||
blr_slave_send_ok(router, slave);
|
||||
@ -8353,7 +8353,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
{
|
||||
MXS_INFO("%s: created new binlog file '%s' by "
|
||||
"'CHANGE MASTER TO' command",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name);
|
||||
}
|
||||
}
|
||||
@ -8369,7 +8369,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(admin_opts, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Incomplete DISCONNECT command.",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else if (strcasecmp(word, "ALL") == 0)
|
||||
@ -8382,7 +8382,7 @@ static bool blr_handle_admin_stmt(ROUTER_INSTANCE* router,
|
||||
if ((word = strtok_r(NULL, sep, &brkb)) == NULL)
|
||||
{
|
||||
MXS_ERROR("%s: Expected DISCONNECT SERVER $server_id",
|
||||
router->service->name);
|
||||
router->service->name());
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@ -9247,7 +9247,7 @@ static void blr_log_config_changes(ROUTER_INSTANCE* router,
|
||||
"MASTER_LOG_FILE='%s', MASTER_LOG_POS=%lu, "
|
||||
"MASTER_USER='%s'"
|
||||
"%s%s%s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
current_master.host.c_str(),
|
||||
current_master.port,
|
||||
current_master.logfile.c_str(),
|
||||
@ -9331,7 +9331,7 @@ static bool blr_check_connecting_slave(const ROUTER_INSTANCE* router,
|
||||
|
||||
default:
|
||||
MXS_WARNING("%s: Slave %s: Unkwon status check %d.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
check);
|
||||
break;
|
||||
@ -9352,7 +9352,7 @@ static bool blr_check_connecting_slave(const ROUTER_INSTANCE* router,
|
||||
err_status,
|
||||
err_code);
|
||||
MXS_ERROR("%s: Slave %s: %s%s",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
err_msg,
|
||||
msg_detail);
|
||||
@ -9373,7 +9373,7 @@ static void blr_abort_change_master(ROUTER_INSTANCE* router,
|
||||
const MasterServerConfig& current_master,
|
||||
const char* error)
|
||||
{
|
||||
MXS_ERROR("%s: %s", router->service->name, error);
|
||||
MXS_ERROR("%s: %s", router->service->name(), error);
|
||||
/* restore previous master_host and master_port */
|
||||
blr_master_restore_config(router, current_master);
|
||||
}
|
||||
@ -9589,13 +9589,13 @@ static bool blr_apply_changes(ROUTER_INSTANCE* router,
|
||||
{
|
||||
/* MASTER_USE_GTID=Slave_pos is set */
|
||||
MXS_INFO("%s: MASTER_USE_GTID is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
change_master.use_mariadb10_gtid.c_str());
|
||||
}
|
||||
|
||||
/* Always log the current GTID value with CHANGE_MASTER TO */
|
||||
MXS_INFO("%s: CHANGE MASTER TO, current GTID value is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->last_mariadb_gtid);
|
||||
|
||||
/* Always set empty filename at pos 4 with CHANGE_MASTER TO */
|
||||
@ -9662,7 +9662,7 @@ static bool blr_apply_changes(ROUTER_INSTANCE* router,
|
||||
router->binlog_fd = -1;
|
||||
|
||||
MXS_INFO("%s: New MASTER_LOG_FILE is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name);
|
||||
}
|
||||
}
|
||||
@ -9701,7 +9701,7 @@ static bool blr_apply_changes(ROUTER_INSTANCE* router,
|
||||
strcpy(router->binlog_name, new_logfile);
|
||||
|
||||
MXS_INFO("%s: New MASTER_LOG_FILE is [%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->binlog_name);
|
||||
}
|
||||
}
|
||||
@ -9727,7 +9727,7 @@ static bool blr_apply_changes(ROUTER_INSTANCE* router,
|
||||
if (ret)
|
||||
{
|
||||
MXS_INFO("%s: New MASTER_LOG_POS is [%lu]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
router->current_pos);
|
||||
}
|
||||
}
|
||||
@ -9804,7 +9804,7 @@ static void blr_slave_log_next_file_action(const ROUTER_INSTANCE* router,
|
||||
"This may be caused by a previous failure of the master. "
|
||||
"Current master binlog is [%s%s] at %lu, replication state is [%s]. "
|
||||
"Now rotating to new file [%s%s]",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -9824,7 +9824,7 @@ static void blr_slave_log_next_file_action(const ROUTER_INSTANCE* router,
|
||||
MXS_ERROR("%s: Slave [%s]:%d, server-id %d reached "
|
||||
"end of file for '%s%s' and next file to read%s%s%s%s "
|
||||
"is not %s. Force replication abort after %d retries.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
@ -9849,7 +9849,7 @@ static void blr_slave_log_next_file_action(const ROUTER_INSTANCE* router,
|
||||
"the master server. Current master binlog is "
|
||||
"[%s%s] at %lu and replication state is [%s]. "
|
||||
"The slave server is now in '%s' state.",
|
||||
router->service->name,
|
||||
router->service->name(),
|
||||
slave->dcb->remote,
|
||||
dcb_get_port(slave->dcb),
|
||||
slave->serverid,
|
||||
|
@ -2571,11 +2571,11 @@ static void reload_dbusers(DCB* dcb, SERVICE* service)
|
||||
{
|
||||
if (service_refresh_users(service) == 0)
|
||||
{
|
||||
dcb_printf(dcb, "Reloaded database users for service %s.\n", service->name);
|
||||
dcb_printf(dcb, "Reloaded database users for service %s.\n", service->name());
|
||||
}
|
||||
else
|
||||
{
|
||||
dcb_printf(dcb, "Error: Failed to reloaded database users for service %s.\n", service->name);
|
||||
dcb_printf(dcb, "Error: Failed to reloaded database users for service %s.\n", service->name());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ HintRouter::HintRouter(SERVICE* pService,
|
||||
// set a reasonable default value
|
||||
m_max_slaves = pService->n_dbref - 1;
|
||||
}
|
||||
MXS_NOTICE("Hint router [%s] created.", pService->name);
|
||||
MXS_NOTICE("Hint router [%s] created.", pService->name());
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -155,7 +155,7 @@ bool RWSplit::have_enough_servers() const
|
||||
MXS_ERROR("Unable to start %s service. There are "
|
||||
"too few backend servers available. Found %d "
|
||||
"when %d is required.",
|
||||
m_service->name,
|
||||
m_service->name(),
|
||||
router_nsrv,
|
||||
min_nsrv);
|
||||
}
|
||||
@ -169,7 +169,7 @@ bool RWSplit::have_enough_servers() const
|
||||
MXS_ERROR("Unable to start %s service. There are "
|
||||
"too few backend servers configured in "
|
||||
"MaxScale.cnf. Found %d when %d is required.",
|
||||
m_service->name,
|
||||
m_service->name(),
|
||||
m_config->max_slave_connections,
|
||||
min_nsrv);
|
||||
}
|
||||
@ -180,7 +180,7 @@ bool RWSplit::have_enough_servers() const
|
||||
"too few backend servers configured in "
|
||||
"MaxScale.cnf. Found %d%% when at least %.0f%% "
|
||||
"would be required.",
|
||||
m_service->name,
|
||||
m_service->name(),
|
||||
m_config->rw_max_slave_conn_percent,
|
||||
dbgpct);
|
||||
}
|
||||
@ -203,7 +203,7 @@ static void log_router_options_not_supported(SERVICE* service, std::string route
|
||||
MXS_ERROR("`router_options` is no longer supported in readwritesplit. "
|
||||
"To define the router options as parameters, add the following "
|
||||
"lines to service '%s':\n\n%s\n",
|
||||
service->name,
|
||||
service->name(),
|
||||
ss.str().c_str());
|
||||
}
|
||||
|
||||
|
@ -527,7 +527,7 @@ bool RWSplitSession::route_session_write(GWBUF* querybuf, uint8_t command, uint3
|
||||
"command history, add `disable_sescmd_history=true` to "
|
||||
"service '%s'. To increase the limit (currently %lu), add "
|
||||
"`max_sescmd_history` to the same service and increase the value.",
|
||||
m_router->service()->name,
|
||||
m_router->service()->name(),
|
||||
m_config.max_sescmd_history);
|
||||
warn_history_exceeded = false;
|
||||
}
|
||||
@ -965,7 +965,7 @@ void RWSplitSession::log_master_routing_failure(bool found,
|
||||
}
|
||||
|
||||
MXS_WARNING("[%s] Write query received from %s@%s. %s. Closing client connection.",
|
||||
m_router->service()->name,
|
||||
m_router->service()->name(),
|
||||
m_client->user,
|
||||
m_client->remote,
|
||||
errmsg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user