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);
  }
  
 
 
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); }