Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
9ee16b49
Commit
9ee16b49
authored
Aug 25, 2014
by
Heikki Linnakangas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regression tests for SELECT FOR UPDATE/SHARE NOWAIT.
Thomas Munro
parent
d153b801
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
223 additions
and
0 deletions
+223
-0
src/test/isolation/expected/nowait-2.out
src/test/isolation/expected/nowait-2.out
+43
-0
src/test/isolation/expected/nowait-3.out
src/test/isolation/expected/nowait-3.out
+17
-0
src/test/isolation/expected/nowait.out
src/test/isolation/expected/nowait.out
+65
-0
src/test/isolation/isolation_schedule
src/test/isolation/isolation_schedule
+3
-0
src/test/isolation/specs/nowait-2.spec
src/test/isolation/specs/nowait-2.spec
+37
-0
src/test/isolation/specs/nowait-3.spec
src/test/isolation/specs/nowait-3.spec
+33
-0
src/test/isolation/specs/nowait.spec
src/test/isolation/specs/nowait.spec
+25
-0
No files found.
src/test/isolation/expected/nowait-2.out
0 → 100644
View file @
9ee16b49
Parsed test spec with 2 sessions
starting permutation: s1a s2a s2b s1b s2c
step s1a: SELECT * FROM foo FOR SHARE NOWAIT;
id data
1 x
step s2a: SELECT * FROM foo FOR SHARE NOWAIT;
id data
1 x
step s2b: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2c: COMMIT;
starting permutation: s2a s1a s2b s1b s2c
step s2a: SELECT * FROM foo FOR SHARE NOWAIT;
id data
1 x
step s1a: SELECT * FROM foo FOR SHARE NOWAIT;
id data
1 x
step s2b: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2c: COMMIT;
starting permutation: s2a s2b s1a s1b s2c
step s2a: SELECT * FROM foo FOR SHARE NOWAIT;
id data
1 x
step s2b: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s1a: SELECT * FROM foo FOR SHARE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2c: COMMIT;
src/test/isolation/expected/nowait-3.out
0 → 100644
View file @
9ee16b49
Parsed test spec with 3 sessions
starting permutation: s1a s2a s3a s1b s2b s3b
step s1a: SELECT * FROM foo FOR UPDATE;
id data
1 x
step s2a: SELECT * FROM foo FOR UPDATE; <waiting ...>
step s3a: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2a: <... completed>
id data
1 x
step s2b: COMMIT;
step s3b: COMMIT;
src/test/isolation/expected/nowait.out
0 → 100644
View file @
9ee16b49
Parsed test spec with 2 sessions
starting permutation: s1a s1b s2a s2b
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s1b: COMMIT;
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s2b: COMMIT;
starting permutation: s1a s2a s1b s2b
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2b: COMMIT;
starting permutation: s1a s2a s2b s1b
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s2b: COMMIT;
step s1b: COMMIT;
starting permutation: s2a s1a s1b s2b
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s1b: COMMIT;
step s2b: COMMIT;
starting permutation: s2a s1a s2b s1b
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
ERROR: could not obtain lock on row in relation "foo"
step s2b: COMMIT;
step s1b: COMMIT;
starting permutation: s2a s2b s1a s1b
step s2a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s2b: COMMIT;
step s1a: SELECT * FROM foo FOR UPDATE NOWAIT;
id data
1 x
step s1b: COMMIT;
src/test/isolation/isolation_schedule
View file @
9ee16b49
...
@@ -25,3 +25,6 @@ test: propagate-lock-delete
...
@@ -25,3 +25,6 @@ test: propagate-lock-delete
test: drop-index-concurrently-1
test: drop-index-concurrently-1
test: alter-table-1
test: alter-table-1
test: timeouts
test: timeouts
test: nowait
test: nowait-2
test: nowait-3
src/test/isolation/specs/nowait-2.spec
0 → 100644
View file @
9ee16b49
# Test NOWAIT with multixact 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 SHARE NOWAIT; }
step "s1b" { COMMIT; }
session "s2"
setup { BEGIN; }
step "s2a" { SELECT * FROM foo FOR SHARE NOWAIT; }
step "s2b" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s2c" { COMMIT; }
# s1 and s2 both get SHARE lock, creating a multixact lock, then s2
# tries to upgrade to UPDATE but aborts because it cannot acquire a
# multi-xact lock
permutation "s1a" "s2a" "s2b" "s1b" "s2c"
# the same but with the SHARE locks acquired in a different order, so
# s2 again aborts because it can't acquired a multi-xact lock
permutation "s2a" "s1a" "s2b" "s1b" "s2c"
# s2 acquires SHARE then UPDATE, then s1 tries to acquire SHARE but
# can't so aborts because it can't acquire a regular lock
permutation "s2a" "s2b" "s1a" "s1b" "s2c"
\ No newline at end of file
src/test/isolation/specs/nowait-3.spec
0 → 100644
View file @
9ee16b49
# 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"
\ No newline at end of file
src/test/isolation/specs/nowait.spec
0 → 100644
View file @
9ee16b49
# Test NOWAIT when regular row locks can't be acquired.
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 NOWAIT; }
step "s1b" { COMMIT; }
session "s2"
setup { BEGIN; }
step "s2a" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s2b" { COMMIT; }
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment