Below is the list of changes that have just been committed into a
4.0 repository of sasha. When sasha does a push, they will be propogated to
the main repository and within 24 hours after the push to the public repository.
For information on how to access the public repository
see http://www.mysql.com/doc/I/n/Installing_source_tree.html
ChangeSet@stripped, 2001-07-10 18:08:37-06:00, sasha@stripped
mysql-test/t/rpl_sporadic_master.test
fixed test case to produce same results on txn-enabled binary.
temporary fix - permanent fix is it make mysqld behave the same with
MyISAM on auto_increment insert after delete from tbl_name regardless
of how the binary was compiled
sql/slave.cc
fixed concurrency bug with log_seq
sql/slave.h
last_log_seq needs to be updated atomically with pos
sql/sql_repl.cc
cleared up comment and fixed concurrency bug
mysql-test/t/rpl_sporadic_master.test
1.2 01/07/10 18:08:29 sasha@stripped +5 -0
fixed test case to produce same results on txn-enabled binary.
temporary fix - permanent fix is it make mysqld behave the same with
MyISAM on auto_increment insert after delete from tbl_name regardless
of how the binary was compiled
sql/slave.cc
1.116 01/07/10 18:08:29 sasha@stripped +13 -17
fixed concurrency bug with log_seq
sql/slave.h
1.20 01/07/10 18:08:29 sasha@stripped +2 -1
last_log_seq needs to be updated atomically with pos
sql/sql_repl.cc
1.50 01/07/10 18:08:29 sasha@stripped +5 -13
cleared up comment and fixed concurrency bug
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: sasha
# Host: mysql.sashanet.com
# Root: /home/sasha/src/bk/mysql-4.0
--- 1.115/sql/slave.cc Sat Jul 7 15:20:16 2001
+++ 1.116/sql/slave.cc Tue Jul 10 18:08:29 2001
@@ -926,7 +926,7 @@
if(type_code == LOAD_EVENT)
skip_load_data_infile(net);
- mi->inc_pos(event_len);
+ mi->inc_pos(event_len, ev->log_seq);
flush_master_info(mi);
if(slave_skip_counter)
--slave_skip_counter;
@@ -1019,10 +1019,9 @@
return 1;
}
free_root(&thd->mem_root,0);
- mi->last_log_seq = ev->log_seq;
- delete ev;
thd->log_seq = 0;
- mi->inc_pos(event_len);
+ mi->inc_pos(event_len, ev->log_seq);
+ delete ev;
flush_master_info(mi);
break;
}
@@ -1035,11 +1034,10 @@
mysql_bin_log.write(sev);
}
- mi->last_log_seq = ev->log_seq;
- delete ev;
thd->log_seq = 0;
- mi->inc_pos(event_len);
+ mi->inc_pos(event_len, ev->log_seq);
flush_master_info(mi);
+ delete ev;
break;
}
@@ -1150,8 +1148,6 @@
return 1;
}
- mi->last_log_seq = ev->log_seq;
- delete ev;
thd->log_seq = 0;
free_root(&thd->mem_root,0);
@@ -1159,18 +1155,19 @@
{
sql_print_error("Slave: Fatal error running query '%s' ",
thd->query);
+ delete ev;
return 1;
}
- mi->inc_pos(event_len);
+ mi->inc_pos(event_len, ev->log_seq);
+ delete ev;
flush_master_info(mi);
break;
}
case START_EVENT:
close_temporary_tables(thd);
- mi->inc_pos(event_len);
- mi->last_log_seq = ev->log_seq;
+ mi->inc_pos(event_len, ev->log_seq);
flush_master_info(mi);
delete ev;
thd->log_seq = 0;
@@ -1180,10 +1177,9 @@
if(mi->pos > 4) // stop event should be ignored after rotate event
{
close_temporary_tables(thd);
- mi->inc_pos(event_len);
+ mi->inc_pos(event_len, ev->log_seq);
flush_master_info(mi);
}
- mi->last_log_seq = ev->log_seq;
delete ev;
thd->log_seq = 0;
break;
@@ -1207,17 +1203,17 @@
}
mi->pos = rev->pos;
mi->last_log_seq = ev->log_seq;
- pthread_cond_broadcast(&mi->cond);
- pthread_mutex_unlock(&mi->lock);
#ifndef DBUG_OFF
if (abort_slave_event_count)
++events_till_abort;
#endif
if (rotate_binlog)
{
- mi->last_log_seq = 0;
mysql_bin_log.new_file();
+ mi->last_log_seq = 0;
}
+ pthread_cond_broadcast(&mi->cond);
+ pthread_mutex_unlock(&mi->lock);
flush_master_info(mi);
if (write_slave_event)
--- 1.19/sql/slave.h Sat Jul 7 15:20:15 2001
+++ 1.20/sql/slave.h Tue Jul 10 18:08:29 2001
@@ -36,11 +36,12 @@
{
pending += val;
}
- inline void inc_pos(ulonglong val)
+ inline void inc_pos(ulonglong val, uint32 log_seq)
{
pthread_mutex_lock(&lock);
pos += val + pending;
pending = 0;
+ last_log_seq = log_seq;
pthread_cond_broadcast(&cond);
pthread_mutex_unlock(&lock);
}
--- 1.1/mysql-test/t/rpl_sporadic_master.test Thu Jun 28 18:22:28 2001
+++ 1.2/mysql-test/t/rpl_sporadic_master.test Tue Jul 10 18:08:29 2001
@@ -6,12 +6,17 @@
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
delete from t1;
+set insert_id=1;
insert into t1 values (NULL),(NULL);
+set insert_id=3;
insert into t1 values (NULL),(NULL);
flush logs;
delete from t1;
+set insert_id=1;
insert into t1 values (NULL),(NULL);
+set insert_id=3;
insert into t1 values (NULL),(NULL);
+set insert_id=5;
insert into t1 values (NULL),(NULL);
save_master_pos;
connection slave;
--- 1.49/sql/sql_repl.cc Tue Jul 10 06:52:35 2001
+++ 1.50/sql/sql_repl.cc Tue Jul 10 18:08:29 2001
@@ -15,7 +15,6 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
// Sasha Pachev <sasha@stripped> is currently in charge of this file
-// Do not mess with it without his permission!
#include "mysql_priv.h"
#include "sql_repl.h"
@@ -259,9 +258,10 @@
if ((linfo = tmp->current_linfo))
{
pthread_mutex_lock(&linfo->lock);
- // Why (monty): I don't understand this comment
- // no big deal if we just started reading the log
- // nothing to adjust
+ /* index file offset can be less that purge offset
+ only if we just started reading the index file. In that case
+ we have nothing to adjust
+ */
if (linfo->index_file_offset < purge_offset)
linfo->fatal = (linfo->index_file_offset != 0);
else
@@ -935,16 +935,7 @@
linfo.index_file_offset = 0;
- /*
- WARNING: POSSIBLE BUG:
- Sasha, you are setting an uninitialized linfo into
- thd->current_linfo.
- What will happen if some other thread calls log_in_use() or
- adjust_linfo_offsets() after the next instruction as linfo may
- contain anything ?
- */
- thd->current_linfo = &linfo;
search_file_name[0] = 0;
if (mysql_bin_log.find_first_log(&linfo, search_file_name))
@@ -952,6 +943,7 @@
strmov(errmsg,"Could not find first log");
return 1;
}
+ thd->current_linfo = &linfo;
bzero((char*) &log,sizeof(log));
log_lock = mysql_bin_log.get_log_lock();
| Thread |
|---|
| • bk commit into 4.0 tree | sasha | 11 Jul |