summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <aelkin/elkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi>2006-11-13 12:45:47 +0200
committerunknown <aelkin/elkin@dsl-hkibras-fe30f900-107.dhcp.inet.fi>2006-11-13 12:45:47 +0200
commit9b50b662197d81972b66d4c3bcf8eb67808798cf (patch)
tree2bd8748bbb33365725ecc9ece296d4837062632c /mysql-test
parentb5d6a629c9d23c624d1e6f54ef07f723a6654a1c (diff)
parent5a7bbcd5716f3859db52e0f8189fd8b85debf31d (diff)
downloadmariadb-git-9b50b662197d81972b66d4c3bcf8eb67808798cf.tar.gz
Merge aelkin@bk-internal.mysql.com:/home/bk/mysql-5.1-rpl
into dsl-hkibras-fe30f900-107.dhcp.inet.fi:/home/elkin/MySQL/TEAM/FIXES/merge_50 sql/log_event.cc: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/extra/rpl_tests/rpl_deadlock.test29
-rw-r--r--mysql-test/r/rpl_deadlock_innodb.result21
2 files changed, 31 insertions, 19 deletions
diff --git a/mysql-test/extra/rpl_tests/rpl_deadlock.test b/mysql-test/extra/rpl_tests/rpl_deadlock.test
index deeb22e2d64..526925d6a83 100644
--- a/mysql-test/extra/rpl_tests/rpl_deadlock.test
+++ b/mysql-test/extra/rpl_tests/rpl_deadlock.test
@@ -31,7 +31,9 @@ stop slave;
connection master;
begin;
# Let's keep BEGIN and the locked statement in two different relay logs.
-let $1=200;
+insert into t2 values (0); # t2,t1 actors of deadlock in repl-ed ta
+#insert into t3 select * from t2 for update;
+let $1=10;
disable_query_log;
while ($1)
{
@@ -39,16 +41,14 @@ while ($1)
dec $1;
}
enable_query_log;
-insert into t3 select * from t2 for update;
insert into t1 values(1);
commit;
save_master_pos;
connection slave;
begin;
-# Let's make our transaction large so that it's slave who is chosen as
-# victim
-let $1=1000;
+# Let's make our transaction large so that it's repl-ed msta that's victim
+let $1=100;
disable_query_log;
while ($1)
{
@@ -56,14 +56,21 @@ while ($1)
dec $1;
}
enable_query_log;
-select * from t1 for update;
+select * from t1 for update; # t1,t2 on local slave's
start slave;
+
+# bad option, todo: replicate a non-transactional t_sync with the transaction
+# and use wait_until_rows_count macro below
--real_sleep 3 # hope that slave is blocked now
-insert into t2 values(201); # provoke deadlock, slave should be victim
+#let $count=11;
+#let $table=t_sync;
+#--include wait_until_rows_count.inc
+
+select * from t2 for update /* dl */; # provoke deadlock, repl-ed should be victim
commit;
sync_with_master;
-select * from t1; # check that slave succeeded finally
-select * from t2;
+select * from t1; # check that repl-ed succeeded finally
+select * from t2 /* must be 1 */;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 16 # 22 # 23 # 33 #
--replace_result $MASTER_MYPORT MASTER_MYPORT
@@ -79,11 +86,11 @@ change master to master_log_pos=544; # the BEGIN log event
begin;
select * from t2 for update; # hold lock
start slave;
---real_sleep 10 # slave should have blocked, and be retrying
+--real_sleep 10 # repl-ed should have blocked, and be retrying
select count(*) from t3 /* must be zero */; # replaying begins after rollback
commit;
sync_with_master;
-select * from t1; # check that slave succeeded finally
+select * from t1; # check that repl-ed succeeded finally
select * from t2;
# check that no error is reported
--replace_column 1 # 7 # 8 # 9 # 11 # 16 # 22 # 23 # 33 #
diff --git a/mysql-test/r/rpl_deadlock_innodb.result b/mysql-test/r/rpl_deadlock_innodb.result
index a99d3d389bd..9a67391cd4d 100644
--- a/mysql-test/r/rpl_deadlock_innodb.result
+++ b/mysql-test/r/rpl_deadlock_innodb.result
@@ -28,21 +28,22 @@ Variable_name Value
slave_transaction_retries 2
stop slave;
begin;
-insert into t3 select * from t2 for update;
+insert into t2 values (0);
insert into t1 values(1);
commit;
begin;
select * from t1 for update;
a
start slave;
-insert into t2 values(201);
+select * from t2 for update /* dl */;
+a
commit;
select * from t1;
a
1
-select * from t2;
+select * from t2 /* must be 1 */;
a
-201
+0
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -83,7 +84,7 @@ change master to master_log_pos=544;
begin;
select * from t2 for update;
a
-201
+0
start slave;
select count(*) from t3 /* must be zero */;
count(*)
@@ -95,7 +96,8 @@ a
1
select * from t2;
a
-201
+0
+0
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1
@@ -137,7 +139,8 @@ change master to master_log_pos=544;
begin;
select * from t2 for update;
a
-201
+0
+0
start slave;
select count(*) from t3 /* must be zero */;
count(*)
@@ -150,7 +153,9 @@ a
1
select * from t2;
a
-201
+0
+0
+0
show slave status;
Slave_IO_State #
Master_Host 127.0.0.1