summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/nowait-3.spec
blob: 06fb7624c3ce668f601595934dbf0a7e5506c98e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Test NOWAIT with tuple locks.

setup
{
  CREATE TABLE foo (
	id int PRIMARY KEY,
	data text NOT NULL
  );
  INSERT INTO foo VALUES (1, 'x');
}

teardown
{
  DROP TABLE foo;
}

session s1
setup		{ BEGIN; }
step s1a	{ SELECT * FROM foo FOR UPDATE; }
step s1b	{ COMMIT; }

session s2
setup		{ BEGIN; }
step s2a	{ SELECT * FROM foo FOR UPDATE; }
step s2b	{ COMMIT; }

session s3
setup		{ BEGIN; }
step s3a	{ SELECT * FROM foo FOR UPDATE NOWAIT; }
step s3b	{ COMMIT; }

# s3 skips to second record due to tuple lock held by s2
permutation s1a s2a s3a s1b s2b s3b