diff options
author | unknown <guilhem@mysql.com> | 2004-06-20 19:11:02 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2004-06-20 19:11:02 +0200 |
commit | 9a6e7a8371dd1de4f33f0dc56e9c0f4f2361f072 (patch) | |
tree | 1f069b5091cf2391e994e78a943d6b484dc6fe51 /client | |
parent | b99ac15cb96bb76f0b7f1ba6b0d0135c017d7973 (diff) | |
download | mariadb-git-9a6e7a8371dd1de4f33f0dc56e9c0f4f2361f072.tar.gz |
Robustness feature.
Won't be pushed as is - separate email sent for internal review.
WL#1717 "binlog-innodb consistency".
Now when mysqld starts, if InnoDB does a crash recovery, we use the binlog name
and position retrieved from InnoDB (corresponding to the last transaction
successfully committed by InnoDB) to cut any rolled back transaction from
the binary log. This is triggered by the --innodb-safe-binlog option.
Provided you configure mysqld to fsync() InnoDB at every commit (using
flush_log_at_trx_commit) and to fsync() the binlog at every write
(using --sync-binlog=1), this behaviour guarantees that a master always has
consistency between binlog and InnoDB, whenever the crash happens.
6 tests to verify that it works.
client/mysqltest.c:
New command require_os (only "unix" accepted for now).
innobase/include/trx0sys.h:
when InnoDB does crash recovery, we now save the binlog coords it prints, into variables for later use.
innobase/trx/trx0sys.c:
when InnoDB does crash recovery, we now save the binlog coords it prints, into variables for later use.
mysql-test/mysql-test-run.sh:
The tests which check that the binlog is cut at restart, need to not delete those binlogs, of course.
And not delete replication info, so that we can test that the slave does not receive anything
wrong from the cut binlog.
sql/ha_innodb.cc:
methods to read from InnoDB the binlog coords stored into it
sql/ha_innodb.h:
ethods to read from InnoDB the binlog coords stored into it
sql/log.cc:
Added my_sync() when we create a binlog (my_sync of the binlog and of the index file);
this is always done, whether --sync-binlog or not (binlog creation is rare, so no speed
problem, and I like to have the existence of the binlog always reliably recorded, even if
later content is not).
If --crash-binlog-innodb, crash between the binlog write and the InnoDB commit.
New methods:
- report_pos_in_innodb() to store the binlog name and position into InnoDB (used only when
we create a new binlog: at startup and at FLUSH LOGS)
- cut_spurious_tail() to possibly cut the tail of a binlog based on the info we read
from InnoDB (does something only if InnoDB has just done a crash recovery).
sql/mysql_priv.h:
new option, to crash (use for testing only)
sql/mysqld.cc:
New option --innodb-safe-binlog and --crash-binlog-innodb (the latter is for testing, it makes mysqld crash).
Just after opening the logs and opening the storage engines, cut any wrong statement from the binlog, based
on info read from InnoDB.
sql/sql_class.h:
new methods for MYSQL_LOG.
Diffstat (limited to 'client')
-rw-r--r-- | client/mysqltest.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c index f638053b515..7d24f6bdcff 100644 --- a/client/mysqltest.c +++ b/client/mysqltest.c @@ -223,7 +223,7 @@ Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG, Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG, Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER, Q_WAIT_FOR_SLAVE_TO_STOP, -Q_REQUIRE_VERSION, +Q_REQUIRE_VERSION, Q_REQUIRE_OS, Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS, Q_ENABLE_INFO, Q_DISABLE_INFO, Q_ENABLE_METADATA, Q_DISABLE_METADATA, @@ -297,6 +297,7 @@ const char *command_names[]= "require_manager", "wait_for_slave_to_stop", "require_version", + "require_os", "enable_warnings", "disable_warnings", "enable_info", @@ -848,6 +849,28 @@ int do_require_version(struct st_query* q) return 0; } +int do_require_os(struct st_query* q) +{ + char *p=q->first_argument, *os_arg; + LINT_INIT(res); + DBUG_ENTER("do_require_os"); + + if (!*p) + die("Missing version argument in require_os\n"); + os_arg= p; + while (*p && !my_isspace(charset_info,*p)) + p++; + *p = 0; + + if (strcmp(os_arg, "unix")) + die("For now only testing of os=unix is implemented\n"); + +#if defined(__NETWARE__) || defined(__WIN__) || defined(__OS2__) + abort_not_supported_test(); +#endif + DBUG_RETURN(0); +} + int do_source(struct st_query* q) { char* p=q->first_argument, *name; @@ -2705,6 +2728,7 @@ int main(int argc, char **argv) case Q_SLEEP: do_sleep(q, 0); break; case Q_REAL_SLEEP: do_sleep(q, 1); break; case Q_REQUIRE_VERSION: do_require_version(q); break; + case Q_REQUIRE_OS: do_require_os(q); break; case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break; case Q_REQUIRE_MANAGER: do_require_manager(q); break; #ifndef EMBEDDED_LIBRARY |