Fix sync_slaves
The function did not check whether the file name was valid.
This commit is contained in:
@ -1315,9 +1315,12 @@ void Mariadb_nodes::sync_slaves(int node)
|
|||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
MYSQL_ROW row = mysql_fetch_row(res);
|
MYSQL_ROW row = mysql_fetch_row(res);
|
||||||
if (row && row[node] && row[1])
|
if (row && row[0] && row[1])
|
||||||
{
|
{
|
||||||
const char* file_suffix = strchr(row[node], '.') + 1;
|
const char* file_suffix = strchr(row[0], '.');
|
||||||
|
if (file_suffix)
|
||||||
|
{
|
||||||
|
file_suffix++;
|
||||||
int filenum = atoi(file_suffix);
|
int filenum = atoi(file_suffix);
|
||||||
int pos = atoi(row[1]);
|
int pos = atoi(row[1]);
|
||||||
|
|
||||||
@ -1329,6 +1332,11 @@ void Mariadb_nodes::sync_slaves(int node)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Cannot sync slaves, invalid binlog file name: %s", row[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user