Bug #91829 Class Gtid_state has a wrong function to_string(char *buf)
Description:
I found an obvious mistake when I read the MySQL code.
Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p).
---------------------CODE: MySQL 5.7.22
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= lost_gtids.to_string(p);
return (int)(p - buf);
}
-----------------------CODE: Fixed
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= gtids_only_in_table.to_string(p);
return (int)(p - buf);
}
How to repeat:
I found an obvious mistake when I read the MySQL code.
Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p).
---------------------CODE: MySQL 5.7.22
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= lost_gtids.to_string(p);
return (int)(p - buf);
}
-----------------------CODE: Fixed
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= gtids_only_in_table.to_string(p);
return (int)(p - buf);
}
Suggested fix:
I found an obvious mistake when I read the MySQL code.
Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p).
---------------------CODE: MySQL 5.7.22
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= lost_gtids.to_string(p);
return (int)(p - buf);
}
-----------------------CODE: Fixed
rpl_gtid.h:
/// Debug only: Generate a string in the given buffer and return the length.
int to_string(char *buf) const
{
char *p= buf;
p+= sprintf(p, "Executed GTIDs:\n");
p+= executed_gtids.to_string(p);
p+= sprintf(p, "\nOwned GTIDs:\n");
p+= owned_gtids.to_string(p);
p+= sprintf(p, "\nLost GTIDs:\n");
p+= lost_gtids.to_string(p);
p+= sprintf(p, "\nGTIDs only_in_table:\n");
p+= gtids_only_in_table.to_string(p);
return (int)(p - buf);
}
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.050 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.
Description: I found an obvious mistake when I read the MySQL code. Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p). ---------------------CODE: MySQL 5.7.22 rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= lost_gtids.to_string(p); return (int)(p - buf); } -----------------------CODE: Fixed rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= gtids_only_in_table.to_string(p); return (int)(p - buf); } How to repeat: I found an obvious mistake when I read the MySQL code. Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p). ---------------------CODE: MySQL 5.7.22 rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= lost_gtids.to_string(p); return (int)(p - buf); } -----------------------CODE: Fixed rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= gtids_only_in_table.to_string(p); return (int)(p - buf); } Suggested fix: I found an obvious mistake when I read the MySQL code. Second lost_gtids.to_string(p) should be replaced with gtids_only_in_table.to_string(p). ---------------------CODE: MySQL 5.7.22 rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= lost_gtids.to_string(p); return (int)(p - buf); } -----------------------CODE: Fixed rpl_gtid.h: /// Debug only: Generate a string in the given buffer and return the length. int to_string(char *buf) const { char *p= buf; p+= sprintf(p, "Executed GTIDs:\n"); p+= executed_gtids.to_string(p); p+= sprintf(p, "\nOwned GTIDs:\n"); p+= owned_gtids.to_string(p); p+= sprintf(p, "\nLost GTIDs:\n"); p+= lost_gtids.to_string(p); p+= sprintf(p, "\nGTIDs only_in_table:\n"); p+= gtids_only_in_table.to_string(p); return (int)(p - buf); }