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:
@ -22,16 +22,39 @@ Config::Config(MXS_CONFIG_PARAMETER* conf)
|
|||||||
: refresh_min_interval(conf->get_duration<std::chrono::seconds>("refresh_interval").count())
|
: refresh_min_interval(conf->get_duration<std::chrono::seconds>("refresh_interval").count())
|
||||||
, refresh_databases(conf->get_bool("refresh_databases"))
|
, refresh_databases(conf->get_bool("refresh_databases"))
|
||||||
, debug(conf->get_bool("debug"))
|
, debug(conf->get_bool("debug"))
|
||||||
, ignore_regex(conf->get_compiled_regex("ignore_databases_regex", 0, NULL).release())
|
, ignore_regex(NULL)
|
||||||
, ignore_match_data(ignore_regex ? pcre2_match_data_create_from_pattern(ignore_regex, NULL) : NULL)
|
, ignore_match_data(NULL)
|
||||||
, preferred_server(conf->get_server("preferred_server"))
|
, 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("mysql");
|
||||||
ignored_dbs.insert("information_schema");
|
ignored_dbs.insert("information_schema");
|
||||||
ignored_dbs.insert("performance_schema");
|
ignored_dbs.insert("performance_schema");
|
||||||
|
|
||||||
// TODO: Don't process this in the router
|
std::string ignored_dbs_str = conf->get_string(CN_IGNORE_TABLES);
|
||||||
std::string ignored_dbs_str = conf->get_string("ignore_databases");
|
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())
|
if (!ignored_dbs_str.empty())
|
||||||
{
|
{
|
||||||
for (const auto& a : mxs::strtok(ignored_dbs_str, ", \t"))
|
for (const auto& a : mxs::strtok(ignored_dbs_str, ", \t"))
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
#include <maxscale/backend.hh>
|
#include <maxscale/backend.hh>
|
||||||
#include <maxscale/protocol/rwbackend.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
|
namespace schemarouter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -296,11 +296,13 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
{
|
{
|
||||||
{"ignore_databases", MXS_MODULE_PARAM_STRING },
|
{CN_IGNORE_TABLES, MXS_MODULE_PARAM_STRING },
|
||||||
{"ignore_databases_regex", MXS_MODULE_PARAM_STRING },
|
{CN_IGNORE_TABLES_REGEX, MXS_MODULE_PARAM_STRING },
|
||||||
{"max_sescmd_history", MXS_MODULE_PARAM_COUNT, "0"},
|
{CN_IGNORE_DATABASES, MXS_MODULE_PARAM_STRING },
|
||||||
{"disable_sescmd_history", MXS_MODULE_PARAM_BOOL, "false"},
|
{CN_IGNORE_DATABASES_REGEX, MXS_MODULE_PARAM_STRING },
|
||||||
{"refresh_databases", MXS_MODULE_PARAM_BOOL, "true"},
|
{"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",
|
"refresh_interval",
|
||||||
MXS_MODULE_PARAM_DURATION,
|
MXS_MODULE_PARAM_DURATION,
|
||||||
|
Reference in New Issue
Block a user