List:Commits« Previous MessageNext Message »
From:Hakan Kuecuekyilmaz Date:January 31 2008 12:07am
Subject:bk commit into 6.0 tree (hakank:1.2792)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of hakan. When hakan does a push these changes will
be propagated 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://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2008-01-31 01:07:54+01:00, hakank@lu0011.(none) +4 -0
  Work in progress: rewriting falcon_deadlock to
  reflect Falcon behavior.

  mysql-test/suite/falcon/r/falcon_bug_22845.result@stripped, 2008-01-31 01:07:50+01:00, hakank@lu0011.(none) +1 -0
    Added a final COMMIT.

  mysql-test/suite/falcon/r/falcon_deadlock.result@stripped, 2008-01-31 01:07:50+01:00, hakank@lu0011.(none) +67 -51
    Work in progress: rewriting falcon_deadlock to
    reflect Falcon behavior.

  mysql-test/suite/falcon/t/falcon_bug_22845.test@stripped, 2008-01-31 01:07:50+01:00, hakank@lu0011.(none) +1 -0
    Added a final COMMIT.

  mysql-test/suite/falcon/t/falcon_deadlock.test@stripped, 2008-01-31 01:07:50+01:00, hakank@lu0011.(none) +165 -6
    Work in progress: rewriting falcon_deadlock to
    reflect Falcon behavior.

diff -Nrup a/mysql-test/suite/falcon/r/falcon_bug_22845.result b/mysql-test/suite/falcon/r/falcon_bug_22845.result
--- a/mysql-test/suite/falcon/r/falcon_bug_22845.result	2008-01-30 16:08:33 +01:00
+++ b/mysql-test/suite/falcon/r/falcon_bug_22845.result	2008-01-31 01:07:50 +01:00
@@ -29,4 +29,5 @@ COMMIT;
 SELECT count(*) FROM t1;
 count(*)
 0
+COMMIT;
 DROP DATABASE db1;
diff -Nrup a/mysql-test/suite/falcon/r/falcon_deadlock.result b/mysql-test/suite/falcon/r/falcon_deadlock.result
--- a/mysql-test/suite/falcon/r/falcon_deadlock.result	2007-09-20 17:43:18 +02:00
+++ b/mysql-test/suite/falcon/r/falcon_deadlock.result	2008-01-31 01:07:50 +01:00
@@ -1,114 +1,130 @@
 # Establish connection con1 (user=root)
 # Establish connection con2 (user=root)
-drop table if exists t1,t2;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
 # Switch to connection con1
-create table t1 (id integer, x integer) engine=Falcon;
-insert into t1 values(0, 0);
-set autocommit=0;
-SELECT * from t1 where id = 0 FOR UPDATE;
+CREATE TABLE t1 (
+id integer,
+x integer
+);
+INSERT INTO t1 VALUES (0, 0);
+SET @@autocommit = 0;
+SELECT * FROM t1 WHERE id = 0 FOR UPDATE;
 id	x
 0	0
 # Switch to connection con2
-set autocommit=0;
-update t1 set x=2 where id = 0;
+SET @@autocommit = 0;
+UPDATE t1 SET x = 2 WHERE id = 0;
 # Switch to connection con1
-update t1 set x=1 where id = 0;
-select * from t1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
 id	x
 0	1
-commit;
+COMMIT;
 # Switch to connection con2
-commit;
+COMMIT;
 # Switch to connection con1
-select * from t1;
+SELECT * FROM t1;
 id	x
 0	2
-commit;
-drop table t1;
+COMMIT;
+DROP TABLE t1;
 # Switch to connection con1
-create table t1 (id integer, x integer) engine=Falcon;
-create table t2 (b integer, a integer) engine=Falcon;
-insert into t1 values(0, 0), (300, 300);
-insert into t2 values(0, 10), (1, 20), (2, 30);
-commit;
-set autocommit=0;
-select * from t2;
+CREATE TABLE t1 (
+id integer,
+x integer
+);
+CREATE TABLE t2 (
+b integer,
+a integer
+);
+INSERT INTO t1 VALUES (0, 0), (300, 300);
+INSERT INTO t2 VALUES (0, 10), (1, 20), (2, 30);
+COMMIT;
+SELECT * FROM t2;
 b	a
 0	10
 1	20
 2	30
-update t2 set a=100 where b=(SELECT x from t1 where id = b FOR UPDATE);
-select * from t2;
+UPDATE t2 SET a = 100 WHERE b = (SELECT x FROM t1 WHERE id = b FOR UPDATE);
+SELECT * FROM t2;
 b	a
 0	100
 1	20
 2	30
-select * from t1;
+SELECT * FROM t1;
 id	x
 0	0
 300	300
 # Switch to connection con2
-set autocommit=0;
-update t1 set x=2 where id = 0;
+UPDATE t1 SET x = 2 WHERE id = 0;
 # Switch to connection con1
-update t1 set x=1 where id = 0;
-select * from t1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
 id	x
 0	1
 300	300
-commit;
+COMMIT;
 # Switch to connection con2
-commit;
+COMMIT;
 # Switch to connection con1
-select * from t1;
+SELECT * FROM t1;
 id	x
 0	2
 300	300
-commit;
-drop table t1, t2;
-create table t1 (id integer, x integer) engine=Falcon;
-create table t2 (b integer, a integer) engine=Falcon;
-insert into t1 values(0, 0), (300, 300);
-insert into t2 values(0, 0), (1, 20), (2, 30);
-commit;
+COMMIT;
+DROP TABLE t1;
+DROP TABLE t2;
+CREATE TABLE t1 (
+id integer,
+x integer
+);
+CREATE TABLE t2 (
+b integer,
+a integer
+);
+INSERT INTO t1 VALUES (0, 0), (300, 300);
+INSERT INTO t2 VALUES (0, 0), (1, 20), (2, 30);
+COMMIT;
 # Switch to connection con1
-select a,b from t2 UNION SELECT id, x from t1 FOR UPDATE;
+SELECT a, b FROM t2 UNION SELECT id, x FROM t1 FOR UPDATE;
 a	b
 0	0
 20	1
 30	2
 300	300
-select * from t2;
+SELECT * FROM t2;
 b	a
 0	0
 1	20
 2	30
-select * from t1;
+SELECT * FROM t1;
 id	x
 0	0
 300	300
 # Switch to connection con2
-update t2 set a=2 where b = 0;
-select * from t2;
+UPDATE t2 SET a = 2 WHERE b = 0;
+SELECT * FROM t2;
 b	a
 0	2
 1	20
 2	30
-update t1 set x=2 where id = 0;
+UPDATE t1 SET x = 2 WHERE id = 0;
 # Switch to connection con1
-update t1 set x=1 where id = 0;
-select * from t1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
 id	x
 0	1
 300	300
-commit;
+COMMIT;
 # Switch to connection con2
-commit;
+COMMIT;
 # Switch to connection con1
-select * from t1;
+SELECT * FROM t1;
 id	x
 0	2
 300	300
-commit;
+COMMIT;
 # Switch to connection default + disconnect con1 and con2
-drop table t1, t2;
+DROP TABLE t1;
+DROP TABLE t2;
diff -Nrup a/mysql-test/suite/falcon/t/falcon_bug_22845.test b/mysql-test/suite/falcon/t/falcon_bug_22845.test
--- a/mysql-test/suite/falcon/t/falcon_bug_22845.test	2008-01-30 16:08:34 +01:00
+++ b/mysql-test/suite/falcon/t/falcon_bug_22845.test	2008-01-31 01:07:50 +01:00
@@ -61,6 +61,7 @@ COMMIT;
 # --- Check                                         --- #
 # ----------------------------------------------------- #
 SELECT count(*) FROM t1;
+COMMIT;
 
 # ----------------------------------------------------- #
 # --- Final cleanup                                 --- #
diff -Nrup a/mysql-test/suite/falcon/t/falcon_deadlock.test b/mysql-test/suite/falcon/t/falcon_deadlock.test
--- a/mysql-test/suite/falcon/t/falcon_deadlock.test	2007-09-20 17:43:43 +02:00
+++ b/mysql-test/suite/falcon/t/falcon_deadlock.test	2008-01-31 01:07:50 +01:00
@@ -1,9 +1,168 @@
-# This test was derived from innodb_deadlock.test.
-
 -- source include/have_falcon.inc
-let $engine_type = Falcon;
-
-# Can't test this with embedded server
 -- source include/not_embedded.inc
+#
+# This test was derived from innodb_deadlock.test,
+# which sources in include/deadlock.inc.
+#
+# As Falcon has different behavior than InnoDB,
+# we rewrote the parts in question.
+#
+let $engine = Falcon;
+eval SET @@storage_engine = $engine;
+
+--echo # Establish connection con1 (user=root)
+connect (con1,localhost,root,,);
+eval SET @@storage_engine = $engine;
+
+--echo # Establish connection con2 (user=root)
+connect (con2,localhost,root,,);
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t2;
+--enable_warnings
+
+#
+# Testing of FOR UPDATE, first take.
+#
+--echo # Switch to connection con1
+connection con1;
+CREATE TABLE t1 (
+  id integer,
+  x integer
+);
+
+INSERT INTO t1 VALUES (0, 0);
+SET @@autocommit = 0;
+SELECT * FROM t1 WHERE id = 0 FOR UPDATE;
+
+--echo # Switch to connection con2
+connection con2;
+SET @@autocommit = 0;
+
+# The following query should hang because con1 is locking the record
+--send UPDATE t1 SET x = 2 WHERE id = 0;
+--real_sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
+COMMIT;
+
+--echo # Switch to connection con2
+connection con2;
+# With Falcon we should get a
+# Record has changed since last read in table 't1' here.
+--error ER_CHECKREAD
+--reap
+ROLLBACK;
+
+--echo # Switch to connection con1
+connection con1;
+SELECT * FROM t1;
+COMMIT;
+
+DROP TABLE t1;
+
+#
+# Testing of FOR UPDATE, second take.
+#
+--echo # Switch to connection con1
+connection con1;
+CREATE TABLE t1 (
+  id integer,
+  x integer
+);
+
+CREATE TABLE t2 (
+  b integer,
+  a integer
+);
+
+INSERT INTO t1 VALUES (0, 0), (300, 300);
+INSERT INTO t2 VALUES (0, 10), (1, 20), (2, 30);
+COMMIT;
+
+SELECT * FROM t2;
+UPDATE t2 SET a = 100 WHERE b = (SELECT x FROM t1 WHERE id = b FOR UPDATE);
+SELECT * FROM t2;
+SELECT * FROM t1;
+
+--echo # Switch to connection con2
+connection con2;
+
+# The following query should hang because con1 is locking the record
+--send UPDATE t1 SET x = 2 WHERE id = 0;
+--real_sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
+COMMIT;
+
+--echo # Switch to connection con2
+connection con2;
+--reap
+COMMIT;
+
+--echo # Switch to connection con1
+connection con1;
+SELECT * FROM t1;
+COMMIT;
+
+DROP TABLE t1;
+DROP TABLE t2;
+
+CREATE TABLE t1 (
+  id integer,
+  x integer
+);
+
+CREATE TABLE t2 (
+  b integer,
+  a integer
+);
+
+INSERT INTO t1 VALUES (0, 0), (300, 300);
+INSERT INTO t2 VALUES (0, 0), (1, 20), (2, 30);
+COMMIT;
+
+SELECT a, b FROM t2 UNION SELECT id, x FROM t1 FOR UPDATE;
+SELECT * FROM t2;
+SELECT * FROM t1;
+
+--echo # Switch to connection con2
+connection con2;
+
+# The following query should hang because con1 is locking the record
+UPDATE t2 SET a = 2 WHERE b = 0;
+SELECT * FROM t2;
+--send UPDATE t1 SET x = 2 WHERE id = 0;
+--real_sleep 2
+
+--echo # Switch to connection con1
+connection con1;
+UPDATE t1 SET x = 1 WHERE id = 0;
+SELECT * FROM t1;
+COMMIT;
+
+--echo # Switch to connection con2
+connection con2;
+--reap
+COMMIT;
+
+--echo # Switch to connection con1
+connection con1;
+SELECT * FROM t1;
+COMMIT;
 
---source include/deadlock.inc
+# Cleanup
+--echo # Switch to connection default + disconnect con1 and con2
+connection default;
+disconnect con1;
+disconnect con2;
+DROP TABLE t1,
+DROP TABLE t2;
Thread
bk commit into 6.0 tree (hakank:1.2792)Hakan Kuecuekyilmaz31 Jan