• unknown's avatar
    Fix for BUG#26194 "mysqlbinlog --base64-output produces invalid SQL"; · 8ceea7c4
    unknown authored
    when it was printing a Query event, it produced invalid SQL (missing
    the BINLOG keyword, so the SQL started with the base64 string, which
    is incorrect).
    Note: no testcase; I have a .test which shows that the bugfix works,
    but it triggers BUG#26361 and so gives Valgrind warnings. I'm sending
    this test to the fixer of BUG#26361 for her/him to push when she/he
    fixes BUG#26361.
    
    
    client/mysqlbinlog.cc:
      writing the header (a line started with "#", i.e. a comment) and the
      body (the real operation) of an event to the same IO_CACHE
      (result_cache) confused the logic of Log_event::print_base64()
      (which is that if the cache is not empty then the BINLOG keyword
      should not be printed); it caused the BINLOG keyword to miss hence
      a syntactically wrong output of "mysqlbinlog --base64-output"
      for Query events.
      So we just use the two IO_CACHE already available in "print_event_info".
    sql/log_event.cc:
      using the new small inline function.
      Note that the replication code should one day be fixed to trap all
      errors (like disk write errors).
    sql/log_event.h:
      small inline function to group two operations: copying an IO_CACHE
      to a FILE, and reinitializing this IO_CACHE for being filled again.
    sql/records.cc:
      fix after merge
    8ceea7c4
mysqlbinlog.cc 49.4 KB