#At file:///G:/bzr/mysql-6.0-falcon-team/
2946 Vladislav Vaintroub 2008-12-18 [merge]
merge
modified:
mysql-test/suite/falcon/t/falcon_deadlock_collection.test
mysql-test/suite/falcon_team/r/falcon_deadlock.result
mysql-test/suite/falcon_team/t/falcon_deadlock.test
=== modified file 'mysql-test/suite/falcon/t/falcon_deadlock_collection.test'
--- a/mysql-test/suite/falcon/t/falcon_deadlock_collection.test 2008-01-30 00:01:08 +0000
+++ b/mysql-test/suite/falcon/t/falcon_deadlock_collection.test 2008-12-18 10:49:29 +0000
@@ -1,4 +1,5 @@
--source include/have_falcon.inc
+
#
# Collection of deadlock related tests for Falcon.
#
=== modified file 'mysql-test/suite/falcon_team/r/falcon_deadlock.result'
--- a/mysql-test/suite/falcon_team/r/falcon_deadlock.result 2008-04-20 00:05:17 +0000
+++ b/mysql-test/suite/falcon_team/r/falcon_deadlock.result 2008-12-18 10:49:29 +0000
@@ -1,8 +1,12 @@
-# Establish connection con1 (user=root)
-# Establish connection con2 (user=root)
+*** falcon_deadlock ***
+SET @@storage_engine = 'Falcon';
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
-# Switch to connection con1
+# Establish connection conn1 (user=root)
+SET @@storage_engine = 'Falcon';
+# Establish connection conn2 (user=root)
+SET @@storage_engine = 'Falcon';
+# Switch to connection conn1
CREATE TABLE t1 (
id integer,
x integer
@@ -12,62 +16,62 @@ SET @@autocommit = 0;
SELECT * FROM t1 WHERE id = 0 FOR UPDATE;
id x
0 0
-# Switch to connection con2
+# Switch to connection conn2
SET @@autocommit = 0;
UPDATE t1 SET x = 2 WHERE id = 0;
-# Switch to connection con1
+# Switch to connection conn1
UPDATE t1 SET x = 1 WHERE id = 0;
SELECT * FROM t1;
id x
0 1
COMMIT;
-# Switch to connection con2
-COMMIT;
-# Switch to connection con1
+# Switch to connection conn2
+ROLLBACK;
+# Switch to connection conn1
SELECT * FROM t1;
id x
-0 2
+0 1
COMMIT;
DROP TABLE t1;
-# Switch to connection con1
+# Switch to connection conn1
CREATE TABLE t1 (
id integer,
x integer
);
CREATE TABLE t2 (
-b integer,
-a integer
+a integer,
+b 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
+a b
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;
-b a
-0 100
+a b
+0 10
1 20
2 30
SELECT * FROM t1;
id x
0 0
300 300
-# Switch to connection con2
+# Switch to connection conn2
UPDATE t1 SET x = 2 WHERE id = 0;
-# Switch to connection con1
+# Switch to connection conn1
UPDATE t1 SET x = 1 WHERE id = 0;
SELECT * FROM t1;
id x
0 1
300 300
COMMIT;
-# Switch to connection con2
+# Switch to connection conn2
COMMIT;
-# Switch to connection con1
+# Switch to connection conn1
SELECT * FROM t1;
id x
0 2
@@ -80,21 +84,20 @@ id integer,
x integer
);
CREATE TABLE t2 (
-b integer,
-a integer
+a integer,
+b 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;
a b
0 0
-20 1
-30 2
+1 20
+2 30
300 300
SELECT * FROM t2;
-b a
+a b
0 0
1 20
2 30
@@ -102,29 +105,32 @@ SELECT * FROM t1;
id x
0 0
300 300
-# Switch to connection con2
+# Switch to connection conn2
UPDATE t2 SET a = 2 WHERE b = 0;
SELECT * FROM t2;
-b a
-0 2
+a b
+2 0
1 20
2 30
UPDATE t1 SET x = 2 WHERE id = 0;
-# Switch to connection con1
+# Switch to connection conn1
UPDATE t1 SET x = 1 WHERE id = 0;
SELECT * FROM t1;
id x
0 1
300 300
COMMIT;
-# Switch to connection con2
+# Switch to connection conn2
COMMIT;
-# Switch to connection con1
+# Switch to connection conn1
SELECT * FROM t1;
id x
0 2
300 300
COMMIT;
-# Switch to connection default + disconnect con1 and con2
+SELECT count(*) FROM t1;
+count(*)
+2
+# Switch to connection default + disconnect conn1 and conn2
DROP TABLE t1;
DROP TABLE t2;
=== modified file 'mysql-test/suite/falcon_team/t/falcon_deadlock.test'
--- a/mysql-test/suite/falcon_team/t/falcon_deadlock.test 2008-04-20 00:05:17 +0000
+++ b/mysql-test/suite/falcon_team/t/falcon_deadlock.test 2008-12-18 10:49:29 +0000
@@ -1,5 +1,6 @@
-- source include/have_falcon.inc
-- source include/not_embedded.inc
+
#
# This test was derived from innodb_deadlock.test,
# which sources in include/deadlock.inc.
@@ -7,15 +8,12 @@
# 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 *** falcon_deadlock ***
---echo # Establish connection con2 (user=root)
-connect (con2,localhost,root,,);
+# ----------------------------------------------------- #
+# --- Initialisation --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
eval SET @@storage_engine = $engine;
--disable_warnings
@@ -23,62 +21,76 @@ DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
--enable_warnings
+--echo # Establish connection conn1 (user=root)
+connect (conn1,localhost,root,,);
+eval SET @@storage_engine = $engine;
+
+--echo # Establish connection conn2 (user=root)
+connect (conn2,localhost,root,,);
+eval SET @@storage_engine = $engine;
+
+# ----------------------------------------------------- #
+# --- Test --- #
+# ----------------------------------------------------- #
+# Testing of SELECT ... FOR UPDATE, first take.
#
-# Testing of FOR UPDATE, first take.
-#
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
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;
+--echo # Switch to connection conn2
+connection conn2;
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
+# The following query should hang because conn1 is locking the record
+--real_sleep 1
+--send UPDATE t1 SET x = 2 WHERE id = 0
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
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.
+--echo # Switch to connection conn2
+connection conn2;
+# If we set Falcon to
+# falcon_consistent_read = off
+#
+# we should get a
+# Record has changed since last read in table 't1'
+# here. Please note that falcon_consistent_read = off
+# is the default setting.
--error ER_CHECKREAD
--reap
ROLLBACK;
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
SELECT * FROM t1;
COMMIT;
DROP TABLE t1;
#
-# Testing of FOR UPDATE, second take.
+# Testing of SELECT ... FOR UPDATE, second take.
#
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
CREATE TABLE t1 (
id integer,
x integer
);
CREATE TABLE t2 (
- b integer,
- a integer
+ a integer,
+ b integer
);
INSERT INTO t1 VALUES (0, 0), (300, 300);
@@ -90,40 +102,43 @@ UPDATE t2 SET a = 100 WHERE b = (SELECT
SELECT * FROM t2;
SELECT * FROM t1;
---echo # Switch to connection con2
-connection con2;
+--echo # Switch to connection conn2
+connection conn2;
-# The following query should hang because con1 is locking the record
---send UPDATE t1 SET x = 2 WHERE id = 0;
---real_sleep 2
+# The following query should hang because conn1 is locking the record
+--real_sleep 1
+--send UPDATE t1 SET x = 2 WHERE id = 0
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
UPDATE t1 SET x = 1 WHERE id = 0;
SELECT * FROM t1;
COMMIT;
---echo # Switch to connection con2
-connection con2;
+--echo # Switch to connection conn2
+connection conn2;
--reap
COMMIT;
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
SELECT * FROM t1;
COMMIT;
DROP TABLE t1;
DROP TABLE t2;
+#
+# Testing of SELECT ... FOR UPDATE, third take.
+#
CREATE TABLE t1 (
id integer,
x integer
);
CREATE TABLE t2 (
- b integer,
- a integer
+ a integer,
+ b integer
);
INSERT INTO t1 VALUES (0, 0), (300, 300);
@@ -134,35 +149,42 @@ SELECT a, b FROM t2 UNION SELECT id, x F
SELECT * FROM t2;
SELECT * FROM t1;
---echo # Switch to connection con2
-connection con2;
+--echo # Switch to connection conn2
+connection conn2;
-# The following query should hang because con1 is locking the record
+# The following query should hang because conn1 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
+--real_sleep 1
+--send UPDATE t1 SET x = 2 WHERE id = 0
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
UPDATE t1 SET x = 1 WHERE id = 0;
SELECT * FROM t1;
COMMIT;
---echo # Switch to connection con2
-connection con2;
+--echo # Switch to connection conn2
+connection conn2;
--reap
COMMIT;
---echo # Switch to connection con1
-connection con1;
+--echo # Switch to connection conn1
+connection conn1;
SELECT * FROM t1;
COMMIT;
-# Cleanup
---echo # Switch to connection default + disconnect con1 and con2
+# ----------------------------------------------------- #
+# --- Check --- #
+# ----------------------------------------------------- #
+SELECT count(*) FROM t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup --- #
+# ----------------------------------------------------- #
+--echo # Switch to connection default + disconnect conn1 and conn2
connection default;
-disconnect con1;
-disconnect con2;
-DROP TABLE t1,
+disconnect conn1;
+disconnect conn2;
+DROP TABLE t1;
DROP TABLE t2;
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-team branch (vvaintroub:2946) | Vladislav Vaintroub | 18 Dec |