summaryrefslogtreecommitdiff
path: root/client/mysqlbinlog.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2005-02-23 19:18:14 +0100
committerunknown <guilhem@mysql.com>2005-02-23 19:18:14 +0100
commit0d8ec8d5cb3a57cc675fd61974d0abab7f6cb89e (patch)
treee9d831dc3d40b8e0afe5bc8d9692efe5905621a7 /client/mysqlbinlog.cc
parent0624fde21c4d10de40ab9aa69600608f113bb3d4 (diff)
downloadmariadb-git-0d8ec8d5cb3a57cc675fd61974d0abab7f6cb89e.tar.gz
mysqlbinlog: safety measures (safe setting for completion_type,
auto-end-rollback in case crashed binlog) which cannot hurt. client/mysqlbinlog.cc: safety measures (completion_type, crashed binlog)
Diffstat (limited to 'client/mysqlbinlog.cc')
-rw-r--r--client/mysqlbinlog.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 7c682f402eb..f564ee31fed 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -1249,6 +1249,14 @@ int main(int argc, char** argv)
fprintf(result_file,
"/*!32316 SET @OLD_SQL_LOG_BIN=@@SQL_LOG_BIN, SQL_LOG_BIN=0*/;\n");
+ /*
+ In mysqlbinlog|mysql, don't want mysql to be disconnected after each
+ transaction (which would be the case with GLOBAL.COMPLETION_TYPE==2).
+ */
+ fprintf(result_file,
+ "/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,"
+ "COMPLETION_TYPE=0*/;\n");
+
for (save_stop_position= stop_position, stop_position= ~(my_off_t)0 ;
(--argc >= 0) && !stop_passed ; )
{
@@ -1263,6 +1271,13 @@ int main(int argc, char** argv)
start_position= BIN_LOG_HEADER_SIZE;
}
+ /*
+ Issue a ROLLBACK in case the last printed binlog was crashed and had half
+ of transaction.
+ */
+ fprintf(result_file,
+ "ROLLBACK;\n"
+ "/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;\n");
if (disable_log_bin)
fprintf(result_file, "/*!32316 SET SQL_LOG_BIN=@OLD_SQL_LOG_BIN*/;\n");