~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to mysql-test/suite/storage_engine/trx/select_lock_in_share_mode.test

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2013-12-22 10:27:05 UTC
  • Revision ID: package-import@ubuntu.com-20131222102705-mndw7s12mz0szrcn
Tags: upstream-5.5.32
Import upstream version 5.5.32

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# SELECT .. LOCK IN SHARE MODE 
 
3
#
 
4
# If the engine has its own lock timeouts, 
 
5
# it makes sense to set them to minimum to decrease
 
6
# the duration of the test.
 
7
 
 
8
--source ../have_engine.inc
 
9
--source support_transactions.inc
 
10
 
 
11
--disable_warnings
 
12
DROP TABLE IF EXISTS t1;
 
13
--enable_warnings
 
14
 
 
15
--enable_connect_log
 
16
 
 
17
--source include/count_sessions.inc
 
18
 
 
19
--source ../create_table.inc
 
20
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'a');
 
21
 
 
22
--connect (con1,localhost,root,,)
 
23
BEGIN;
 
24
--sorted_result
 
25
SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
 
26
if ($mysql_errname)
 
27
{
 
28
  --let $functionality = LOCK IN SHARE MODE
 
29
  --source ../unexpected_result.inc
 
30
}
 
31
 
 
32
--connection default
 
33
SET lock_wait_timeout = 1;
 
34
 
 
35
# Should still be able to select 
 
36
 
 
37
--sorted_result
 
38
SELECT a,b FROM t1 WHERE b='a';
 
39
if ($mysql_errname)
 
40
{
 
41
  --let $functionality = LOCK IN SHARE MODE
 
42
  --source ../unexpected_result.inc
 
43
}
 
44
--sorted_result
 
45
SELECT a,b FROM t1 WHERE b='a' LOCK IN SHARE MODE;
 
46
if ($mysql_errname)
 
47
{
 
48
  --let $functionality = LOCK IN SHARE MODE
 
49
  --source ../unexpected_result.inc
 
50
}
 
51
 
 
52
--let $error_codes = ER_LOCK_WAIT_TIMEOUT
 
53
UPDATE t1 SET b='c' WHERE b='a';
 
54
--source ../check_errors.inc
 
55
if ($mysql_errname != ER_LOCK_WAIT_TIMEOUT)
 
56
{
 
57
  --let $functionality = LOCK IN SHARE MODE or UPDATE
 
58
  --source ../unexpected_result.inc
 
59
}
 
60
 
 
61
--connection con1
 
62
COMMIT;
 
63
--sorted_result
 
64
SELECT a,b FROM t1;
 
65
 
 
66
--disconnect con1
 
67
--connection default
 
68
# Now it can be updated all right
 
69
UPDATE t1 SET b='c' WHERE b='a';  
 
70
if ($mysql_errname)
 
71
{
 
72
  --let $functionality = UPDATE
 
73
  --source ../unexpected_result.inc
 
74
}
 
75
--sorted_result
 
76
SELECT a,b FROM t1;
 
77
 
 
78
DROP TABLE t1;
 
79
 
 
80
--source include/wait_until_count_sessions.inc
 
81
--source ../cleanup_engine.inc
 
82