diff options
author | unknown <guilhem@gbichot3.local> | 2007-03-22 17:31:39 +0100 |
---|---|---|
committer | unknown <guilhem@gbichot3.local> | 2007-03-22 17:31:39 +0100 |
commit | 6239881a056a9e08876b28119c0d4fda3b854bb4 (patch) | |
tree | 40d87f2fcafb87f2625ebda757a6984f129f7ecc /sql/log_event.cc | |
parent | 95f010de11b3442429171926fa3b1c240f14411c (diff) | |
download | mariadb-git-6239881a056a9e08876b28119c0d4fda3b854bb4.tar.gz |
Fix for BUG#26194 "mysqlbinlog --base64-output produces invalid SQL";
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
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index f8d3c43bfba..dc411c14f93 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -75,8 +75,7 @@ public: ~Write_on_release_cache() { - if (!my_b_copy_to_file(m_cache, m_file)) - reinit_io_cache(m_cache, WRITE_CACHE, 0L, FALSE, TRUE); + copy_event_cache_to_file_and_reinit(m_cache, m_file); if (m_flags | FLUSH_F) fflush(m_file); } @@ -6160,10 +6159,8 @@ void Rows_log_event::print_helper(FILE *file, if (get_flags(STMT_END_F)) { - my_b_copy_to_file(head, file); - my_b_copy_to_file(body, file); - reinit_io_cache(head, WRITE_CACHE, 0, FALSE, TRUE); - reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE); + copy_event_cache_to_file_and_reinit(head, file); + copy_event_cache_to_file_and_reinit(body, file); } } #endif |