diff options
author | unknown <monty@mishka.local> | 2004-04-26 15:53:31 +0300 |
---|---|---|
committer | unknown <monty@mishka.local> | 2004-04-26 15:53:31 +0300 |
commit | 1065f2bbd66ac4b1161f5c188171a54cbad5b422 (patch) | |
tree | 25e3315af05fa92d20d2ad1d812882957c400337 /sql/slave.cc | |
parent | 0ba6cb48d84f1ff951d09871a96be6cdef3f2c3c (diff) | |
parent | 6366a9090c7fc24f0e13b5b9d73d6777dcda9d9e (diff) | |
download | mariadb-git-1065f2bbd66ac4b1161f5c188171a54cbad5b422.tar.gz |
Merge with 4.0
innobase/dict/dict0boot.c:
Auto merged
innobase/dict/dict0load.c:
Auto merged
innobase/dict/dict0mem.c:
Auto merged
innobase/fut/fut0lst.c:
Auto merged
innobase/include/buf0lru.h:
Auto merged
innobase/include/dict0mem.h:
Auto merged
innobase/include/fsp0fsp.h:
Auto merged
innobase/include/ha0ha.h:
Auto merged
innobase/include/ibuf0ibuf.h:
Auto merged
innobase/include/lock0lock.h:
Auto merged
innobase/include/log0log.h:
Auto merged
innobase/include/mem0pool.h:
Auto merged
innobase/include/mtr0mtr.h:
Auto merged
innobase/include/os0file.h:
Auto merged
innobase/include/rem0rec.h:
Auto merged
innobase/include/rem0rec.ic:
Auto merged
innobase/include/srv0srv.h:
Auto merged
innobase/include/sync0sync.h:
Auto merged
innobase/include/trx0sys.h:
Auto merged
innobase/include/ut0byte.h:
Auto merged
innobase/include/ut0ut.h:
Auto merged
innobase/mem/mem0pool.c:
Auto merged
innobase/mtr/mtr0mtr.c:
Auto merged
innobase/os/os0proc.c:
Auto merged
innobase/pars/lexyy.c:
Auto merged
innobase/pars/pars0opt.c:
Auto merged
innobase/row/row0ins.c:
Auto merged
innobase/row/row0purge.c:
Auto merged
innobase/row/row0uins.c:
Auto merged
innobase/row/row0umod.c:
Auto merged
innobase/row/row0undo.c:
Auto merged
innobase/row/row0upd.c:
Auto merged
innobase/trx/trx0purge.c:
Auto merged
innobase/trx/trx0roll.c:
Auto merged
innobase/trx/trx0sys.c:
Auto merged
innobase/trx/trx0undo.c:
Auto merged
innobase/ut/ut0byte.c:
Auto merged
pstack/bucomm.h:
Auto merged
pstack/budbg.h:
Auto merged
sql/item_sum.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_db.cc:
Auto merged
support-files/mysql.spec.sh:
Auto merged
tests/insert_test.c:
Auto merged
mysql-test/t/func_group.test:
Merge with 4.0
Put 4.1 tests lasts
sql/ha_innodb.cc:
Merge with 4.0
Added checking of results from my_malloc()
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'sql/slave.cc')
-rw-r--r-- | sql/slave.cc | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/sql/slave.cc b/sql/slave.cc index 67b9c7515e1..d3af72f78bd 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -361,6 +361,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; @@ -3473,8 +3519,16 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, DBUG_RETURN(1); } memcpy(tmp_buf,buf,event_len); - tmp_buf[event_len]=0; // Create_file constructor wants null-term buffer + /* + Create_file constructor wants a 0 as last char of buffer, this 0 will + serve as the string-termination char for the file's name (which is at the + end of the buffer) + We must increment event_len, otherwise the event constructor will not see + this end 0, which leads to segfault. + */ + tmp_buf[event_len++]=0; buf = (const char*)tmp_buf; + int4store(buf+EVENT_LEN_OFFSET, event_len); } /* This will transform LOAD_EVENT into CREATE_FILE_EVENT, ask the master to @@ -3520,7 +3574,11 @@ static int queue_old_event(MASTER_INFO *mi, const char *buf, DBUG_ASSERT(tmp_buf); int error = process_io_create_file(mi,(Create_file_log_event*)ev); delete ev; - mi->master_log_pos += event_len; + /* + We had incremented event_len, but now when it is used to calculate the + position in the master's log, we must use the original value. + */ + mi->master_log_pos += --event_len; DBUG_PRINT("info", ("master_log_pos: %d", (ulong) mi->master_log_pos)); pthread_mutex_unlock(&mi->data_lock); my_free((char*)tmp_buf, MYF(0)); |