summaryrefslogtreecommitdiff
path: root/sql/slave.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-04-07 00:58:53 +0200
committerunknown <guilhem@mysql.com>2004-04-07 00:58:53 +0200
commitaacdf1ee142212499d5492f9a6280f7b3bc83502 (patch)
treee4c79c3072168b8138bdd4b459924df540225a72 /sql/slave.cc
parent80fe399fee3a7752aecdfc888edfcf56a2be7b0a (diff)
parente3f0177b984eab8bcdff6c4c8ddc34e087d1297a (diff)
downloadmariadb-git-aacdf1ee142212499d5492f9a6280f7b3bc83502.tar.gz
Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/mysql_src/mysql-4.0
Diffstat (limited to 'sql/slave.cc')
-rw-r--r--sql/slave.cc46
1 files changed, 46 insertions, 0 deletions
diff --git a/sql/slave.cc b/sql/slave.cc
index d6dda473be0..9e82a521cb3 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -329,6 +329,52 @@ void init_slave_skip_errors(const char* arg)
}
}
+void st_relay_log_info::inc_pending(ulonglong val)
+{
+ pending += val;
+}
+
+/* TODO: this probably needs to be fixed */
+void st_relay_log_info::inc_pos(ulonglong val, ulonglong log_pos, bool skip_lock)
+{
+ if (!skip_lock)
+ pthread_mutex_lock(&data_lock);
+ relay_log_pos += val+pending;
+ pending = 0;
+ if (log_pos)
+#if MYSQL_VERSION_ID < 50000
+ /*
+ If the event was converted from a 3.23 format, get_event_len() has
+ grown by 6 bytes (at least for most events, except LOAD DATA INFILE
+ which is already a big problem for 3.23->4.0 replication); 6 bytes is
+ the difference between the header's size in 4.0 (LOG_EVENT_HEADER_LEN)
+ and the header's size in 3.23 (OLD_HEADER_LEN). Note that using
+ mi->old_format will not help if the I/O thread has not started yet.
+ Yes this is a hack but it's just to make 3.23->4.x replication work;
+ 3.23->5.0 replication is working much better.
+
+ The line "mi->old_format ? : " below should NOT BE MERGED to 5.0 which
+ already works. But it SHOULD be merged to 4.1.
+ */
+ master_log_pos= log_pos + val -
+ (mi->old_format ? (LOG_EVENT_HEADER_LEN - OLD_HEADER_LEN) : 0);
+#endif
+ 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
+*/
+void st_relay_log_info::read_pos(ulonglong& var)
+{
+ pthread_mutex_lock(&data_lock);
+ var = relay_log_pos;
+ pthread_mutex_unlock(&data_lock);
+}
+
void st_relay_log_info::close_temporary_tables()
{
TABLE *table,*next;