MXS-2477 Change schemarouter ignore_databases parameters to ignore_tables
With the table level sharding parameter is used to ignore tables not databases.
This commit is contained in:
parent
b04415d8da
commit
7893c120a9
@ -22,16 +22,39 @@ Config::Config(MXS_CONFIG_PARAMETER* conf)
|
||||
: refresh_min_interval(conf->get_duration<std::chrono::seconds>("refresh_interval").count())
|
||||
, refresh_databases(conf->get_bool("refresh_databases"))
|
||||
, debug(conf->get_bool("debug"))
|
||||
, ignore_regex(conf->get_compiled_regex("ignore_databases_regex", 0, NULL).release())
|
||||
, ignore_match_data(ignore_regex ? pcre2_match_data_create_from_pattern(ignore_regex, NULL) : NULL)
|
||||
, ignore_regex(NULL)
|
||||
, ignore_match_data(NULL)
|
||||
, preferred_server(conf->get_server("preferred_server"))
|
||||
{
|
||||
// TODO: Don't process this in the router
|
||||
if (conf->contains(CN_IGNORE_TABLES_REGEX))
|
||||
{
|
||||
ignore_regex = conf->get_compiled_regex(CN_IGNORE_TABLES_REGEX, 0, NULL).release();
|
||||
ignore_match_data = pcre2_match_data_create_from_pattern(ignore_regex, NULL);
|
||||
}
|
||||
else if (conf->contains(CN_IGNORE_DATABASES_REGEX))
|
||||
{
|
||||
MXS_WARNING("Parameter '%s' has been deprecated, use '%s' instead.",
|
||||
CN_IGNORE_DATABASES_REGEX, CN_IGNORE_TABLES_REGEX);
|
||||
ignore_regex = conf->get_compiled_regex(CN_IGNORE_DATABASES_REGEX, 0, NULL).release();
|
||||
ignore_match_data = pcre2_match_data_create_from_pattern(ignore_regex, NULL);
|
||||
}
|
||||
|
||||
ignored_dbs.insert("mysql");
|
||||
ignored_dbs.insert("information_schema");
|
||||
ignored_dbs.insert("performance_schema");
|
||||
|
||||
// TODO: Don't process this in the router
|
||||
std::string ignored_dbs_str = conf->get_string("ignore_databases");
|
||||
std::string ignored_dbs_str = conf->get_string(CN_IGNORE_TABLES);
|
||||
if (ignored_dbs_str.empty())
|
||||
{
|
||||
ignored_dbs_str = conf->get_string(CN_IGNORE_DATABASES);
|
||||
if (!ignored_dbs_str.empty())
|
||||
{
|
||||
MXS_WARNING("Parameter '%s' has been deprecated, use '%s' instead.",
|
||||
CN_IGNORE_DATABASES, CN_IGNORE_TABLES);
|
||||
}
|
||||
}
|
||||
|
||||
if (!ignored_dbs_str.empty())
|
||||
{
|
||||
for (const auto& a : mxs::strtok(ignored_dbs_str, ", \t"))
|
||||
|
@ -32,6 +32,11 @@
|
||||
#include <maxscale/backend.hh>
|
||||
#include <maxscale/protocol/rwbackend.hh>
|
||||
|
||||
const char* const CN_IGNORE_DATABASES = "ignore_databases";
|
||||
const char* const CN_IGNORE_DATABASES_REGEX = "ignore_databases_regex";
|
||||
const char* const CN_IGNORE_TABLES = "ignore_tables";
|
||||
const char* const CN_IGNORE_TABLES_REGEX = "ignore_tables_regex";
|
||||
|
||||
namespace schemarouter
|
||||
{
|
||||
/**
|
||||
|
@ -296,11 +296,13 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
||||
NULL,
|
||||
NULL,
|
||||
{
|
||||
{"ignore_databases", MXS_MODULE_PARAM_STRING },
|
||||
{"ignore_databases_regex", MXS_MODULE_PARAM_STRING },
|
||||
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"},
|
||||
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"refresh_databases", MXS_MODULE_PARAM_BOOL, "true"},
|
||||
{CN_IGNORE_TABLES, MXS_MODULE_PARAM_STRING },
|
||||
{CN_IGNORE_TABLES_REGEX, MXS_MODULE_PARAM_STRING },
|
||||
{CN_IGNORE_DATABASES, MXS_MODULE_PARAM_STRING },
|
||||
{CN_IGNORE_DATABASES_REGEX, MXS_MODULE_PARAM_STRING },
|
||||
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"},
|
||||
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"},
|
||||
{"refresh_databases", MXS_MODULE_PARAM_BOOL, "true"},
|
||||
{
|
||||
"refresh_interval",
|
||||
MXS_MODULE_PARAM_DURATION,
|
||||
|
Loading…
x
Reference in New Issue
Block a user