From 424007ec2923fb2676c8d1b51c52ffedd10de13c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Jun 2004 23:51:40 +0200 Subject: [PATCH] WL#1717 "binlog/innodb consistency". Final push. Printing some warnings at startup, as --innodb-safe-binlog requires some other options, to work as expected. Adding 6 new tests (3 pairs). If they fail on some platforms (so far they have been run only on my Linux), they should be ignored for the 4.1.3 build (you can just rm mysql-test/*/rpl_crash_*). Now going to update doc. mysql-test/misc/kill_master.sh: If the mysqld process has already gone away, 'kill' will fail, so we need to explicitely exit 0, so that the non-zero return code of kill does not make mysqltest stop. sql/log.cc: VC++ does not know (ulonglong)(-1) sql/mysqld.cc: When using --innodb-safe-binlog, some options need to automatically be turned on. --- mysql-test/misc/kill_master.sh | 3 +++ sql/log.cc | 2 +- sql/mysqld.cc | 34 +++++++++++++++++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/mysql-test/misc/kill_master.sh b/mysql-test/misc/kill_master.sh index e9bbf7542e7..7938c9d3ac2 100644 --- a/mysql-test/misc/kill_master.sh +++ b/mysql-test/misc/kill_master.sh @@ -1 +1,4 @@ kill -9 `cat var/run/master.pid` +# The kill may fail if process has already gone away, +# so don't use the exit code of the kill. Use 0. +exit 0 diff --git a/sql/log.cc b/sql/log.cc index e24ea009730..5d630dc086e 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -2059,7 +2059,7 @@ bool MYSQL_LOG::cut_spurious_tail() */ char *name= ha_innobase::get_mysql_bin_log_name(); ulonglong pos= ha_innobase::get_mysql_bin_log_pos(); - if (name[0] == 0 || pos == (ulonglong)(-1)) + if (name[0] == 0 || pos == ULONGLONG_MAX) { DBUG_PRINT("info", ("InnoDB has not set binlog info")); DBUG_RETURN(0); diff --git a/sql/mysqld.cc b/sql/mysqld.cc index bce6bcef5cd..2f92ef1614e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2544,6 +2544,36 @@ server."); } } + if (opt_innodb_safe_binlog) + { + if (innobase_flush_log_at_trx_commit != 1) + { + sql_print_error("Warning: --innodb-safe-binlog is meaningful only if " + "innodb_flush_log_at_trx_commit is 1; now setting it " + "to 1."); + innobase_flush_log_at_trx_commit= 1; + } + if (innobase_unix_file_flush_method) + { + /* + This option has so many values that it's hard to know which value is + good (especially "littlesync", and on Windows... see + srv/srv0start.c). + */ + sql_print_error("Warning: --innodb-safe-binlog requires that " + "the innodb_flush_method actually synchronizes the " + "InnoDB log to disk; it is your responsibility " + "to verify that the method you chose does it."); + } + if (sync_binlog_period != 1) + { + sql_print_error("Warning: --innodb-safe-binlog is meaningful only if " + "the global sync_binlog variable is 1; now setting it " + "to 1."); + sync_binlog_period= 1; + } + } + if (ha_init()) { sql_print_error("Can't init databases"); @@ -2558,8 +2588,10 @@ server."); crash recovery by InnoDB. */ if (opt_innodb_safe_binlog) + { /* not fatal if fails (but print errors) */ mysql_bin_log.cut_spurious_tail(); + } mysql_bin_log.report_pos_in_innodb(); /* call ha_init_key_cache() on all key caches to init them */ @@ -4612,7 +4644,7 @@ replicating a LOAD DATA INFILE command.", */ {"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG, "After a crash recovery by InnoDB, truncate the binary log to the last \ -InnoDB committed transaction. Use only if this server updates only InnoDB \ +InnoDB committed transaction. Use only if this server updates ONLY InnoDB \ tables.", (gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},