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/slave.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/slave.cc')
-rw-r--r-- | sql/slave.cc | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index bead4323b0c..cc0fa26027f 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -962,13 +962,19 @@ static int check_master_version(MYSQL* mysql, MASTER_INFO* mi) { const char* errmsg= 0; + /* + Note the following switch will bug when we have MySQL branch 30 ;) + */ switch (*mysql->server_version) { case '3': - mi->old_format = 1; + mi->old_format = + (strncmp(mysql->server_version, "3.23.57", 7) < 0) /* < .57 */ ? + BINLOG_FORMAT_323_LESS_57 : + BINLOG_FORMAT_323_GEQ_57 ; break; case '4': case '5': - mi->old_format = 0; + mi->old_format = BINLOG_FORMAT_CURRENT; break; default: errmsg = "Master reported unrecognized MySQL version"; @@ -1204,6 +1210,16 @@ int init_relay_log_info(RELAY_LOG_INFO* rli, const char* info_fname) Read_Master_Log_Pos: 9744 -rw-rw---- 1 guilhem qq 8192 Jun 5 16:27 gbichot2-relay-bin.002 See how 4 is less than 7811 and 8192 is less than 9744. + + WARNING: this is risky because the slave can stay like this for a long time; + then if it has a power failure, master.info says the I/O thread has read + until 9744 while the relay-log contains only until 8192 (the in-memory part + from 8192 to 9744 has been lost), so the SQL slave thread will miss some + events, silently breaking replication. + Ideally we would like to flush master.info only when we know that the relay + log has no in-memory tail. + Note that the above problem may arise only when only the IO thread is + started, which is unlikely. */ if (open_log(&rli->relay_log, glob_hostname, opt_relay_logname, |