Commit 055f046e authored by unknown's avatar unknown

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.
parent 9a6e7a83
kill -9 `cat var/run/master.pid` 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
...@@ -2059,7 +2059,7 @@ bool MYSQL_LOG::cut_spurious_tail() ...@@ -2059,7 +2059,7 @@ bool MYSQL_LOG::cut_spurious_tail()
*/ */
char *name= ha_innobase::get_mysql_bin_log_name(); char *name= ha_innobase::get_mysql_bin_log_name();
ulonglong pos= ha_innobase::get_mysql_bin_log_pos(); 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_PRINT("info", ("InnoDB has not set binlog info"));
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -2544,6 +2544,36 @@ server."); ...@@ -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()) if (ha_init())
{ {
sql_print_error("Can't init databases"); sql_print_error("Can't init databases");
...@@ -2558,8 +2588,10 @@ server."); ...@@ -2558,8 +2588,10 @@ server.");
crash recovery by InnoDB. crash recovery by InnoDB.
*/ */
if (opt_innodb_safe_binlog) if (opt_innodb_safe_binlog)
{
/* not fatal if fails (but print errors) */ /* not fatal if fails (but print errors) */
mysql_bin_log.cut_spurious_tail(); mysql_bin_log.cut_spurious_tail();
}
mysql_bin_log.report_pos_in_innodb(); mysql_bin_log.report_pos_in_innodb();
/* call ha_init_key_cache() on all key caches to init them */ /* call ha_init_key_cache() on all key caches to init them */
...@@ -4612,7 +4644,7 @@ replicating a LOAD DATA INFILE command.", ...@@ -4612,7 +4644,7 @@ replicating a LOAD DATA INFILE command.",
*/ */
{"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG, {"innodb_safe_binlog", OPT_INNODB_SAFE_BINLOG,
"After a crash recovery by InnoDB, truncate the binary log to the last \ "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.", tables.",
(gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog, (gptr*) &opt_innodb_safe_binlog,
0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0}, 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment