Bug #88878 mysqldump poorly outputs gtid purged
| Submitted: | 12 Dec 2017 15:01 | Modified: | 13 Dec 2017 9:43 |
|---|---|---|---|
| Reporter: | Trey Raymond | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: mysqldump Command-line Client | Severity: | S3 (Non-critical) |
| Version: | 5.7.20 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[12 Dec 2017 15:01]
Trey Raymond
[12 Dec 2017 15:19]
Trey Raymond
It looks like the code was originally going to output them on one line, but the entire FOR loop gets skipped, as mysql_num_rows will always be 1. The bug here is that it expects each line to be a new row, when in fact it's a string with newlines in a single row. without the loop running, the line fprintf(md_result_file,"%s';\n", (char*)gtid_set[0]); outputs the whole value, newlines and all.
[12 Dec 2017 15:24]
Trey Raymond
this should work:
static my_bool add_set_gtid_purged(MYSQL *mysql_con)
{
MYSQL_RES *gtid_purged_res;
MYSQL_ROW gtid_set;
ulonglong num_sets, idx;
/* query to get the GTID_EXECUTED */
if (mysql_query_with_error_report(mysql_con, >id_purged_res,
"SELECT replace(@@GLOBAL.GTID_EXECUTED,'\n','')"))
return TRUE;
/* Proceed only if gtid_purged_res is non empty */
if ((num_sets= mysql_num_rows(gtid_purged_res)) > 0)
{
if (opt_comments)
fprintf(md_result_file,
"\n--\n-- GTID state at the beginning of the backup \n--\n\n");
fprintf(md_result_file,"SET @@GLOBAL.GTID_PURGED='");
gtid_set= mysql_fetch_row(gtid_purged_res);
/* close the SET expression */
fprintf(md_result_file,"%s';\n", (char*)gtid_set[0]);
}
mysql_free_result(gtid_purged_res);
return FALSE; /*success */
}
[12 Dec 2017 15:26]
Trey Raymond
changing to s3 as the code existing is not actually working, so it's a bug, not a feature req
[13 Dec 2017 9:43]
MySQL Verification Team
Hello Trey Raymond, Thank you for the report and feedback. Thanks, Umesh
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.066 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.