MXS-2313: Use 64-bit integers to store rank
Although the default value is the maximum value of a signed 32-bit integer, the value is stored as a 64-bit integer. The integer type conversion functions return 64-bit values so storing it as one makes sense. Currently values higher than the default are allowed but the accepted range of input should be restricted in the future.
This commit is contained in:
@ -621,9 +621,13 @@ bool runtime_alter_server(Server* server, const char* key, const char* value)
|
||||
}
|
||||
if (strcmp(key, CN_RANK) == 0)
|
||||
{
|
||||
if (is_valid_integer(value))
|
||||
if (auto i = get_positive_int(value))
|
||||
{
|
||||
server->set_rank(atoi(value));
|
||||
server->set_rank(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
config_runtime_error("Invalid value for '%s': %s", CN_RANK, value);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user