summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2005-02-09 20:04:28 +0100
committerunknown <serg@serg.mylan>2005-02-09 20:04:28 +0100
commit9297872d75f4754df8bbf607e380fc6cf68251f1 (patch)
treee67ca6abbf7a9ea5ce41fb7435ffae76dbde21c8 /client/mysqlbinlog.cc
parentbe255d6577e5f20ba4bb72b44e7da8169b72197b (diff)
downloadmariadb-git-9297872d75f4754df8bbf607e380fc6cf68251f1.tar.gz
auto-ROLLBACK if binlog was not closed properly
auto-commit on Xid_log_event client/mysqlbinlog.cc: auto-ROLLBACK if binlog was not closed properly. mysql-test/r/ctype_ucs.result: results updated mysql-test/r/mix_innodb_myisam_binlog.result: results updated mysql-test/r/mysqlbinlog2.result: results updated mysql-test/r/rpl_relayrotate.result: results updated mysql-test/r/user_var.result: results updated mysql-test/t/ctype_ucs.test: finalize binlog before calling mysqlbinlog mysql-test/t/user_var.test: finalize binlog before calling mysqlbinlog sql/log_event.cc: commit at Xid_log_event comments edited sql/mysqld.cc: free(0) fixed sql/slave.cc: rollback at fake Rotate_log_event sql/sql_class.h: no commit_or_rollback argument for binlog->write(THD *thd, IO_CACHE *cache) sql/log.cc: don't write "COMMIT" query, Xid_log_event is enough sql/log_event.h: more comments for LOG_EVENT_BINLOG_IN_USE_F LOG_EVENT_FORCE_ROLLBACK_F added sql/sql_repl.cc: rollback at Rotate_log_event. don't consider binlog corrupted if it was open when we read Formar_description but closed when we got to the end sql/sql_repl.h: style fix
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7036deab2fe..fd5fd88c58d 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1086,7 +1086,7 @@ at offset %lu ; this could be a log format error or read error",
/* EOF can't be hit here normally, so it's a real error */
die("Could not read a Rotate_log_event event \
at offset %lu ; this could be a log format error or read error",
- tmp_pos);
+ tmp_pos);
}
else
break;
@@ -1157,9 +1157,16 @@ static int dump_local_log_entries(const char* logname)
Log_event* ev = Log_event::read_log_event(file, description_event);
if (!ev)
{
- if (file->error)
+ /*
+ if binlog wasn't closed properly ("in use" flag is set) don't complain
+ about a corruption, but issue a "ROLLBACK" to annihilate half-logged
+ transaction. Otherwise, treat it as EOF and move to the next binlog.
+ */
+ if (description_event->flags & LOG_EVENT_BINLOG_IN_USE_F)
+ fprintf(result_file, "ROLLBACK;\n");
+ else if (file->error)
{
- fprintf(stderr,
+ fprintf(stderr,
"Could not read entry at offset %s:"
"Error in log format or read error\n",
llstr(old_off,llbuff));