MXS-1032: Add configurable connector plugin directory

The connector plugin directory can now be controlled with the
`connector_plugindir` argument and configuration option. This should allow
the connector to use the system plugins if the versions are binary
compatible.

Replaced calls to mysql_options to mysql_optionsv as the former is
deprecated in Connector-C 3.0 and the latter is supported in Connector-C
2.3.
This commit is contained in:
Markus Mäkelä
2017-03-14 11:52:38 +02:00
parent 61627e035c
commit d19e5b376d
7 changed files with 80 additions and 27 deletions

View File

@ -138,6 +138,7 @@ static struct option long_options[] =
{"version", no_argument, 0, 'v'},
{"version-full", no_argument, 0, 'V'},
{"help", no_argument, 0, '?'},
{"connector_plugindir", required_argument, 0, 'H'},
{0, 0, 0, 0}
};
static bool syslog_configured = false;
@ -927,6 +928,8 @@ static void usage(void)
" -E, --execdir=PATH path to the maxscale and other executable files\n"
" -F, --persistdir=PATH path to persisted configuration directory\n"
" -M, --module_configdir=PATH path to module configuration directory\n"
" -H, --connector_plugindir=PATH\n"
" path to MariaDB Connector-C plugin directory\n"
" -N, --language=PATH path to errmsg.sys file\n"
" -P, --piddir=PATH path to PID file directory\n"
" -R, --basedir=PATH base path for all other paths\n"
@ -1332,7 +1335,7 @@ int main(int argc, char **argv)
}
}
while ((opt = getopt_long(argc, argv, "dcf:l:vVs:S:?L:D:C:B:U:A:P:G:N:E:F:M:",
while ((opt = getopt_long(argc, argv, "dcf:l:vVs:S:?L:D:C:B:U:A:P:G:N:E:F:M:H:",
long_options, &option_index)) != -1)
{
bool succp = true;
@ -1496,6 +1499,16 @@ int main(int argc, char **argv)
succp = false;
}
break;
case 'H':
if (handle_path_arg(&tmp_path, optarg, NULL, true, false))
{
set_connector_plugindir(tmp_path);
}
else
{
succp = false;
}
break;
case 'F':
if (handle_path_arg(&tmp_path, optarg, NULL, true, true))
{
@ -2532,6 +2545,20 @@ static int cnf_preparser(void* data, const char* section, const char* name, cons
}
}
}
else if (strcmp(name, "connector_plugindir") == 0)
{
if (strcmp(get_connector_plugindir(), default_connector_plugindir) == 0)
{
if (handle_path_arg((char**)&tmp, (char*)value, NULL, true, false))
{
set_connector_plugindir(tmp);
}
else
{
return 0;
}
}
}
else if (strcmp(name, "persistdir") == 0)
{
if (strcmp(get_config_persistdir(), default_config_persistdir) == 0)