MXS-656: Galera nodes with index 0 can be master again
The index calculation falsely ignored nodes with node index 0 when errno was non-zero.
This commit is contained in:
parent
bda0c0b013
commit
fb6b3e6702
@ -397,10 +397,12 @@ monitorDatabase(MONITOR *mon, MONITOR_SERVERS *database)
|
||||
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
local_index = strtol(row[1], NULL, 10);
|
||||
if ((errno == ERANGE && (local_index == LONG_MAX
|
||||
|| local_index == LONG_MIN)) || (errno != 0 && local_index == 0))
|
||||
char* endchar;
|
||||
local_index = strtol(row[1], &endchar, 10);
|
||||
if (*endchar != '\0' ||
|
||||
(errno == ERANGE && (local_index == LONG_MAX || local_index == LONG_MIN)))
|
||||
{
|
||||
ss_dassert(false);
|
||||
local_index = -1;
|
||||
}
|
||||
database->server->node_id = local_index;
|
||||
|
Loading…
x
Reference in New Issue
Block a user