diff options
author | unknown <guilhem@mysql.com> | 2003-06-06 16:41:28 +0200 |
---|---|---|
committer | unknown <guilhem@mysql.com> | 2003-06-06 16:41:28 +0200 |
commit | a0120344b9039328221e2a25ae8ae516b6d2c0c4 (patch) | |
tree | 6355f561936938df547dcf9c94734e32c95496b1 /sql/log_event.cc | |
parent | bd414c301c1bbadecf385e1c10aa8a27cd76f61a (diff) | |
download | mariadb-git-a0120344b9039328221e2a25ae8ae516b6d2c0c4.tar.gz |
Fix for bug 254 :
we now make a distinction between if the master is < 3.23.57, 3.23 && >=57, and 4.x
(before the 2 3.23 were one). This is because in 3.23.57 we have a way to distinguish between
a Start_log_event written at server startup and one written at FLUSH LOGS, so we
have a way to know if the slave must drop old temp tables or not.
Change: mi->old_format was bool, now it's enum (to handle 3 cases). However, functions
which had 'bool old_format' as an argument have their prototypes unchanged, because
the old old_format == 0 now corresponds to the enum value BINLOG_FORMAT_CURRENT which
is equal to 0, so boolean tests are left untouched. The only case were we use mi->old_format
as an enum instead of casting it implicitly to a bool, is in Start_log_event::exec_event,
where we want to distinguish between the 3 possible enum values.
sql/log_event.cc:
Fix for bug 254 :
we now make a distinction between if the master is < 3.23.57, 3.23 && >=57, and 4.x
(before the 2 3.23 were one), to know if the slave must drop old temp tables or not.
sql/slave.cc:
Fix for bug 254 : mi->old_format is now enum.
An unrelated comment.
sql/slave.h:
fix for bug 254 : mi->old_format is now enum.
Diffstat (limited to 'sql/log_event.cc')
-rw-r--r-- | sql/log_event.cc | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/sql/log_event.cc b/sql/log_event.cc index 369ef940af2..ff968babcf0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2000,11 +2000,8 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, IMPLEMENTATION - To handle the case where the master died without a stop event, - we clean up all temporary tables + locks that we got. - However, we don't clean temporary tables if the master was 3.23 - (this is because a 3.23 master writes a Start_log_event at every - binlog rotation; if we were not careful we would remove temp tables - on the slave when FLUSH LOGS is issued on the master). + we clean up all temporary tables that we got, if we are sure we + can (see below). TODO - Remove all active user locks @@ -2015,18 +2012,37 @@ int Load_log_event::exec_event(NET* net, struct st_relay_log_info* rli, int Start_log_event::exec_event(struct st_relay_log_info* rli) { - if (!rli->mi->old_format) - { + + switch (rli->mi->old_format) { + case BINLOG_FORMAT_CURRENT : /* - If 4.0 master, all temporary tables have been deleted on the master; - if 3.23 master, this is far from sure. + This is 4.x, so a Start_log_event is only at master startup, + so we are sure the master has restarted and cleared his temp tables. */ close_temporary_tables(thd); + cleanup_load_tmpdir(); + break; + /* + Now the older formats; in that case load_tmpdir is cleaned up by the I/O + thread. + */ + case BINLOG_FORMAT_323_LESS_57 : /* - If we have old format, load_tmpdir is cleaned up by the I/O thread + Cannot distinguish a Start_log_event generated at master startup and + one generated by master FLUSH LOGS, so cannot be sure temp tables + have to be dropped. So do nothing. */ - cleanup_load_tmpdir(); + break; + case BINLOG_FORMAT_323_GEQ_57 : + /* Can distinguish, based on the value of 'created' */ + if (created) /* this was generated at master startup*/ + close_temporary_tables(thd); + break; + default : + /* this case is impossible */ + return 1; } + return Log_event::exec_event(rli); } |