Remove router_options
Relaced router_options with configuration parameters in the createInstance router entry point. The same needs to be done for the filter API as barely any filters use the feature. Some routers (binlogrouter) still support router_options but using it is deprecated. This had to be done as their use wasn't deprecated in 2.2.
This commit is contained in:
@ -62,7 +62,6 @@ using namespace maxscale;
|
||||
*/
|
||||
void Avro::read_source_service_options(SERVICE* source)
|
||||
{
|
||||
char** options = source->routerOptions;
|
||||
MXS_CONFIG_PARAMETER* params = source->svc_config_param;
|
||||
|
||||
for (MXS_CONFIG_PARAMETER* p = params; p; p = p->next)
|
||||
@ -77,28 +76,17 @@ void Avro::read_source_service_options(SERVICE* source)
|
||||
}
|
||||
}
|
||||
|
||||
if (options)
|
||||
for (auto&& opt: mxs::strtok(config_get_string(params, "router_options"), ", \t"))
|
||||
{
|
||||
for (int i = 0; options[i]; i++)
|
||||
auto&& kv = mxs::strtok(opt, "=");
|
||||
|
||||
if (kv[0] == "binlogdir")
|
||||
{
|
||||
char option[strlen(options[i]) + 1];
|
||||
strcpy(option, options[i]);
|
||||
|
||||
char *value = strchr(option, '=');
|
||||
if (value)
|
||||
{
|
||||
*value++ = '\0';
|
||||
value = trim(value);
|
||||
|
||||
if (strcmp(option, "binlogdir") == 0)
|
||||
{
|
||||
binlogdir = value;
|
||||
}
|
||||
else if (strcmp(option, "filestem") == 0)
|
||||
{
|
||||
filestem = value;
|
||||
}
|
||||
}
|
||||
binlogdir = kv[1];
|
||||
}
|
||||
else if (kv[0] == "filestem")
|
||||
{
|
||||
filestem = kv[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ static bool conversion_task_ctl(Avro *inst, bool start);
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
MXS_ROUTER* createInstance(SERVICE *service, char **options)
|
||||
MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
uint64_t block_size = config_get_size(service->svc_config_param, "block_size");
|
||||
mxs_avro_codec_type codec = static_cast<mxs_avro_codec_type>(config_get_enum(service->svc_config_param,
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include <maxscale/paths.h>
|
||||
|
||||
/* The router entry points */
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, char **options);
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params);
|
||||
static void free_instance(ROUTER_INSTANCE *instance);
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance,
|
||||
MXS_SESSION *session);
|
||||
@ -233,8 +233,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
static MXS_ROUTER *
|
||||
createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
ROUTER_INSTANCE *inst;
|
||||
uuid_t defuuid;
|
||||
@ -322,8 +321,6 @@ createInstance(SERVICE *service, char **options)
|
||||
strcpy(inst->binlog_name, "");
|
||||
strcpy(inst->prevbinlog, "");
|
||||
|
||||
MXS_CONFIG_PARAMETER *params = service->svc_config_param;
|
||||
|
||||
inst->initbinlog = config_get_integer(params, "file");
|
||||
|
||||
inst->short_burst = config_get_integer(params, "shortburst");
|
||||
|
@ -25,7 +25,7 @@ Cat::~Cat()
|
||||
{
|
||||
}
|
||||
|
||||
Cat* Cat::create(SERVICE* pService, char** pzOptions)
|
||||
Cat* Cat::create(SERVICE* pService, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
return new Cat(pService);
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ class Cat: public mxs::Router<Cat, CatSession>
|
||||
Cat& operator =(const Cat&) = delete;
|
||||
public:
|
||||
~Cat();
|
||||
static Cat* create(SERVICE* pService, char** pzOptions);
|
||||
static Cat* create(SERVICE* pService, MXS_CONFIG_PARAMETER* params);
|
||||
CatSession* newSession(MXS_SESSION* pSession);
|
||||
void diagnostics(DCB* pDcb);
|
||||
json_t* diagnostics_json() const;
|
||||
|
@ -43,7 +43,7 @@
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
/* The router entry points */
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, char **options);
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params);
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session);
|
||||
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
@ -116,11 +116,9 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
static MXS_ROUTER *
|
||||
createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
CLI_INSTANCE *inst;
|
||||
int i;
|
||||
|
||||
if ((inst = static_cast<CLI_INSTANCE*>(MXS_MALLOC(sizeof(CLI_INSTANCE)))) == NULL)
|
||||
{
|
||||
@ -131,14 +129,6 @@ createInstance(SERVICE *service, char **options)
|
||||
spinlock_init(&inst->lock);
|
||||
inst->sessions = NULL;
|
||||
|
||||
if (options)
|
||||
{
|
||||
for (i = 0; options[i]; i++)
|
||||
{
|
||||
MXS_ERROR("Unknown option for CLI '%s'", options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We have completed the creation of the instance data, so now
|
||||
* insert this router instance into the linked list of routers
|
||||
|
@ -42,7 +42,7 @@
|
||||
#include <maxscale/log_manager.h>
|
||||
|
||||
/* The router entry points */
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, char **options);
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params);
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session);
|
||||
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
@ -115,11 +115,9 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
static MXS_ROUTER *
|
||||
createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER* createInstance(SERVICE* service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
CLI_INSTANCE *inst;
|
||||
int i;
|
||||
|
||||
if ((inst = static_cast<CLI_INSTANCE*>(MXS_MALLOC(sizeof(CLI_INSTANCE)))) == NULL)
|
||||
{
|
||||
|
@ -54,11 +54,10 @@ HintRouter::HintRouter(SERVICE* pService, HINT_TYPE default_action, string& defa
|
||||
}
|
||||
|
||||
//static
|
||||
HintRouter* HintRouter::create(SERVICE* pService, char** pzOptions)
|
||||
HintRouter* HintRouter::create(SERVICE* pService, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
HR_ENTRY();
|
||||
|
||||
MXS_CONFIG_PARAMETER* params = pService->svc_config_param;
|
||||
HINT_TYPE default_action = (HINT_TYPE)config_get_enum(params, DEFAULT_ACTION,
|
||||
default_action_values);
|
||||
string default_server(config_get_string(params, DEFAULT_SERVER));
|
||||
|
@ -20,7 +20,7 @@
|
||||
class HintRouter : public maxscale::Router<HintRouter, HintRouterSession>
|
||||
{
|
||||
public:
|
||||
static HintRouter* create(SERVICE* pService, char** pzOptions);
|
||||
static HintRouter* create(SERVICE* pService, MXS_CONFIG_PARAMETER* params);
|
||||
HintRouterSession* newSession(MXS_SESSION *pSession);
|
||||
void diagnostics(DCB* pOut);
|
||||
json_t* diagnostics_json() const;
|
||||
|
@ -66,7 +66,7 @@ static int handle_url(INFO_INSTANCE *instance, INFO_SESSION *router_session, GWB
|
||||
static int maxinfo_send_ok(DCB *dcb);
|
||||
|
||||
/* The router entry points */
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, char **options);
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params);
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session);
|
||||
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
@ -143,8 +143,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
static MXS_ROUTER *
|
||||
createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
INFO_INSTANCE *inst;
|
||||
int i;
|
||||
@ -158,14 +157,6 @@ createInstance(SERVICE *service, char **options)
|
||||
inst->service = service;
|
||||
spinlock_init(&inst->lock);
|
||||
|
||||
if (options)
|
||||
{
|
||||
for (i = 0; options[i]; i++)
|
||||
{
|
||||
MXS_ERROR("Unknown option for MaxInfo '%s'", options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* We have completed the creation of the instance data, so now
|
||||
* insert this router instance into the linked list of routers
|
||||
|
@ -91,7 +91,7 @@
|
||||
#include <maxscale/utils.hh>
|
||||
|
||||
/* The router entry points */
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, char **options);
|
||||
static MXS_ROUTER *createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params);
|
||||
static MXS_ROUTER_SESSION *newSession(MXS_ROUTER *instance, MXS_SESSION *session);
|
||||
static void closeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
static void freeSession(MXS_ROUTER *instance, MXS_ROUTER_SESSION *router_session);
|
||||
@ -234,7 +234,7 @@ static bool configureInstance(MXS_ROUTER* instance, MXS_CONFIG_PARAMETER* params
|
||||
*
|
||||
* @return The instance data for this new instance
|
||||
*/
|
||||
static MXS_ROUTER* createInstance(SERVICE *service, char **options)
|
||||
static MXS_ROUTER* createInstance(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
ROUTER_INSTANCE* inst = static_cast<ROUTER_INSTANCE*>(MXS_CALLOC(1, sizeof(ROUTER_INSTANCE)));
|
||||
|
||||
@ -245,7 +245,7 @@ static MXS_ROUTER* createInstance(SERVICE *service, char **options)
|
||||
spinlock_init(&inst->lock);
|
||||
inst->bitmask_and_bitvalue = 0;
|
||||
|
||||
if (!configureInstance((MXS_ROUTER*)inst, service->svc_config_param))
|
||||
if (!configureInstance((MXS_ROUTER*)inst, params))
|
||||
{
|
||||
free_readconn_instance(inst);
|
||||
inst = nullptr;
|
||||
|
@ -273,13 +273,11 @@ bool RWSplit::have_enough_servers() const
|
||||
*/
|
||||
|
||||
|
||||
RWSplit* RWSplit::create(SERVICE *service, char **options)
|
||||
RWSplit* RWSplit::create(SERVICE *service, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
MXS_CONFIG_PARAMETER* params = service->svc_config_param;
|
||||
SConfig config(new Config(params));
|
||||
|
||||
if (!handle_max_slaves(config, config_get_string(params, "max_slave_connections")) ||
|
||||
(options && !rwsplit_process_router_options(config, options)))
|
||||
if (!handle_max_slaves(config, config_get_string(params, "max_slave_connections")))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -256,7 +256,7 @@ public:
|
||||
*
|
||||
* @return New router instance or NULL on error
|
||||
*/
|
||||
static RWSplit* create(SERVICE* pService, char** pzOptions);
|
||||
static RWSplit* create(SERVICE* pService, MXS_CONFIG_PARAMETER* params);
|
||||
|
||||
/**
|
||||
* @brief Create a new session for this router instance
|
||||
|
@ -54,18 +54,16 @@ SchemaRouter::~SchemaRouter()
|
||||
{
|
||||
}
|
||||
|
||||
SchemaRouter* SchemaRouter::create(SERVICE* pService, char** pzOptions)
|
||||
SchemaRouter* SchemaRouter::create(SERVICE* pService, MXS_CONFIG_PARAMETER* params)
|
||||
{
|
||||
MXS_CONFIG_PARAMETER* conf = pService->svc_config_param;
|
||||
|
||||
if ((config_get_param(conf, "auth_all_servers")) == NULL)
|
||||
if ((config_get_param(params, "auth_all_servers")) == NULL)
|
||||
{
|
||||
MXS_NOTICE("Authentication data is fetched from all servers. To disable this "
|
||||
"add 'auth_all_servers=0' to the service.");
|
||||
pService->users_from_all = true;
|
||||
}
|
||||
|
||||
SConfig config(new Config(pService->svc_config_param));
|
||||
SConfig config(new Config(params));
|
||||
return new SchemaRouter(pService, config);
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ class SchemaRouter: public mxs::Router<SchemaRouter, SchemaRouterSession>
|
||||
{
|
||||
public:
|
||||
~SchemaRouter();
|
||||
static SchemaRouter* create(SERVICE* pService, char** pzOptions);
|
||||
static SchemaRouter* create(SERVICE* pService, MXS_CONFIG_PARAMETER* params);
|
||||
SchemaRouterSession* newSession(MXS_SESSION* pSession);
|
||||
void diagnostics(DCB* pDcb);
|
||||
json_t* diagnostics_json() const;
|
||||
|
Reference in New Issue
Block a user