Always dump the full configuration
Always storing runtime configuration changes prevents problems when the change causes another parameter to change. One example of this is transaction_replay that implicitly enables other parameters.
This commit is contained in:
@ -4954,36 +4954,6 @@ MXS_CONFIG_PARAMETER* ParamList::params()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_if_changed(const MXS_MODULE_PARAM* params,
|
|
||||||
int file,
|
|
||||||
const std::string& key,
|
|
||||||
const std::string& value)
|
|
||||||
{
|
|
||||||
for (int i = 0; params[i].name; i++)
|
|
||||||
{
|
|
||||||
if (params[i].name == key)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* This detects only exact matches, not ones that are logically equivalent
|
|
||||||
* but lexicographically different e.g. 1 and true. This might not
|
|
||||||
* be a bad thing: it'll distinct user defined values from defaults.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!params[i].default_value || value != params[i].default_value)
|
|
||||||
{
|
|
||||||
if (dprintf(file, "%s=%s\n", key.c_str(), value.c_str()) == -1)
|
|
||||||
{
|
|
||||||
MXS_ERROR("Failed to serialize service value: %d, %s",
|
|
||||||
errno,
|
|
||||||
mxs_strerror(errno));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void dump_param_list(int file,
|
void dump_param_list(int file,
|
||||||
MXS_CONFIG_PARAMETER* list,
|
MXS_CONFIG_PARAMETER* list,
|
||||||
const std::unordered_set<std::string>& ignored,
|
const std::unordered_set<std::string>& ignored,
|
||||||
@ -4994,8 +4964,10 @@ void dump_param_list(int file,
|
|||||||
{
|
{
|
||||||
if (ignored.count(p->name) == 0 && *p->value)
|
if (ignored.count(p->name) == 0 && *p->value)
|
||||||
{
|
{
|
||||||
dump_if_changed(common_params, file, p->name, p->value);
|
if (dprintf(file, "%s=%s\n", p->name, p->value) == -1)
|
||||||
dump_if_changed(module_params, file, p->name, p->value);
|
{
|
||||||
|
MXS_ERROR("Failed to serialize service value: %d, %s", errno, mxs_strerror(errno));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user