MXS-2274 Reserve names starting with @@
for use by MaxScale
Names starting with '@@' can now longer be used in configuration files. Subsequent commits will prevent such names from being used when objects are created dynamically.
This commit is contained in:
@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
## MariaDB MaxScale 2.4
|
||||
|
||||
* Names starting with `@@` are reserved for use by MaxScale.
|
||||
|
||||
For more details, please refer to:
|
||||
|
||||
* [MariaDB MaxScale 2.4.0 Release Notes](Release-Notes/MaxScale-2.4.0-Release-Notes.md)
|
||||
|
||||
## MariaDB MaxScale 2.3
|
||||
|
||||
* Runtime Configuration of the Cache
|
||||
|
45
Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md
Normal file
45
Documentation/Release-Notes/MaxScale-2.4.0-Release-Notes.md
Normal file
@ -0,0 +1,45 @@
|
||||
# MariaDB MaxScale 2.4.0 Release Notes
|
||||
|
||||
Release 2.4.0 is a Beta release.
|
||||
|
||||
This document describes the changes in release 2.4.0, when compared to
|
||||
release 2.3.
|
||||
|
||||
For any problems you encounter, please consider submitting a bug
|
||||
report at [Jira](https://jira.mariadb.org).
|
||||
|
||||
## Changed Features
|
||||
|
||||
### Section and object names
|
||||
|
||||
Section and object names starting with `@@` are now reserved for
|
||||
use by MaxScale itself. If any such names are encountered in
|
||||
configuration files, then MaxScale will not start.
|
||||
|
||||
## Dropped Features
|
||||
|
||||
## New Features
|
||||
|
||||
## Bug fixes
|
||||
|
||||
[Here is a list of bugs fixed in MaxScale 2.4.0.](https://jira.mariadb.org/issues/?jql=project%20%3D%20MXS%20AND%20issuetype%20%3D%20Bug%20AND%20status%20%3D%20Closed%20AND%20fixVersion%20%3D%202.4.0)
|
||||
|
||||
## Known Issues and Limitations
|
||||
|
||||
There are some limitations and known issues within this version of MaxScale.
|
||||
For more information, please refer to the [Limitations](../About/Limitations.md) document.
|
||||
|
||||
## Packaging
|
||||
|
||||
RPM and Debian packages are provided for the Linux distributions supported
|
||||
by MariaDB Enterprise.
|
||||
|
||||
Packages can be downloaded [here](https://mariadb.com/resources/downloads).
|
||||
|
||||
## Source Code
|
||||
|
||||
The source code of MaxScale is tagged at GitHub with a tag, which is identical
|
||||
with the version of MaxScale. For instance, the tag of version X.Y.Z of MaxScale
|
||||
is X.Y.Z. Further, *master* always refers to the latest released non-beta version.
|
||||
|
||||
The source code is available [here](https://github.com/mariadb-corporation/MaxScale).
|
24
Documentation/Upgrading/Upgrading-To-MaxScale-2.4.md
Normal file
24
Documentation/Upgrading/Upgrading-To-MaxScale-2.4.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Upgrading MariaDB MaxScale from 2.3 to 2.4
|
||||
|
||||
This document describes possible issues when upgrading MariaDB
|
||||
MaxScale from version 2.3 to 2.4.
|
||||
|
||||
For more information about MariaDB MaxScale 2.4, please refer
|
||||
to the [ChangeLog](../Changelog.md).
|
||||
|
||||
Before starting the upgrade, we recommend you back up your current
|
||||
configuration file.
|
||||
|
||||
## Section Names
|
||||
|
||||
Section and object names starting with `@@` are now reserved for
|
||||
internal use by MaxScale.
|
||||
|
||||
In case such names have been used, they must manually be changed
|
||||
in all configuration files of MaxScale, before MaxScale 2.4 is started.
|
||||
|
||||
Those files are:
|
||||
|
||||
* The main configuration file; typically `/etc/maxscale.cnf`.
|
||||
* All nested configuration files; typically `/etc/maxscale.cnf.d/*`.
|
||||
* All dynamic configuration files; typically `/var/lib/maxscale/maxscale.cnd.d/*`.
|
@ -601,6 +601,22 @@ bool config_set_writeq_low_water(uint32_t size);
|
||||
bool config_parse_disk_space_threshold(SERVER::DiskSpaceLimits* disk_space_threshold,
|
||||
const char* config_value);
|
||||
|
||||
/**
|
||||
* @brief Check whether section/object name is valid.
|
||||
*
|
||||
* @param name The name to be checked.
|
||||
* @param reason If non-null, will in case the name is not valid contain
|
||||
* the reason when the function returns.
|
||||
*
|
||||
* @return True, if the name is valid, false otherwise.
|
||||
*/
|
||||
bool config_is_valid_name(const char* name, std::string* reason = nullptr);
|
||||
|
||||
inline bool config_is_valid_name(const std::string& name, std::string* reason = nullptr)
|
||||
{
|
||||
return config_is_valid_name(name.c_str());
|
||||
}
|
||||
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
|
@ -751,6 +751,23 @@ static int ini_handler(void* userdata, const char* section, const char* name, co
|
||||
strcpy(fixed_section, section);
|
||||
fix_section_name(fixed_section);
|
||||
|
||||
string reason;
|
||||
if (!config_is_valid_name(fixed_section, &reason))
|
||||
{
|
||||
/* A set that holds all the section names that are invalid. As the configuration file
|
||||
* is parsed multiple times, we need to do this to prevent the same complaint from
|
||||
* being logged multiple times.
|
||||
*/
|
||||
static std::set<string> warned_invalid_names;
|
||||
|
||||
if (warned_invalid_names.find(reason) == warned_invalid_names.end())
|
||||
{
|
||||
MXS_ERROR("%s", reason.c_str());
|
||||
warned_invalid_names.insert(reason);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we already have some parameters for the object
|
||||
* add the parameters to that object. If not create
|
||||
@ -5038,3 +5055,40 @@ std::string closest_matching_parameter(const std::string& str,
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
bool config_is_valid_name(const char* zName, std::string* pReason)
|
||||
{
|
||||
bool is_valid = true;
|
||||
|
||||
for (const char* z = zName; is_valid && *z; z++)
|
||||
{
|
||||
if (isspace(*z))
|
||||
{
|
||||
is_valid = false;
|
||||
|
||||
if (pReason)
|
||||
{
|
||||
*pReason = "The name '";
|
||||
*pReason += zName;
|
||||
*pReason += "' contains whitespace.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_valid)
|
||||
{
|
||||
if (strncmp(zName, "@@", 2) == 0)
|
||||
{
|
||||
is_valid = false;
|
||||
|
||||
if (pReason)
|
||||
{
|
||||
*pReason = "The name '";
|
||||
*pReason += zName;
|
||||
*pReason += "' starts with '@@', which is a prefix reserved for MaxScale.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return is_valid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user