diff options
author | guilhem@mysql.com <> | 2004-04-07 00:57:14 +0200 |
---|---|---|
committer | guilhem@mysql.com <> | 2004-04-07 00:57:14 +0200 |
commit | b5ffdec204f81156e50b9a0d3b07763eafd3ac7c (patch) | |
tree | df759bb77be6f092820afe360a076630d14db47d /sql/slave.h | |
parent | f657ea978b14e433407e2c1a17c0dbc634c05a2d (diff) | |
download | mariadb-git-b5ffdec204f81156e50b9a0d3b07763eafd3ac7c.tar.gz |
This is a fix for a bug in 3.23 -> 4.0 replication: Exec_master_log_pos is always
too big by 6 bytes. So I add code to substract 6 bytes if the master is 3.23.
This is not perfect (because it won't work if the slave I/O thread has not
noticed yet that the master is 3.23), but as long as the slave I/O thread
starts Exec_master_log_pos will be ok.
It must be merged to 4.1 but not to 5.0 (or it can be, because of #if MYSQL_VERSION_ID),
because 5.0 already works if the master is 3.23 (and in a more natural way:
in 5.0 we store the end_log_pos in the binlog and relay log).
I had to move functions from slave.h to slave.cc to satisfy gcc.
Diffstat (limited to 'sql/slave.h')
-rw-r--r-- | sql/slave.h | 31 |
1 files changed, 3 insertions, 28 deletions
diff --git a/sql/slave.h b/sql/slave.h index 4a6389e9f87..979c63af201 100644 --- a/sql/slave.h +++ b/sql/slave.h @@ -210,34 +210,9 @@ typedef struct st_relay_log_info st_relay_log_info(); ~st_relay_log_info(); - inline void inc_pending(ulonglong val) - { - pending += val; - } - /* TODO: this probably needs to be fixed */ - inline void inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock=0) - { - if (!skip_lock) - pthread_mutex_lock(&data_lock); - relay_log_pos += val+pending; - pending = 0; - if (log_pos) - master_log_pos = log_pos+ val; - pthread_cond_broadcast(&data_cond); - if (!skip_lock) - pthread_mutex_unlock(&data_lock); - } - /* - thread safe read of position - not needed if we are in the slave thread, - but required otherwise as var is a longlong - */ - inline void read_pos(ulonglong& var) - { - pthread_mutex_lock(&data_lock); - var = relay_log_pos; - pthread_mutex_unlock(&data_lock); - } - + void inc_pending(ulonglong val); + void inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock=0); + void read_pos(ulonglong& var); int wait_for_pos(THD* thd, String* log_name, longlong log_pos, longlong timeout); void close_temporary_tables(); |