summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <sasha@mysql.sashanet.com>2001-07-18 14:26:43 -0600
committerunknown <sasha@mysql.sashanet.com>2001-07-18 14:26:43 -0600
commit76eaa2595f785d2664bc0165cf8431c79ed92659 (patch)
tree8d1f8589119cc419e23bbb513081d4be35e4aa42 /mysql-test
parent2cbf3b9b532e048dbe3d42669bff539c5864236e (diff)
downloadmariadb-git-76eaa2595f785d2664bc0165cf8431c79ed92659.tar.gz
fixed mysterious offset confusion bug
added a test case for it - took some creative work to figure out how to make it happen at will updated the manual Docs/manual.texi: fixed wrong info on SLAVE_SKIP_COUNTER fixed wrong info in BitKeeper tree build instructions updated change history about bug fix mysql-test/t/rpl_sporadic_master.test: tried hard to get slave confused, but failed. nevertheless, a more exhaustive test case does not hurt sql/slave.cc: fixed mysterious offset confusion bug
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/rpl_mystery22.result4
-rw-r--r--mysql-test/t/rpl_mystery22.test43
-rw-r--r--mysql-test/t/rpl_sporadic_master.test11
3 files changed, 56 insertions, 2 deletions
diff --git a/mysql-test/r/rpl_mystery22.result b/mysql-test/r/rpl_mystery22.result
new file mode 100644
index 00000000000..f85b057eefa
--- /dev/null
+++ b/mysql-test/r/rpl_mystery22.result
@@ -0,0 +1,4 @@
+n
+1
+2
+3
diff --git a/mysql-test/t/rpl_mystery22.test b/mysql-test/t/rpl_mystery22.test
new file mode 100644
index 00000000000..3a48ef84dc1
--- /dev/null
+++ b/mysql-test/t/rpl_mystery22.test
@@ -0,0 +1,43 @@
+# test case to make slave thread get ahead by 22 bytes
+
+source include/master-slave.inc;
+connection master;
+# first, cause a duplicate key problem on the slave
+create table t1(n int auto_increment primary key);
+save_master_pos;
+connection slave;
+sync_with_master;
+insert into t1 values (2);
+connection master;
+insert into t1 values(NULL);
+insert into t1 values(NULL);
+save_master_pos;
+connection slave;
+sleep 1; # there is no way around this sleep - we have to wait until
+# the slave tries to run the query, fails and aborts slave thread
+delete from t1 where n = 2;
+slave start;
+sync_with_master;
+#now the buggy slave would be confused on the offset but it can replicate
+#in order to make it break, we need to stop/start the slave one more time
+slave stop;
+connection master;
+# to be able to really confuse the slave, we need some non-auto-increment
+# events in the log
+create table t2(n int);
+drop table t2;
+insert into t1 values(NULL);
+save_master_pos;
+connection slave;
+slave start;
+#now the truth comes out - if the slave is buggy, it will never sync because
+#the slave thread is not able to read events
+sync_with_master;
+select * from t1;
+#clean up
+connection master;
+drop table t1;
+save_master_pos;
+connection slave;
+sync_with_master;
+
diff --git a/mysql-test/t/rpl_sporadic_master.test b/mysql-test/t/rpl_sporadic_master.test
index a3217f9dd55..c1a47781ddf 100644
--- a/mysql-test/t/rpl_sporadic_master.test
+++ b/mysql-test/t/rpl_sporadic_master.test
@@ -3,12 +3,19 @@
source include/master-slave.inc;
connection master;
-drop table if exists t1;
+drop table if exists t1,t2;
+create table t2(n int);
create table t1(n int not null auto_increment primary key);
insert into t1 values (NULL),(NULL);
delete from t1;
# We have to use 4 in the following to make this test work with all table types
insert into t1 values (4),(NULL);
+save_master_pos;
+connection slave;
+sync_with_master;
+slave stop;
+slave start;
+connection master;
insert into t1 values (NULL),(NULL);
flush logs;
delete from t1;
@@ -20,7 +27,7 @@ connection slave;
sync_with_master;
select * from t1;
connection master;
-drop table t1;
+drop table t1,t2;
save_master_pos;
connection slave;
sync_with_master;