Allow non-quoted identifiers as isolation test session/step names.

For no obvious reason, isolationtester has always insisted that
session and step names be written with double quotes.  This is
fairly tedious and does little for test readability, especially
since the names that people actually choose almost always look
like normal identifiers.  Hence, let's tweak the lexer to allow
SQL-like identifiers not only double-quoted strings.

(They're SQL-like, not exactly SQL, because I didn't add any
case-folding logic.  Also there's no provision for U&"..." names,
not that anyone's likely to care.)

There is one incompatibility introduced by this change: if you write
"foo""bar" with no space, that used to be taken as two identifiers,
but now it's just one identifier with an embedded quote mark.

I converted all the src/test/isolation/ specfiles to remove
unnecessary double quotes, but stopped there because my
eyes were glazing over already.

Like 741d7f104, back-patch to all supported branches, so that this
isn't a stumbling block for back-patching isolation test changes.

Discussion: https://postgr.es/m/759113.1623861959@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2021-06-23 18:41:39 -04:00
parent 16492f5cc3
commit ad9827a90d
74 changed files with 3048 additions and 3022 deletions

View File

@ -80,7 +80,7 @@ teardown { <SQL> }
this to clean up in preparation for the next permutation, e.g dropping
any test tables created by setup. This part is optional.
session "<name>"
session <name>
There are normally several "session" parts in a spec file. Each
session is executed in its own connection. A session part consists
@ -91,17 +91,17 @@ session "<name>"
Each step has the syntax
step "<name>" { <SQL> }
step <name> { <SQL> }
where <name> is a name identifying this step, and SQL is a SQL statement
where <name> is a name identifying this step, and <SQL> is a SQL statement
(or statements, separated by semicolons) that is executed in the step.
Step names must be unique across the whole spec file.
permutation "<step name>" ...
permutation <step name> ...
A permutation line specifies a list of steps that are run in that order.
Any number of permutation lines can appear. If no permutation lines are
given, the test program automatically generates all possible orderings
given, the test program automatically runs all possible interleavings
of the steps from each session (running the steps of any one session in
order). Note that the list of steps in a manually specified
"permutation" line doesn't actually have to be a permutation of the
@ -109,7 +109,17 @@ permutation "<step name>" ...
or leave others out. Also, each step name can be annotated with some
parenthesized markers, which are described below.
Lines beginning with a # are considered comments.
Session and step names are SQL identifiers, either plain or double-quoted.
A difference from standard SQL is that no case-folding occurs, so that
FOO and "FOO" are the same name while FOO and Foo are different,
whether you quote them or not. You must use quotes if you want to use
an isolation test keyword (such as "permutation") as a name.
A # character begins a comment, which extends to the end of the line.
(This does not work inside <SQL> blocks, however. Use the usual SQL
comment conventions there.)
There is no way to include a "}" character in an <SQL> block.
For each permutation of the session steps (whether these are manually
specified in the spec file, or automatically generated), the isolation

View File

@ -49,7 +49,7 @@ TestSpec parseresult; /* result of parsing is left here */
%type <permutationstep> permutation_step
%type <blocker> blocker
%token <str> sqlblock string_literal
%token <str> sqlblock identifier
%token <integer> INTEGER
%token NOTICES PERMUTATION SESSION SETUP STEP TEARDOWN TEST
@ -117,7 +117,7 @@ session_list:
;
session:
SESSION string_literal opt_setup step_list opt_teardown
SESSION identifier opt_setup step_list opt_teardown
{
$$ = pg_malloc(sizeof(Session));
$$->name = $2;
@ -146,7 +146,7 @@ step_list:
step:
STEP string_literal sqlblock
STEP identifier sqlblock
{
$$ = pg_malloc(sizeof(Step));
$$->name = $2;
@ -211,7 +211,7 @@ permutation_step_list:
;
permutation_step:
string_literal
identifier
{
$$ = pg_malloc(sizeof(PermutationStep));
$$->name = $1;
@ -219,7 +219,7 @@ permutation_step:
$$->nblockers = 0;
$$->step = NULL;
}
| string_literal '(' blocker_list ')'
| identifier '(' blocker_list ')'
{
$$ = pg_malloc(sizeof(PermutationStep));
$$->name = $1;
@ -246,7 +246,7 @@ blocker_list:
;
blocker:
string_literal
identifier
{
$$ = pg_malloc(sizeof(PermutationStepBlocker));
$$->stepname = $1;
@ -255,7 +255,7 @@ blocker:
$$->step = NULL;
$$->target_notices = -1;
}
| string_literal NOTICES INTEGER
| identifier NOTICES INTEGER
{
$$ = pg_malloc(sizeof(PermutationStepBlocker));
$$->stepname = $1;

View File

@ -17,30 +17,30 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1s" { SAVEPOINT f; }
step "s1u" { UPDATE foo SET key = 2; } # obtain KEY REVOKE
step "s1r" { ROLLBACK TO f; } # lose KEY REVOKE
step "s1l" { SELECT * FROM foo FOR KEY SHARE; }
step "s1c" { COMMIT; }
step s1s { SAVEPOINT f; }
step s1u { UPDATE foo SET key = 2; } # obtain KEY REVOKE
step s1r { ROLLBACK TO f; } # lose KEY REVOKE
step s1l { SELECT * FROM foo FOR KEY SHARE; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2l" { SELECT * FROM foo FOR KEY SHARE; }
step "s2c" { COMMIT; }
step s2l { SELECT * FROM foo FOR KEY SHARE; }
step s2c { COMMIT; }
permutation "s1s" "s1u" "s1r" "s1l" "s1c" "s2l" "s2c"
permutation "s1s" "s1u" "s1r" "s1l" "s2l" "s1c" "s2c"
permutation "s1s" "s1u" "s1r" "s1l" "s2l" "s2c" "s1c"
permutation "s1s" "s1u" "s1r" "s2l" "s1l" "s1c" "s2c"
permutation "s1s" "s1u" "s1r" "s2l" "s1l" "s2c" "s1c"
permutation "s1s" "s1u" "s1r" "s2l" "s2c" "s1l" "s1c"
permutation "s1s" "s1u" "s2l" "s1r" "s1l" "s1c" "s2c"
permutation "s1s" "s1u" "s2l" "s1r" "s1l" "s2c" "s1c"
permutation "s1s" "s1u" "s2l" "s1r" "s2c" "s1l" "s1c"
permutation "s1s" "s2l" "s1u" "s2c" "s1r" "s1l" "s1c"
permutation "s1s" "s2l" "s2c" "s1u" "s1r" "s1l" "s1c"
permutation "s2l" "s1s" "s1u" "s2c" "s1r" "s1l" "s1c"
permutation "s2l" "s1s" "s2c" "s1u" "s1r" "s1l" "s1c"
permutation "s2l" "s2c" "s1s" "s1u" "s1r" "s1l" "s1c"
permutation s1s s1u s1r s1l s1c s2l s2c
permutation s1s s1u s1r s1l s2l s1c s2c
permutation s1s s1u s1r s1l s2l s2c s1c
permutation s1s s1u s1r s2l s1l s1c s2c
permutation s1s s1u s1r s2l s1l s2c s1c
permutation s1s s1u s1r s2l s2c s1l s1c
permutation s1s s1u s2l s1r s1l s1c s2c
permutation s1s s1u s2l s1r s1l s2c s1c
permutation s1s s1u s2l s1r s2c s1l s1c
permutation s1s s2l s1u s2c s1r s1l s1c
permutation s1s s2l s2c s1u s1r s1l s1c
permutation s2l s1s s1u s2c s1r s1l s1c
permutation s2l s1s s2c s1u s1r s1l s1c
permutation s2l s2c s1s s1u s1r s1l s1c

View File

@ -16,155 +16,155 @@ teardown
DROP TABLE a, b;
}
session "s1"
step "s1" { BEGIN; }
step "at1" { ALTER TABLE b ADD CONSTRAINT bfk FOREIGN KEY (a_id) REFERENCES a (i) NOT VALID; }
step "sc1" { COMMIT; }
step "s2" { BEGIN; }
step "at2" { ALTER TABLE b VALIDATE CONSTRAINT bfk; }
step "sc2" { COMMIT; }
session s1
step s1 { BEGIN; }
step at1 { ALTER TABLE b ADD CONSTRAINT bfk FOREIGN KEY (a_id) REFERENCES a (i) NOT VALID; }
step sc1 { COMMIT; }
step s2 { BEGIN; }
step at2 { ALTER TABLE b VALIDATE CONSTRAINT bfk; }
step sc2 { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "rx1" { SELECT * FROM b WHERE a_id = 1 LIMIT 1; }
step "wx" { INSERT INTO b VALUES (0); }
step "rx3" { SELECT * FROM b WHERE a_id = 3 LIMIT 3; }
step "c2" { COMMIT; }
step rx1 { SELECT * FROM b WHERE a_id = 1 LIMIT 1; }
step wx { INSERT INTO b VALUES (0); }
step rx3 { SELECT * FROM b WHERE a_id = 3 LIMIT 3; }
step c2 { COMMIT; }
permutation "s1" "at1" "sc1" "s2" "at2" "sc2" "rx1" "wx" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "at2" "rx1" "sc2" "wx" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "at2" "rx1" "wx" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "at2" "rx1" "wx" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "s2" "at2" "rx1" "wx" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "s2" "rx1" "at2" "sc2" "wx" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "at2" "wx" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "at2" "wx" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "at2" "wx" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "sc1" "s2" "rx1" "wx" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "s2" "at2" "sc2" "wx" "rx3" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "at2" "wx" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "at2" "wx" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "at2" "wx" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "s2" "wx" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "s2" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "rx3" "s2" "at2" "sc2" "c2"
permutation "s1" "at1" "sc1" "rx1" "wx" "rx3" "s2" "at2" "c2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "rx3" "s2" "c2" "at2" "sc2"
permutation "s1" "at1" "sc1" "rx1" "wx" "rx3" "c2" "s2" "at2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "s2" "at2" "sc2" "wx" "rx3" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "at2" "wx" "sc2" "rx3" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "at2" "wx" "rx3" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "at2" "wx" "rx3" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "s2" "wx" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "s2" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "rx3" "s2" "at2" "sc2" "c2"
permutation "s1" "at1" "rx1" "sc1" "wx" "rx3" "s2" "at2" "c2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "rx3" "s2" "c2" "at2" "sc2"
permutation "s1" "at1" "rx1" "sc1" "wx" "rx3" "c2" "s2" "at2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "at2" "sc2" "rx3" "c2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "at2" "rx3" "sc2" "c2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "at2" "rx3" "c2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "rx3" "at2" "sc2" "c2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "rx3" "at2" "c2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "s2" "rx3" "c2" "at2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "rx3" "s2" "at2" "sc2" "c2"
permutation "s1" "at1" "rx1" "wx" "sc1" "rx3" "s2" "at2" "c2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "rx3" "s2" "c2" "at2" "sc2"
permutation "s1" "at1" "rx1" "wx" "sc1" "rx3" "c2" "s2" "at2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "s2" "at2" "sc2" "wx" "rx3" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "at2" "wx" "sc2" "rx3" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "at2" "wx" "rx3" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "at2" "wx" "rx3" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "at2" "sc2" "rx3" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "at2" "rx3" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "at2" "rx3" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "rx3" "at2" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "rx3" "at2" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "s2" "wx" "rx3" "c2" "at2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "at2" "sc2" "rx3" "c2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "at2" "rx3" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "at2" "rx3" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "rx3" "at2" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "rx3" "at2" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "s2" "rx3" "c2" "at2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "rx3" "s2" "at2" "sc2" "c2"
permutation "s1" "rx1" "at1" "sc1" "wx" "rx3" "s2" "at2" "c2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "rx3" "s2" "c2" "at2" "sc2"
permutation "s1" "rx1" "at1" "sc1" "wx" "rx3" "c2" "s2" "at2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "at2" "sc2" "rx3" "c2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "at2" "rx3" "sc2" "c2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "at2" "rx3" "c2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "rx3" "at2" "sc2" "c2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "rx3" "at2" "c2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "s2" "rx3" "c2" "at2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "rx3" "s2" "at2" "sc2" "c2"
permutation "s1" "rx1" "at1" "wx" "sc1" "rx3" "s2" "at2" "c2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "rx3" "s2" "c2" "at2" "sc2"
permutation "s1" "rx1" "at1" "wx" "sc1" "rx3" "c2" "s2" "at2" "sc2"
permutation "s1" "rx1" "wx" "at1" "rx3" "c2" "sc1" "s2" "at2" "sc2"
permutation "s1" "rx1" "wx" "rx3" "at1" "c2" "sc1" "s2" "at2" "sc2"
permutation "s1" "rx1" "wx" "rx3" "c2" "at1" "sc1" "s2" "at2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "s2" "at2" "sc2" "wx" "rx3" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "at2" "wx" "sc2" "rx3" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "at2" "wx" "rx3" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "at2" "wx" "rx3" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "at2" "sc2" "rx3" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "at2" "rx3" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "at2" "rx3" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "rx3" "at2" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "rx3" "at2" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "s2" "wx" "rx3" "c2" "at2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "at2" "sc2" "rx3" "c2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "at2" "rx3" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "at2" "rx3" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "rx3" "at2" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "rx3" "at2" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "s2" "rx3" "c2" "at2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "rx3" "s2" "at2" "sc2" "c2"
permutation "rx1" "s1" "at1" "sc1" "wx" "rx3" "s2" "at2" "c2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "rx3" "s2" "c2" "at2" "sc2"
permutation "rx1" "s1" "at1" "sc1" "wx" "rx3" "c2" "s2" "at2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "at2" "sc2" "rx3" "c2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "at2" "rx3" "sc2" "c2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "at2" "rx3" "c2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "rx3" "at2" "sc2" "c2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "rx3" "at2" "c2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "s2" "rx3" "c2" "at2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "rx3" "s2" "at2" "sc2" "c2"
permutation "rx1" "s1" "at1" "wx" "sc1" "rx3" "s2" "at2" "c2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "rx3" "s2" "c2" "at2" "sc2"
permutation "rx1" "s1" "at1" "wx" "sc1" "rx3" "c2" "s2" "at2" "sc2"
permutation "rx1" "s1" "wx" "at1" "rx3" "c2" "sc1" "s2" "at2" "sc2"
permutation "rx1" "s1" "wx" "rx3" "at1" "c2" "sc1" "s2" "at2" "sc2"
permutation "rx1" "s1" "wx" "rx3" "c2" "at1" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "s1" "at1" "rx3" "c2" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "s1" "rx3" "at1" "c2" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "s1" "rx3" "c2" "at1" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "rx3" "s1" "at1" "c2" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "rx3" "s1" "c2" "at1" "sc1" "s2" "at2" "sc2"
permutation "rx1" "wx" "rx3" "c2" "s1" "at1" "sc1" "s2" "at2" "sc2"
permutation s1 at1 sc1 s2 at2 sc2 rx1 wx rx3 c2
permutation s1 at1 sc1 s2 at2 rx1 sc2 wx rx3 c2
permutation s1 at1 sc1 s2 at2 rx1 wx sc2 rx3 c2
permutation s1 at1 sc1 s2 at2 rx1 wx rx3 sc2 c2
permutation s1 at1 sc1 s2 at2 rx1 wx rx3 c2 sc2
permutation s1 at1 sc1 s2 rx1 at2 sc2 wx rx3 c2
permutation s1 at1 sc1 s2 rx1 at2 wx sc2 rx3 c2
permutation s1 at1 sc1 s2 rx1 at2 wx rx3 sc2 c2
permutation s1 at1 sc1 s2 rx1 at2 wx rx3 c2 sc2
permutation s1 at1 sc1 s2 rx1 wx at2 sc2 rx3 c2
permutation s1 at1 sc1 s2 rx1 wx at2 rx3 sc2 c2
permutation s1 at1 sc1 s2 rx1 wx at2 rx3 c2 sc2
permutation s1 at1 sc1 s2 rx1 wx rx3 at2 sc2 c2
permutation s1 at1 sc1 s2 rx1 wx rx3 at2 c2 sc2
permutation s1 at1 sc1 s2 rx1 wx rx3 c2 at2 sc2
permutation s1 at1 sc1 rx1 s2 at2 sc2 wx rx3 c2
permutation s1 at1 sc1 rx1 s2 at2 wx sc2 rx3 c2
permutation s1 at1 sc1 rx1 s2 at2 wx rx3 sc2 c2
permutation s1 at1 sc1 rx1 s2 at2 wx rx3 c2 sc2
permutation s1 at1 sc1 rx1 s2 wx at2 sc2 rx3 c2
permutation s1 at1 sc1 rx1 s2 wx at2 rx3 sc2 c2
permutation s1 at1 sc1 rx1 s2 wx at2 rx3 c2 sc2
permutation s1 at1 sc1 rx1 s2 wx rx3 at2 sc2 c2
permutation s1 at1 sc1 rx1 s2 wx rx3 at2 c2 sc2
permutation s1 at1 sc1 rx1 s2 wx rx3 c2 at2 sc2
permutation s1 at1 sc1 rx1 wx s2 at2 sc2 rx3 c2
permutation s1 at1 sc1 rx1 wx s2 at2 rx3 sc2 c2
permutation s1 at1 sc1 rx1 wx s2 at2 rx3 c2 sc2
permutation s1 at1 sc1 rx1 wx s2 rx3 at2 sc2 c2
permutation s1 at1 sc1 rx1 wx s2 rx3 at2 c2 sc2
permutation s1 at1 sc1 rx1 wx s2 rx3 c2 at2 sc2
permutation s1 at1 sc1 rx1 wx rx3 s2 at2 sc2 c2
permutation s1 at1 sc1 rx1 wx rx3 s2 at2 c2 sc2
permutation s1 at1 sc1 rx1 wx rx3 s2 c2 at2 sc2
permutation s1 at1 sc1 rx1 wx rx3 c2 s2 at2 sc2
permutation s1 at1 rx1 sc1 s2 at2 sc2 wx rx3 c2
permutation s1 at1 rx1 sc1 s2 at2 wx sc2 rx3 c2
permutation s1 at1 rx1 sc1 s2 at2 wx rx3 sc2 c2
permutation s1 at1 rx1 sc1 s2 at2 wx rx3 c2 sc2
permutation s1 at1 rx1 sc1 s2 wx at2 sc2 rx3 c2
permutation s1 at1 rx1 sc1 s2 wx at2 rx3 sc2 c2
permutation s1 at1 rx1 sc1 s2 wx at2 rx3 c2 sc2
permutation s1 at1 rx1 sc1 s2 wx rx3 at2 sc2 c2
permutation s1 at1 rx1 sc1 s2 wx rx3 at2 c2 sc2
permutation s1 at1 rx1 sc1 s2 wx rx3 c2 at2 sc2
permutation s1 at1 rx1 sc1 wx s2 at2 sc2 rx3 c2
permutation s1 at1 rx1 sc1 wx s2 at2 rx3 sc2 c2
permutation s1 at1 rx1 sc1 wx s2 at2 rx3 c2 sc2
permutation s1 at1 rx1 sc1 wx s2 rx3 at2 sc2 c2
permutation s1 at1 rx1 sc1 wx s2 rx3 at2 c2 sc2
permutation s1 at1 rx1 sc1 wx s2 rx3 c2 at2 sc2
permutation s1 at1 rx1 sc1 wx rx3 s2 at2 sc2 c2
permutation s1 at1 rx1 sc1 wx rx3 s2 at2 c2 sc2
permutation s1 at1 rx1 sc1 wx rx3 s2 c2 at2 sc2
permutation s1 at1 rx1 sc1 wx rx3 c2 s2 at2 sc2
permutation s1 at1 rx1 wx sc1 s2 at2 sc2 rx3 c2
permutation s1 at1 rx1 wx sc1 s2 at2 rx3 sc2 c2
permutation s1 at1 rx1 wx sc1 s2 at2 rx3 c2 sc2
permutation s1 at1 rx1 wx sc1 s2 rx3 at2 sc2 c2
permutation s1 at1 rx1 wx sc1 s2 rx3 at2 c2 sc2
permutation s1 at1 rx1 wx sc1 s2 rx3 c2 at2 sc2
permutation s1 at1 rx1 wx sc1 rx3 s2 at2 sc2 c2
permutation s1 at1 rx1 wx sc1 rx3 s2 at2 c2 sc2
permutation s1 at1 rx1 wx sc1 rx3 s2 c2 at2 sc2
permutation s1 at1 rx1 wx sc1 rx3 c2 s2 at2 sc2
permutation s1 rx1 at1 sc1 s2 at2 sc2 wx rx3 c2
permutation s1 rx1 at1 sc1 s2 at2 wx sc2 rx3 c2
permutation s1 rx1 at1 sc1 s2 at2 wx rx3 sc2 c2
permutation s1 rx1 at1 sc1 s2 at2 wx rx3 c2 sc2
permutation s1 rx1 at1 sc1 s2 wx at2 sc2 rx3 c2
permutation s1 rx1 at1 sc1 s2 wx at2 rx3 sc2 c2
permutation s1 rx1 at1 sc1 s2 wx at2 rx3 c2 sc2
permutation s1 rx1 at1 sc1 s2 wx rx3 at2 sc2 c2
permutation s1 rx1 at1 sc1 s2 wx rx3 at2 c2 sc2
permutation s1 rx1 at1 sc1 s2 wx rx3 c2 at2 sc2
permutation s1 rx1 at1 sc1 wx s2 at2 sc2 rx3 c2
permutation s1 rx1 at1 sc1 wx s2 at2 rx3 sc2 c2
permutation s1 rx1 at1 sc1 wx s2 at2 rx3 c2 sc2
permutation s1 rx1 at1 sc1 wx s2 rx3 at2 sc2 c2
permutation s1 rx1 at1 sc1 wx s2 rx3 at2 c2 sc2
permutation s1 rx1 at1 sc1 wx s2 rx3 c2 at2 sc2
permutation s1 rx1 at1 sc1 wx rx3 s2 at2 sc2 c2
permutation s1 rx1 at1 sc1 wx rx3 s2 at2 c2 sc2
permutation s1 rx1 at1 sc1 wx rx3 s2 c2 at2 sc2
permutation s1 rx1 at1 sc1 wx rx3 c2 s2 at2 sc2
permutation s1 rx1 at1 wx sc1 s2 at2 sc2 rx3 c2
permutation s1 rx1 at1 wx sc1 s2 at2 rx3 sc2 c2
permutation s1 rx1 at1 wx sc1 s2 at2 rx3 c2 sc2
permutation s1 rx1 at1 wx sc1 s2 rx3 at2 sc2 c2
permutation s1 rx1 at1 wx sc1 s2 rx3 at2 c2 sc2
permutation s1 rx1 at1 wx sc1 s2 rx3 c2 at2 sc2
permutation s1 rx1 at1 wx sc1 rx3 s2 at2 sc2 c2
permutation s1 rx1 at1 wx sc1 rx3 s2 at2 c2 sc2
permutation s1 rx1 at1 wx sc1 rx3 s2 c2 at2 sc2
permutation s1 rx1 at1 wx sc1 rx3 c2 s2 at2 sc2
permutation s1 rx1 wx at1 rx3 c2 sc1 s2 at2 sc2
permutation s1 rx1 wx rx3 at1 c2 sc1 s2 at2 sc2
permutation s1 rx1 wx rx3 c2 at1 sc1 s2 at2 sc2
permutation rx1 s1 at1 sc1 s2 at2 sc2 wx rx3 c2
permutation rx1 s1 at1 sc1 s2 at2 wx sc2 rx3 c2
permutation rx1 s1 at1 sc1 s2 at2 wx rx3 sc2 c2
permutation rx1 s1 at1 sc1 s2 at2 wx rx3 c2 sc2
permutation rx1 s1 at1 sc1 s2 wx at2 sc2 rx3 c2
permutation rx1 s1 at1 sc1 s2 wx at2 rx3 sc2 c2
permutation rx1 s1 at1 sc1 s2 wx at2 rx3 c2 sc2
permutation rx1 s1 at1 sc1 s2 wx rx3 at2 sc2 c2
permutation rx1 s1 at1 sc1 s2 wx rx3 at2 c2 sc2
permutation rx1 s1 at1 sc1 s2 wx rx3 c2 at2 sc2
permutation rx1 s1 at1 sc1 wx s2 at2 sc2 rx3 c2
permutation rx1 s1 at1 sc1 wx s2 at2 rx3 sc2 c2
permutation rx1 s1 at1 sc1 wx s2 at2 rx3 c2 sc2
permutation rx1 s1 at1 sc1 wx s2 rx3 at2 sc2 c2
permutation rx1 s1 at1 sc1 wx s2 rx3 at2 c2 sc2
permutation rx1 s1 at1 sc1 wx s2 rx3 c2 at2 sc2
permutation rx1 s1 at1 sc1 wx rx3 s2 at2 sc2 c2
permutation rx1 s1 at1 sc1 wx rx3 s2 at2 c2 sc2
permutation rx1 s1 at1 sc1 wx rx3 s2 c2 at2 sc2
permutation rx1 s1 at1 sc1 wx rx3 c2 s2 at2 sc2
permutation rx1 s1 at1 wx sc1 s2 at2 sc2 rx3 c2
permutation rx1 s1 at1 wx sc1 s2 at2 rx3 sc2 c2
permutation rx1 s1 at1 wx sc1 s2 at2 rx3 c2 sc2
permutation rx1 s1 at1 wx sc1 s2 rx3 at2 sc2 c2
permutation rx1 s1 at1 wx sc1 s2 rx3 at2 c2 sc2
permutation rx1 s1 at1 wx sc1 s2 rx3 c2 at2 sc2
permutation rx1 s1 at1 wx sc1 rx3 s2 at2 sc2 c2
permutation rx1 s1 at1 wx sc1 rx3 s2 at2 c2 sc2
permutation rx1 s1 at1 wx sc1 rx3 s2 c2 at2 sc2
permutation rx1 s1 at1 wx sc1 rx3 c2 s2 at2 sc2
permutation rx1 s1 wx at1 rx3 c2 sc1 s2 at2 sc2
permutation rx1 s1 wx rx3 at1 c2 sc1 s2 at2 sc2
permutation rx1 s1 wx rx3 c2 at1 sc1 s2 at2 sc2
permutation rx1 wx s1 at1 rx3 c2 sc1 s2 at2 sc2
permutation rx1 wx s1 rx3 at1 c2 sc1 s2 at2 sc2
permutation rx1 wx s1 rx3 c2 at1 sc1 s2 at2 sc2
permutation rx1 wx rx3 s1 at1 c2 sc1 s2 at2 sc2
permutation rx1 wx rx3 s1 c2 at1 sc1 s2 at2 sc2
permutation rx1 wx rx3 c2 s1 at1 sc1 s2 at2 sc2

View File

@ -16,64 +16,64 @@ teardown
DROP TABLE a, b;
}
session "s1"
step "s1a" { BEGIN; }
step "s1b" { ALTER TABLE b ADD CONSTRAINT bfk FOREIGN KEY (a_id) REFERENCES a (i) NOT VALID; }
step "s1c" { COMMIT; }
session s1
step s1a { BEGIN; }
step s1b { ALTER TABLE b ADD CONSTRAINT bfk FOREIGN KEY (a_id) REFERENCES a (i) NOT VALID; }
step s1c { COMMIT; }
session "s2"
step "s2a" { BEGIN; }
step "s2b" { SELECT * FROM a WHERE i = 1 LIMIT 1 FOR UPDATE; }
step "s2c" { SELECT * FROM b WHERE a_id = 3 LIMIT 1 FOR UPDATE; }
step "s2d" { INSERT INTO b VALUES (0); }
step "s2e" { INSERT INTO a VALUES (4); }
step "s2f" { COMMIT; }
session s2
step s2a { BEGIN; }
step s2b { SELECT * FROM a WHERE i = 1 LIMIT 1 FOR UPDATE; }
step s2c { SELECT * FROM b WHERE a_id = 3 LIMIT 1 FOR UPDATE; }
step s2d { INSERT INTO b VALUES (0); }
step s2e { INSERT INTO a VALUES (4); }
step s2f { COMMIT; }
permutation "s1a" "s1b" "s1c" "s2a" "s2b" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s1b" "s2a" "s1c" "s2b" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s1b" "s2a" "s2b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s1b" "s2a" "s2b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s1a" "s1b" "s2a" "s2b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s1a" "s2a" "s1b" "s1c" "s2b" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s1b" "s2b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s1b" "s2b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s1b" "s2b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s1b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s1b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s1b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s1c" "s2d" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s2d" "s1c" "s2e" "s2f"
permutation "s1a" "s2a" "s2b" "s2c" "s2d" "s1b" "s2e" "s2f" "s1c"
permutation "s1a" "s2a" "s2b" "s2c" "s2d" "s2e" "s1b" "s2f" "s1c"
permutation "s1a" "s2a" "s2b" "s2c" "s2d" "s2e" "s2f" "s1b" "s1c"
permutation "s2a" "s1a" "s1b" "s1c" "s2b" "s2c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s1b" "s2b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s1b" "s2b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s1b" "s2b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s1b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s1b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s1b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s1b" "s2e" "s2f" "s1c"
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s2e" "s1b" "s2f" "s1c"
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s2e" "s2f" "s1b" "s1c"
permutation "s2a" "s2b" "s1a" "s1b" "s1c" "s2c" "s2d" "s2e" "s2f"
permutation "s2a" "s2b" "s1a" "s1b" "s2c" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s2b" "s1a" "s1b" "s2c" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s2b" "s1a" "s2c" "s2d" "s1b" "s2e" "s2f" "s1c"
permutation "s2a" "s2b" "s1a" "s2c" "s2d" "s2e" "s1b" "s2f" "s1c"
permutation "s2a" "s2b" "s1a" "s2c" "s2d" "s2e" "s2f" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s1c" "s2d" "s2e" "s2f"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s2d" "s1c" "s2e" "s2f"
permutation "s2a" "s2b" "s2c" "s1a" "s2d" "s1b" "s2e" "s2f" "s1c"
permutation "s2a" "s2b" "s2c" "s1a" "s2d" "s2e" "s1b" "s2f" "s1c"
permutation "s2a" "s2b" "s2c" "s1a" "s2d" "s2e" "s2f" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s1a" "s1b" "s2e" "s2f" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s1a" "s2e" "s1b" "s2f" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s1a" "s2e" "s2f" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s2e" "s1a" "s1b" "s2f" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s2e" "s1a" "s2f" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s2e" "s2f" "s1a" "s1b" "s1c"
permutation s1a s1b s1c s2a s2b s2c s2d s2e s2f
permutation s1a s1b s2a s1c s2b s2c s2d s2e s2f
permutation s1a s1b s2a s2b s1c s2c s2d s2e s2f
permutation s1a s1b s2a s2b s2c s1c s2d s2e s2f
permutation s1a s1b s2a s2b s2c s2d s1c s2e s2f
permutation s1a s2a s1b s1c s2b s2c s2d s2e s2f
permutation s1a s2a s1b s2b s1c s2c s2d s2e s2f
permutation s1a s2a s1b s2b s2c s1c s2d s2e s2f
permutation s1a s2a s1b s2b s2c s2d s1c s2e s2f
permutation s1a s2a s2b s1b s1c s2c s2d s2e s2f
permutation s1a s2a s2b s1b s2c s1c s2d s2e s2f
permutation s1a s2a s2b s1b s2c s2d s1c s2e s2f
permutation s1a s2a s2b s2c s1b s1c s2d s2e s2f
permutation s1a s2a s2b s2c s1b s2d s1c s2e s2f
permutation s1a s2a s2b s2c s2d s1b s2e s2f s1c
permutation s1a s2a s2b s2c s2d s2e s1b s2f s1c
permutation s1a s2a s2b s2c s2d s2e s2f s1b s1c
permutation s2a s1a s1b s1c s2b s2c s2d s2e s2f
permutation s2a s1a s1b s2b s1c s2c s2d s2e s2f
permutation s2a s1a s1b s2b s2c s1c s2d s2e s2f
permutation s2a s1a s1b s2b s2c s2d s1c s2e s2f
permutation s2a s1a s2b s1b s1c s2c s2d s2e s2f
permutation s2a s1a s2b s1b s2c s1c s2d s2e s2f
permutation s2a s1a s2b s1b s2c s2d s1c s2e s2f
permutation s2a s1a s2b s2c s1b s1c s2d s2e s2f
permutation s2a s1a s2b s2c s1b s2d s1c s2e s2f
permutation s2a s1a s2b s2c s2d s1b s2e s2f s1c
permutation s2a s1a s2b s2c s2d s2e s1b s2f s1c
permutation s2a s1a s2b s2c s2d s2e s2f s1b s1c
permutation s2a s2b s1a s1b s1c s2c s2d s2e s2f
permutation s2a s2b s1a s1b s2c s1c s2d s2e s2f
permutation s2a s2b s1a s1b s2c s2d s1c s2e s2f
permutation s2a s2b s1a s2c s1b s1c s2d s2e s2f
permutation s2a s2b s1a s2c s1b s2d s1c s2e s2f
permutation s2a s2b s1a s2c s2d s1b s2e s2f s1c
permutation s2a s2b s1a s2c s2d s2e s1b s2f s1c
permutation s2a s2b s1a s2c s2d s2e s2f s1b s1c
permutation s2a s2b s2c s1a s1b s1c s2d s2e s2f
permutation s2a s2b s2c s1a s1b s2d s1c s2e s2f
permutation s2a s2b s2c s1a s2d s1b s2e s2f s1c
permutation s2a s2b s2c s1a s2d s2e s1b s2f s1c
permutation s2a s2b s2c s1a s2d s2e s2f s1b s1c
permutation s2a s2b s2c s2d s1a s1b s2e s2f s1c
permutation s2a s2b s2c s2d s1a s2e s1b s2f s1c
permutation s2a s2b s2c s2d s1a s2e s2f s1b s1c
permutation s2a s2b s2c s2d s2e s1a s1b s2f s1c
permutation s2a s2b s2c s2d s2e s1a s2f s1b s1c
permutation s2a s2b s2c s2d s2e s2f s1a s1b s1c

View File

@ -17,63 +17,63 @@ teardown
DROP FUNCTION f();
}
session "s1"
step "s1a" { BEGIN; }
step "s1b" { ALTER TABLE a DISABLE TRIGGER t; }
step "s1c" { ALTER TABLE a ENABLE TRIGGER t; }
step "s1d" { COMMIT; }
session s1
step s1a { BEGIN; }
step s1b { ALTER TABLE a DISABLE TRIGGER t; }
step s1c { ALTER TABLE a ENABLE TRIGGER t; }
step s1d { COMMIT; }
session "s2"
step "s2a" { BEGIN; }
step "s2b" { SELECT * FROM a WHERE i = 1 LIMIT 1 FOR UPDATE; }
step "s2c" { INSERT INTO a VALUES (0); }
step "s2d" { COMMIT; }
session s2
step s2a { BEGIN; }
step s2b { SELECT * FROM a WHERE i = 1 LIMIT 1 FOR UPDATE; }
step s2c { INSERT INTO a VALUES (0); }
step s2d { COMMIT; }
permutation "s1a" "s1b" "s1c" "s1d" "s2a" "s2b" "s2c" "s2d"
permutation "s1a" "s1b" "s1c" "s2a" "s1d" "s2b" "s2c" "s2d"
permutation "s1a" "s1b" "s1c" "s2a" "s2b" "s1d" "s2c" "s2d"
permutation "s1a" "s1b" "s1c" "s2a" "s2b" "s2c" "s1d" "s2d"
permutation "s1a" "s1b" "s2a" "s1c" "s1d" "s2b" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s1c" "s2b" "s1d" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s1c" "s2b" "s2c" "s1d" "s2d"
permutation "s1a" "s1b" "s2a" "s2b" "s1c" "s1d" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s2b" "s1c" "s2c" "s1d" "s2d"
permutation "s1a" "s1b" "s2a" "s2b" "s2c" "s1c" "s1d" "s2d"
permutation "s1a" "s2a" "s1b" "s1c" "s1d" "s2b" "s2c" "s2d"
permutation "s1a" "s2a" "s1b" "s1c" "s2b" "s1d" "s2c" "s2d"
permutation "s1a" "s2a" "s1b" "s1c" "s2b" "s2c" "s1d" "s2d"
permutation "s1a" "s2a" "s1b" "s2b" "s1c" "s1d" "s2c" "s2d"
permutation "s1a" "s2a" "s1b" "s2b" "s1c" "s2c" "s1d" "s2d"
permutation "s1a" "s2a" "s1b" "s2b" "s2c" "s1c" "s1d" "s2d"
permutation "s1a" "s2a" "s2b" "s1b" "s1c" "s1d" "s2c" "s2d"
permutation "s1a" "s2a" "s2b" "s1b" "s1c" "s2c" "s1d" "s2d"
permutation "s1a" "s2a" "s2b" "s1b" "s2c" "s1c" "s1d" "s2d"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s1c" "s1d" "s2d"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s1c" "s2d" "s1d"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s2d" "s1c" "s1d"
permutation "s1a" "s2a" "s2b" "s2c" "s2d" "s1b" "s1c" "s1d"
permutation "s2a" "s1a" "s1b" "s1c" "s1d" "s2b" "s2c" "s2d"
permutation "s2a" "s1a" "s1b" "s1c" "s2b" "s1d" "s2c" "s2d"
permutation "s2a" "s1a" "s1b" "s1c" "s2b" "s2c" "s1d" "s2d"
permutation "s2a" "s1a" "s1b" "s2b" "s1c" "s1d" "s2c" "s2d"
permutation "s2a" "s1a" "s1b" "s2b" "s1c" "s2c" "s1d" "s2d"
permutation "s2a" "s1a" "s1b" "s2b" "s2c" "s1c" "s1d" "s2d"
permutation "s2a" "s1a" "s2b" "s1b" "s1c" "s1d" "s2c" "s2d"
permutation "s2a" "s1a" "s2b" "s1b" "s1c" "s2c" "s1d" "s2d"
permutation "s2a" "s1a" "s2b" "s1b" "s2c" "s1c" "s1d" "s2d"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s1c" "s1d" "s2d"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s1c" "s2d" "s1d"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s2d" "s1c" "s1d"
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s1b" "s1c" "s1d"
permutation "s2a" "s2b" "s1a" "s1b" "s1c" "s1d" "s2c" "s2d"
permutation "s2a" "s2b" "s1a" "s1b" "s1c" "s2c" "s1d" "s2d"
permutation "s2a" "s2b" "s1a" "s1b" "s2c" "s1c" "s1d" "s2d"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s1c" "s1d" "s2d"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s1c" "s2d" "s1d"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s2d" "s1c" "s1d"
permutation "s2a" "s2b" "s1a" "s2c" "s2d" "s1b" "s1c" "s1d"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s1c" "s1d" "s2d"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s1c" "s2d" "s1d"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s2d" "s1c" "s1d"
permutation "s2a" "s2b" "s2c" "s1a" "s2d" "s1b" "s1c" "s1d"
permutation "s2a" "s2b" "s2c" "s2d" "s1a" "s1b" "s1c" "s1d"
permutation s1a s1b s1c s1d s2a s2b s2c s2d
permutation s1a s1b s1c s2a s1d s2b s2c s2d
permutation s1a s1b s1c s2a s2b s1d s2c s2d
permutation s1a s1b s1c s2a s2b s2c s1d s2d
permutation s1a s1b s2a s1c s1d s2b s2c s2d
permutation s1a s1b s2a s1c s2b s1d s2c s2d
permutation s1a s1b s2a s1c s2b s2c s1d s2d
permutation s1a s1b s2a s2b s1c s1d s2c s2d
permutation s1a s1b s2a s2b s1c s2c s1d s2d
permutation s1a s1b s2a s2b s2c s1c s1d s2d
permutation s1a s2a s1b s1c s1d s2b s2c s2d
permutation s1a s2a s1b s1c s2b s1d s2c s2d
permutation s1a s2a s1b s1c s2b s2c s1d s2d
permutation s1a s2a s1b s2b s1c s1d s2c s2d
permutation s1a s2a s1b s2b s1c s2c s1d s2d
permutation s1a s2a s1b s2b s2c s1c s1d s2d
permutation s1a s2a s2b s1b s1c s1d s2c s2d
permutation s1a s2a s2b s1b s1c s2c s1d s2d
permutation s1a s2a s2b s1b s2c s1c s1d s2d
permutation s1a s2a s2b s2c s1b s1c s1d s2d
permutation s1a s2a s2b s2c s1b s1c s2d s1d
permutation s1a s2a s2b s2c s1b s2d s1c s1d
permutation s1a s2a s2b s2c s2d s1b s1c s1d
permutation s2a s1a s1b s1c s1d s2b s2c s2d
permutation s2a s1a s1b s1c s2b s1d s2c s2d
permutation s2a s1a s1b s1c s2b s2c s1d s2d
permutation s2a s1a s1b s2b s1c s1d s2c s2d
permutation s2a s1a s1b s2b s1c s2c s1d s2d
permutation s2a s1a s1b s2b s2c s1c s1d s2d
permutation s2a s1a s2b s1b s1c s1d s2c s2d
permutation s2a s1a s2b s1b s1c s2c s1d s2d
permutation s2a s1a s2b s1b s2c s1c s1d s2d
permutation s2a s1a s2b s2c s1b s1c s1d s2d
permutation s2a s1a s2b s2c s1b s1c s2d s1d
permutation s2a s1a s2b s2c s1b s2d s1c s1d
permutation s2a s1a s2b s2c s2d s1b s1c s1d
permutation s2a s2b s1a s1b s1c s1d s2c s2d
permutation s2a s2b s1a s1b s1c s2c s1d s2d
permutation s2a s2b s1a s1b s2c s1c s1d s2d
permutation s2a s2b s1a s2c s1b s1c s1d s2d
permutation s2a s2b s1a s2c s1b s1c s2d s1d
permutation s2a s2b s1a s2c s1b s2d s1c s1d
permutation s2a s2b s1a s2c s2d s1b s1c s1d
permutation s2a s2b s2c s1a s1b s1c s1d s2d
permutation s2a s2b s2c s1a s1b s1c s2d s1d
permutation s2a s2b s2c s1a s1b s2d s1c s1d
permutation s2a s2b s2c s1a s2d s1b s1c s1d
permutation s2a s2b s2c s2d s1a s1b s1c s1d

View File

@ -15,23 +15,23 @@ teardown
DROP TABLE IF EXISTS c1, c2, p;
}
session "s1"
step "s1b" { BEGIN; }
step "s1delc1" { ALTER TABLE c1 NO INHERIT p; }
step "s1modc1a" { ALTER TABLE c1 ALTER COLUMN a TYPE float; }
step "s1addc2" { ALTER TABLE c2 INHERIT p; }
step "s1dropc1" { DROP TABLE c1; }
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN; }
step s1delc1 { ALTER TABLE c1 NO INHERIT p; }
step s1modc1a { ALTER TABLE c1 ALTER COLUMN a TYPE float; }
step s1addc2 { ALTER TABLE c2 INHERIT p; }
step s1dropc1 { DROP TABLE c1; }
step s1c { COMMIT; }
session "s2"
step "s2sel" { SELECT SUM(a) FROM p; }
session s2
step s2sel { SELECT SUM(a) FROM p; }
# NO INHERIT will not be visible to concurrent select,
# since we identify children before locking them
permutation "s1b" "s1delc1" "s2sel" "s1c" "s2sel"
permutation s1b s1delc1 s2sel s1c s2sel
# adding inheritance likewise is not seen if s1 commits after s2 locks p
permutation "s1b" "s1delc1" "s1addc2" "s2sel" "s1c" "s2sel"
permutation s1b s1delc1 s1addc2 s2sel s1c s2sel
# but we do cope with DROP on a child table
permutation "s1b" "s1dropc1" "s2sel" "s1c" "s2sel"
permutation s1b s1dropc1 s2sel s1c s2sel
# this case currently results in an error; doesn't seem worth preventing
permutation "s1b" "s1delc1" "s1modc1a" "s2sel" "s1c" "s2sel"
permutation s1b s1delc1 s1modc1a s2sel s1c s2sel

View File

@ -5,15 +5,15 @@
# Note we assume that each step is delivered to the backend as a single Query
# message so it will run as one transaction.
session "notifier"
step "listenc" { LISTEN c1; LISTEN c2; }
step "notify1" { NOTIFY c1; }
step "notify2" { NOTIFY c2, 'payload'; }
step "notify3" { NOTIFY c3, 'payload3'; } # not listening to c3
step "notifyf" { SELECT pg_notify('c2', NULL); }
step "notifyd1" { NOTIFY c2, 'payload'; NOTIFY c1; NOTIFY "c2", 'payload'; }
step "notifyd2" { NOTIFY c1; NOTIFY c1; NOTIFY c1, 'p1'; NOTIFY c1, 'p2'; }
step "notifys1" {
session notifier
step listenc { LISTEN c1; LISTEN c2; }
step notify1 { NOTIFY c1; }
step notify2 { NOTIFY c2, 'payload'; }
step notify3 { NOTIFY c3, 'payload3'; } # not listening to c3
step notifyf { SELECT pg_notify('c2', NULL); }
step notifyd1 { NOTIFY c2, 'payload'; NOTIFY c1; NOTIFY "c2", 'payload'; }
step notifyd2 { NOTIFY c1; NOTIFY c1; NOTIFY c1, 'p1'; NOTIFY c1, 'p2'; }
step notifys1 {
BEGIN;
NOTIFY c1, 'payload'; NOTIFY "c2", 'payload';
NOTIFY c1, 'payload'; NOTIFY "c2", 'payload';
@ -31,47 +31,47 @@ step "notifys1" {
ROLLBACK TO SAVEPOINT s2;
COMMIT;
}
step "usage" { SELECT pg_notification_queue_usage() > 0 AS nonzero; }
step "bignotify" { SELECT count(pg_notify('c1', s::text)) FROM generate_series(1, 1000) s; }
step usage { SELECT pg_notification_queue_usage() > 0 AS nonzero; }
step bignotify { SELECT count(pg_notify('c1', s::text)) FROM generate_series(1, 1000) s; }
teardown { UNLISTEN *; }
# The listener session is used for cross-backend notify checks.
session "listener"
step "llisten" { LISTEN c1; LISTEN c2; }
step "lcheck" { SELECT 1 AS x; }
step "lbegin" { BEGIN; }
step "lbegins" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "lcommit" { COMMIT; }
session listener
step llisten { LISTEN c1; LISTEN c2; }
step lcheck { SELECT 1 AS x; }
step lbegin { BEGIN; }
step lbegins { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step lcommit { COMMIT; }
teardown { UNLISTEN *; }
# In some tests we need a second listener, just to block the queue.
session "listener2"
step "l2listen" { LISTEN c1; }
step "l2begin" { BEGIN; }
step "l2commit" { COMMIT; }
step "l2stop" { UNLISTEN *; }
session listener2
step l2listen { LISTEN c1; }
step l2begin { BEGIN; }
step l2commit { COMMIT; }
step l2stop { UNLISTEN *; }
# Trivial cases.
permutation "listenc" "notify1" "notify2" "notify3" "notifyf"
permutation listenc notify1 notify2 notify3 notifyf
# Check simple and less-simple deduplication.
permutation "listenc" "notifyd1" "notifyd2" "notifys1"
permutation listenc notifyd1 notifyd2 notifys1
# Cross-backend notification delivery. We use a "select 1" to force the
# listener session to check for notifies. In principle we could just wait
# for delivery, but that would require extra support in isolationtester
# and might have portability-of-timing issues.
permutation "llisten" "notify1" "notify2" "notify3" "notifyf" "lcheck"
permutation llisten notify1 notify2 notify3 notifyf lcheck
# Again, with local delivery too.
permutation "listenc" "llisten" "notify1" "notify2" "notify3" "notifyf" "lcheck"
permutation listenc llisten notify1 notify2 notify3 notifyf lcheck
# Check for bug when initial listen is only action in a serializable xact,
# and notify queue is not empty
permutation "l2listen" "l2begin" "notify1" "lbegins" "llisten" "lcommit" "l2commit" "l2stop"
permutation l2listen l2begin notify1 lbegins llisten lcommit l2commit l2stop
# Verify that pg_notification_queue_usage correctly reports a non-zero result,
# after submitting notifications while another connection is listening for
@ -81,4 +81,4 @@ permutation "l2listen" "l2begin" "notify1" "lbegins" "llisten" "lcommit" "l2comm
# commit the listener's transaction, so that it never reports these events.
# Hence, this should be the last test in this script.
permutation "llisten" "lbegin" "usage" "bignotify" "usage"
permutation llisten lbegin usage bignotify usage

View File

@ -16,14 +16,14 @@ teardown
DROP TABLE room_reservation;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx1" { SELECT count(*) FROM room_reservation WHERE room_id = '101' AND start_time < TIMESTAMP WITH TIME ZONE '2010-04-01 14:00' AND end_time > TIMESTAMP WITH TIME ZONE '2010-04-01 13:00'; }
step "wy1" { INSERT INTO room_reservation VALUES ('101', TIMESTAMP WITH TIME ZONE '2010-04-01 13:00', TIMESTAMP WITH TIME ZONE '2010-04-01 14:00', 'Carol'); }
step "c1" { COMMIT; }
step rx1 { SELECT count(*) FROM room_reservation WHERE room_id = '101' AND start_time < TIMESTAMP WITH TIME ZONE '2010-04-01 14:00' AND end_time > TIMESTAMP WITH TIME ZONE '2010-04-01 13:00'; }
step wy1 { INSERT INTO room_reservation VALUES ('101', TIMESTAMP WITH TIME ZONE '2010-04-01 13:00', TIMESTAMP WITH TIME ZONE '2010-04-01 14:00', 'Carol'); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "ry2" { SELECT count(*) FROM room_reservation WHERE room_id = '101' AND start_time < TIMESTAMP WITH TIME ZONE '2010-04-01 14:30' AND end_time > TIMESTAMP WITH TIME ZONE '2010-04-01 13:30'; }
step "wx2" { UPDATE room_reservation SET start_time = TIMESTAMP WITH TIME ZONE '2010-04-01 13:30', end_time = TIMESTAMP WITH TIME ZONE '2010-04-01 14:30' WHERE room_id = '101' AND start_time = TIMESTAMP WITH TIME ZONE '2010-04-01 10:00'; }
step "c2" { COMMIT; }
step ry2 { SELECT count(*) FROM room_reservation WHERE room_id = '101' AND start_time < TIMESTAMP WITH TIME ZONE '2010-04-01 14:30' AND end_time > TIMESTAMP WITH TIME ZONE '2010-04-01 13:30'; }
step wx2 { UPDATE room_reservation SET start_time = TIMESTAMP WITH TIME ZONE '2010-04-01 13:30', end_time = TIMESTAMP WITH TIME ZONE '2010-04-01 14:30' WHERE room_id = '101' AND start_time = TIMESTAMP WITH TIME ZONE '2010-04-01 10:00'; }
step c2 { COMMIT; }

View File

@ -16,39 +16,39 @@ teardown
DROP FUNCTION f();
}
session "s1"
step "s1a" { BEGIN; }
step "s1b" { CREATE TRIGGER t AFTER UPDATE ON a EXECUTE PROCEDURE f(); }
step "s1c" { COMMIT; }
session s1
step s1a { BEGIN; }
step s1b { CREATE TRIGGER t AFTER UPDATE ON a EXECUTE PROCEDURE f(); }
step s1c { COMMIT; }
session "s2"
step "s2a" { BEGIN; }
step "s2b" { SELECT * FROM a WHERE i = 1 FOR UPDATE; }
step "s2c" { UPDATE a SET i = 4 WHERE i = 3; }
step "s2d" { COMMIT; }
session s2
step s2a { BEGIN; }
step s2b { SELECT * FROM a WHERE i = 1 FOR UPDATE; }
step s2c { UPDATE a SET i = 4 WHERE i = 3; }
step s2d { COMMIT; }
permutation "s1a" "s1b" "s1c" "s2a" "s2b" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s1c" "s2b" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s2b" "s1c" "s2c" "s2d"
permutation "s1a" "s1b" "s2a" "s2b" "s2c" "s1c" "s2d"
permutation "s1a" "s2a" "s1b" "s1c" "s2b" "s2c" "s2d"
permutation "s1a" "s2a" "s1b" "s2b" "s1c" "s2c" "s2d"
permutation "s1a" "s2a" "s1b" "s2b" "s2c" "s1c" "s2d"
permutation "s1a" "s2a" "s2b" "s1b" "s1c" "s2c" "s2d"
permutation "s1a" "s2a" "s2b" "s1b" "s2c" "s1c" "s2d"
permutation "s1a" "s2a" "s2b" "s2c" "s1b" "s2d" "s1c"
permutation "s1a" "s2a" "s2b" "s2c" "s2d" "s1b" "s1c"
permutation "s2a" "s1a" "s1b" "s1c" "s2b" "s2c" "s2d"
permutation "s2a" "s1a" "s1b" "s2b" "s1c" "s2c" "s2d"
permutation "s2a" "s1a" "s1b" "s2b" "s2c" "s1c" "s2d"
permutation "s2a" "s1a" "s2b" "s1b" "s1c" "s2c" "s2d"
permutation "s2a" "s1a" "s2b" "s1b" "s2c" "s1c" "s2d"
permutation "s2a" "s1a" "s2b" "s2c" "s1b" "s2d" "s1c"
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s1b" "s1c"
permutation "s2a" "s2b" "s1a" "s1b" "s1c" "s2c" "s2d"
permutation "s2a" "s2b" "s1a" "s1b" "s2c" "s1c" "s2d"
permutation "s2a" "s2b" "s1a" "s2c" "s1b" "s2d" "s1c"
permutation "s2a" "s2b" "s1a" "s2c" "s2d" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s1a" "s1b" "s2d" "s1c"
permutation "s2a" "s2b" "s2c" "s1a" "s2d" "s1b" "s1c"
permutation "s2a" "s2b" "s2c" "s2d" "s1a" "s1b" "s1c"
permutation s1a s1b s1c s2a s2b s2c s2d
permutation s1a s1b s2a s1c s2b s2c s2d
permutation s1a s1b s2a s2b s1c s2c s2d
permutation s1a s1b s2a s2b s2c s1c s2d
permutation s1a s2a s1b s1c s2b s2c s2d
permutation s1a s2a s1b s2b s1c s2c s2d
permutation s1a s2a s1b s2b s2c s1c s2d
permutation s1a s2a s2b s1b s1c s2c s2d
permutation s1a s2a s2b s1b s2c s1c s2d
permutation s1a s2a s2b s2c s1b s2d s1c
permutation s1a s2a s2b s2c s2d s1b s1c
permutation s2a s1a s1b s1c s2b s2c s2d
permutation s2a s1a s1b s2b s1c s2c s2d
permutation s2a s1a s1b s2b s2c s1c s2d
permutation s2a s1a s2b s1b s1c s2c s2d
permutation s2a s1a s2b s1b s2c s1c s2d
permutation s2a s1a s2b s2c s1b s2d s1c
permutation s2a s1a s2b s2c s2d s1b s1c
permutation s2a s2b s1a s1b s1c s2c s2d
permutation s2a s2b s1a s1b s2c s1c s2d
permutation s2a s2b s1a s2c s1b s2d s1c
permutation s2a s2b s1a s2c s2d s1b s1c
permutation s2a s2b s2c s1a s1b s2d s1c
permutation s2a s2b s2c s1a s2d s1b s1c
permutation s2a s2b s2c s2d s1a s1b s1c

View File

@ -20,53 +20,53 @@ teardown
DROP TABLE a1, a2, a3, a4, a5, a6, a7, a8;
}
session "s1"
session s1
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s1a1" { LOCK TABLE a1; }
step "s1a2" { LOCK TABLE a2; }
step "s1c" { COMMIT; }
step s1a1 { LOCK TABLE a1; }
step s1a2 { LOCK TABLE a2; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s2a2" { LOCK TABLE a2; }
step "s2a3" { LOCK TABLE a3; }
step "s2c" { COMMIT; }
step s2a2 { LOCK TABLE a2; }
step s2a3 { LOCK TABLE a3; }
step s2c { COMMIT; }
session "s3"
session s3
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s3a3" { LOCK TABLE a3; }
step "s3a4" { LOCK TABLE a4; }
step "s3c" { COMMIT; }
step s3a3 { LOCK TABLE a3; }
step s3a4 { LOCK TABLE a4; }
step s3c { COMMIT; }
session "s4"
session s4
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s4a4" { LOCK TABLE a4; }
step "s4a5" { LOCK TABLE a5; }
step "s4c" { COMMIT; }
step s4a4 { LOCK TABLE a4; }
step s4a5 { LOCK TABLE a5; }
step s4c { COMMIT; }
session "s5"
session s5
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s5a5" { LOCK TABLE a5; }
step "s5a6" { LOCK TABLE a6; }
step "s5c" { COMMIT; }
step s5a5 { LOCK TABLE a5; }
step s5a6 { LOCK TABLE a6; }
step s5c { COMMIT; }
session "s6"
session s6
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s6a6" { LOCK TABLE a6; }
step "s6a7" { LOCK TABLE a7; }
step "s6c" { COMMIT; }
step s6a6 { LOCK TABLE a6; }
step s6a7 { LOCK TABLE a7; }
step s6c { COMMIT; }
session "s7"
session s7
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s7a7" { LOCK TABLE a7; }
step "s7a8" { LOCK TABLE a8; }
step "s7c" { COMMIT; }
step s7a7 { LOCK TABLE a7; }
step s7a8 { LOCK TABLE a8; }
step s7c { COMMIT; }
session "s8"
session s8
setup { BEGIN; SET deadlock_timeout = '10ms'; }
step "s8a8" { LOCK TABLE a8; }
step "s8a1" { LOCK TABLE a1; }
step "s8c" { COMMIT; }
step s8a8 { LOCK TABLE a8; }
step s8a1 { LOCK TABLE a1; }
step s8c { COMMIT; }
# Note: when s8a1 detects the deadlock and fails, s7a8 is released, making
# it timing-dependent which query completion is received first by the tester.
@ -76,4 +76,4 @@ step "s8c" { COMMIT; }
# dummy blocking mark to s8a1 to ensure it will be reported as "waiting"
# regardless of that.
permutation "s1a1" "s2a2" "s3a3" "s4a4" "s5a5" "s6a6" "s7a7" "s8a8" "s1a2" "s2a3" "s3a4" "s4a5" "s5a6" "s6a7" "s7a8"("s8a1") "s8a1"(*) "s8c" "s7c" "s6c" "s5c" "s4c" "s3c" "s2c" "s1c"
permutation s1a1 s2a2 s3a3 s4a4 s5a5 s6a6 s7a7 s8a8 s1a2 s2a3 s3a4 s4a5 s5a6 s6a7 s7a8(s8a1) s8a1(*) s8c s7c s6c s5c s4c s3c s2c s1c

View File

@ -14,16 +14,16 @@ teardown
DROP TABLE a1;
}
session "s1"
session s1
setup { BEGIN; }
step "s1as" { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step "s1ae" { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step "s1c" { COMMIT; }
step s1as { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step s1ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2as" { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step "s2ae" { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step "s2c" { COMMIT; }
step s2as { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step s2ae { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step s2c { COMMIT; }
permutation "s1as" "s2as" "s1ae" "s2ae" "s1c" "s2c"
permutation s1as s2as s1ae s2ae s1c s2c

View File

@ -13,31 +13,31 @@ teardown
DROP TABLE a1, a2;
}
session "s1"
session s1
setup { BEGIN; SET deadlock_timeout = '10ms'; }
step "s1a" { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
step "s1b" { LOCK TABLE a2 IN SHARE UPDATE EXCLUSIVE MODE; }
step "s1c" { COMMIT; }
step s1a { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
step s1b { LOCK TABLE a2 IN SHARE UPDATE EXCLUSIVE MODE; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s2a" { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step "s2b" { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
step "s2c" { COMMIT; }
step s2a { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step s2b { LOCK TABLE a1 IN SHARE UPDATE EXCLUSIVE MODE; }
step s2c { COMMIT; }
session "s3"
session s3
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s3a" { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step "s3c" { COMMIT; }
step s3a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step s3c { COMMIT; }
session "s4"
session s4
setup { BEGIN; SET deadlock_timeout = '100s'; }
step "s4a" { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step "s4c" { COMMIT; }
step s4a { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step s4c { COMMIT; }
# The expected output for this test assumes that isolationtester will
# detect step s1b as waiting before the deadlock detector runs and
# releases s1 from its blocked state. To ensure that happens even in
# very slow (CLOBBER_CACHE_ALWAYS) cases, apply a (*) annotation.
permutation "s1a" "s2a" "s2b" "s3a" "s4a" "s1b"(*) "s1c" "s2c" "s3c" "s4c"
permutation s1a s2a s2b s3a s4a s1b(*) s1c s2c s3c s4c

View File

@ -15,26 +15,26 @@ teardown
DROP TABLE a1, a2;
}
session "d1"
session d1
setup { BEGIN; SET deadlock_timeout = '10s'; }
step "d1a1" { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step "d1a2" { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step "d1c" { COMMIT; }
step d1a1 { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step d1a2 { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step d1c { COMMIT; }
session "d2"
session d2
setup { BEGIN; SET deadlock_timeout = '10ms'; }
step "d2a2" { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step "d2a1" { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step "d2c" { COMMIT; }
step d2a2 { LOCK TABLE a2 IN ACCESS SHARE MODE; }
step d2a1 { LOCK TABLE a1 IN ACCESS SHARE MODE; }
step d2c { COMMIT; }
session "e1"
session e1
setup { BEGIN; SET deadlock_timeout = '10s'; }
step "e1l" { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step "e1c" { COMMIT; }
step e1l { LOCK TABLE a1 IN ACCESS EXCLUSIVE MODE; }
step e1c { COMMIT; }
session "e2"
session e2
setup { BEGIN; SET deadlock_timeout = '10s'; }
step "e2l" { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step "e2c" { COMMIT; }
step e2l { LOCK TABLE a2 IN ACCESS EXCLUSIVE MODE; }
step e2c { COMMIT; }
permutation "d1a1" "d2a2" "e1l" "e2l" "d1a2" "d2a1" "d1c" "e1c" "d2c" "e2c"
permutation d1a1 d2a2 e1l e2l d1a2 d2a1 d1c e1c d2c e2c

View File

@ -14,21 +14,21 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1l" { SELECT * FROM foo FOR KEY SHARE; }
step "s1svp" { SAVEPOINT f; }
step "s1d" { SELECT * FROM foo FOR NO KEY UPDATE; }
step "s1r" { ROLLBACK TO f; }
step "s1c" { COMMIT; }
step s1l { SELECT * FROM foo FOR KEY SHARE; }
step s1svp { SAVEPOINT f; }
step s1d { SELECT * FROM foo FOR NO KEY UPDATE; }
step s1r { ROLLBACK TO f; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2l" { SELECT * FROM foo FOR UPDATE; }
step "s2l2" { SELECT * FROM foo FOR NO KEY UPDATE; }
step "s2c" { COMMIT; }
step s2l { SELECT * FROM foo FOR UPDATE; }
step s2l2 { SELECT * FROM foo FOR NO KEY UPDATE; }
step s2c { COMMIT; }
permutation "s1l" "s1svp" "s1d" "s1r" "s2l" "s1c" "s2c"
permutation "s1l" "s1svp" "s1d" "s2l" "s1r" "s1c" "s2c"
permutation "s1l" "s1svp" "s1d" "s1r" "s2l2" "s1c" "s2c"
permutation "s1l" "s1svp" "s1d" "s2l2" "s1r" "s1c" "s2c"
permutation s1l s1svp s1d s1r s2l s1c s2c
permutation s1l s1svp s1d s2l s1r s1c s2c
permutation s1l s1svp s1d s1r s2l2 s1c s2c
permutation s1l s1svp s1d s2l2 s1r s1c s2c

View File

@ -15,23 +15,23 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1l" { SELECT * FROM foo FOR KEY SHARE; }
step "s1svp" { SAVEPOINT f; }
step "s1d" { DELETE FROM foo; }
step "s1r" { ROLLBACK TO f; }
step "s1c" { COMMIT; }
step s1l { SELECT * FROM foo FOR KEY SHARE; }
step s1svp { SAVEPOINT f; }
step s1d { DELETE FROM foo; }
step s1r { ROLLBACK TO f; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2l" { SELECT * FROM foo FOR UPDATE; }
step "s2c" { COMMIT; }
step s2l { SELECT * FROM foo FOR UPDATE; }
step s2c { COMMIT; }
permutation "s1l" "s1svp" "s1d" "s1r" "s1c" "s2l" "s2c"
permutation "s1l" "s1svp" "s1d" "s1r" "s2l" "s1c" "s2c"
permutation "s1l" "s1svp" "s1d" "s2l" "s1r" "s1c" "s2c"
permutation "s1l" "s1svp" "s2l" "s1d" "s1r" "s1c" "s2c"
permutation "s1l" "s2l" "s1svp" "s1d" "s1r" "s1c" "s2c"
permutation "s2l" "s1l" "s2c" "s1svp" "s1d" "s1r" "s1c"
permutation "s2l" "s2c" "s1l" "s1svp" "s1d" "s1r" "s1c"
permutation s1l s1svp s1d s1r s1c s2l s2c
permutation s1l s1svp s1d s1r s2l s1c s2c
permutation s1l s1svp s1d s2l s1r s1c s2c
permutation s1l s1svp s2l s1d s1r s1c s2c
permutation s1l s2l s1svp s1d s1r s1c s2c
permutation s2l s1l s2c s1svp s1d s1r s1c
permutation s2l s2c s1l s1svp s1d s1r s1c

View File

@ -17,25 +17,25 @@ teardown
DROP TABLE test_dc;
}
session "s1"
step "noseq" { SET enable_seqscan = false; }
step "chkiso" { SELECT (setting in ('read committed','read uncommitted')) AS is_read_committed FROM pg_settings WHERE name = 'default_transaction_isolation'; }
step "prepi" { PREPARE getrow_idx AS SELECT * FROM test_dc WHERE data=34 ORDER BY id,data; }
step "preps" { PREPARE getrow_seq AS SELECT * FROM test_dc WHERE data::text=34::text ORDER BY id,data; }
step "begin" { BEGIN; }
step "explaini" { EXPLAIN (COSTS OFF) EXECUTE getrow_idx; }
step "explains" { EXPLAIN (COSTS OFF) EXECUTE getrow_seq; }
step "selecti" { EXECUTE getrow_idx; }
step "selects" { EXECUTE getrow_seq; }
step "end" { COMMIT; }
session s1
step noseq { SET enable_seqscan = false; }
step chkiso { SELECT (setting in ('read committed','read uncommitted')) AS is_read_committed FROM pg_settings WHERE name = 'default_transaction_isolation'; }
step prepi { PREPARE getrow_idx AS SELECT * FROM test_dc WHERE data=34 ORDER BY id,data; }
step preps { PREPARE getrow_seq AS SELECT * FROM test_dc WHERE data::text=34::text ORDER BY id,data; }
step begin { BEGIN; }
step explaini { EXPLAIN (COSTS OFF) EXECUTE getrow_idx; }
step explains { EXPLAIN (COSTS OFF) EXECUTE getrow_seq; }
step selecti { EXECUTE getrow_idx; }
step selects { EXECUTE getrow_seq; }
step end { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "select2" { SELECT * FROM test_dc WHERE data=34 ORDER BY id,data; }
step "insert2" { INSERT INTO test_dc(data) SELECT * FROM generate_series(1, 100); }
step "end2" { COMMIT; }
step select2 { SELECT * FROM test_dc WHERE data=34 ORDER BY id,data; }
step insert2 { INSERT INTO test_dc(data) SELECT * FROM generate_series(1, 100); }
step end2 { COMMIT; }
session "s3"
step "drop" { DROP INDEX CONCURRENTLY test_dc_data; }
session s3
step drop { DROP INDEX CONCURRENTLY test_dc_data; }
permutation "noseq" "chkiso" "prepi" "preps" "begin" "explaini" "explains" "select2" "drop" "insert2" "end2" "selecti" "selects" "end"
permutation noseq chkiso prepi preps begin explaini explains select2 drop insert2 end2 selecti selects end

View File

@ -54,53 +54,53 @@ teardown
}
session "s0"
step "s0_rep" { SELECT * FROM trigtest ORDER BY key, data }
session s0
step s0_rep { SELECT * FROM trigtest ORDER BY key, data }
session "s1"
session s1
#setup { }
step "s1_b_rc" { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
step "s1_b_rr" { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1; }
step "s1_c" { COMMIT; }
step "s1_r" { ROLLBACK; }
step "s1_trig_rep_b_i" { CREATE TRIGGER rep_b_i BEFORE INSERT ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_trig_rep_a_i" { CREATE TRIGGER rep_a_i AFTER INSERT ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_trig_rep_b_u" { CREATE TRIGGER rep_b_u BEFORE UPDATE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_trig_rep_a_u" { CREATE TRIGGER rep_a_u AFTER UPDATE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_trig_rep_b_d" { CREATE TRIGGER rep_b_d BEFORE DELETE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_trig_rep_a_d" { CREATE TRIGGER rep_a_d AFTER DELETE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step "s1_ins_a" { INSERT INTO trigtest VALUES ('key-a', 'val-a-s1') RETURNING *; }
step "s1_ins_b" { INSERT INTO trigtest VALUES ('key-b', 'val-b-s1') RETURNING *; }
step "s1_ins_c" { INSERT INTO trigtest VALUES ('key-c', 'val-c-s1') RETURNING *; }
step "s1_del_a" {
step s1_b_rc { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
step s1_b_rr { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1; }
step s1_c { COMMIT; }
step s1_r { ROLLBACK; }
step s1_trig_rep_b_i { CREATE TRIGGER rep_b_i BEFORE INSERT ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_trig_rep_a_i { CREATE TRIGGER rep_a_i AFTER INSERT ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_trig_rep_b_u { CREATE TRIGGER rep_b_u BEFORE UPDATE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_trig_rep_a_u { CREATE TRIGGER rep_a_u AFTER UPDATE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_trig_rep_b_d { CREATE TRIGGER rep_b_d BEFORE DELETE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_trig_rep_a_d { CREATE TRIGGER rep_a_d AFTER DELETE ON trigtest FOR EACH ROW EXECUTE PROCEDURE trig_report(); }
step s1_ins_a { INSERT INTO trigtest VALUES ('key-a', 'val-a-s1') RETURNING *; }
step s1_ins_b { INSERT INTO trigtest VALUES ('key-b', 'val-b-s1') RETURNING *; }
step s1_ins_c { INSERT INTO trigtest VALUES ('key-c', 'val-c-s1') RETURNING *; }
step s1_del_a {
DELETE FROM trigtest
WHERE
noisy_oper('upd', key, '=', 'key-a') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *
}
step "s1_del_b" {
step s1_del_b {
DELETE FROM trigtest
WHERE
noisy_oper('upd', key, '=', 'key-b') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *
}
step "s1_upd_a_data" {
step s1_upd_a_data {
UPDATE trigtest SET data = data || '-ups1'
WHERE
noisy_oper('upd', key, '=', 'key-a') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *;
}
step "s1_upd_b_data" {
step s1_upd_b_data {
UPDATE trigtest SET data = data || '-ups1'
WHERE
noisy_oper('upd', key, '=', 'key-b') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *;
}
step "s1_upd_a_tob" {
step s1_upd_a_tob {
UPDATE trigtest SET key = 'key-b', data = data || '-tobs1'
WHERE
noisy_oper('upk', key, '=', 'key-a') AND
@ -108,42 +108,42 @@ step "s1_upd_a_tob" {
RETURNING *;
}
session "s2"
session s2
#setup { }
step "s2_b_rc" { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
step "s2_b_rr" { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1; }
step "s2_c" { COMMIT; }
#step "s2_r" { ROLLBACK; }
step "s2_ins_a" { INSERT INTO trigtest VALUES ('key-a', 'val-a-s2') RETURNING *; }
step "s2_del_a" {
step s2_b_rc { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
step s2_b_rr { BEGIN ISOLATION LEVEL REPEATABLE READ; SELECT 1; }
step s2_c { COMMIT; }
#step s2_r { ROLLBACK; }
step s2_ins_a { INSERT INTO trigtest VALUES ('key-a', 'val-a-s2') RETURNING *; }
step s2_del_a {
DELETE FROM trigtest
WHERE
noisy_oper('upd', key, '=', 'key-a') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *
}
step "s2_upd_a_data" {
step s2_upd_a_data {
UPDATE trigtest SET data = data || '-ups2'
WHERE
noisy_oper('upd', key, '=', 'key-a') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *;
}
step "s2_upd_b_data" {
step s2_upd_b_data {
UPDATE trigtest SET data = data || '-ups2'
WHERE
noisy_oper('upd', key, '=', 'key-b') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *;
}
step "s2_upd_all_data" {
step s2_upd_all_data {
UPDATE trigtest SET data = data || '-ups2'
WHERE
noisy_oper('upd', key, '<>', 'mismatch') AND
noisy_oper('upk', data, '<>', 'mismatch')
RETURNING *;
}
step "s2_upsert_a_data" {
step s2_upsert_a_data {
INSERT INTO trigtest VALUES ('key-a', 'val-a-upss2')
ON CONFLICT (key)
DO UPDATE SET data = trigtest.data || '-upserts2'
@ -153,19 +153,19 @@ step "s2_upsert_a_data" {
RETURNING *;
}
#session "s3"
#session s3
#setup { }
#step "s3_b_rc" { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
#step "s3_c" { COMMIT; }
#step "s3_r" { ROLLBACK; }
#step "s3_del_a" {
#step s3_b_rc { BEGIN ISOLATION LEVEL READ COMMITTED; SELECT 1; }
#step s3_c { COMMIT; }
#step s3_r { ROLLBACK; }
#step s3_del_a {
# DELETE FROM trigtest
# WHERE
# noisy_oper('upd', key, '=', 'key-a') AND
# noisy_oper('upk', data, '<>', 'mismatch')
# RETURNING *
#}
#step "s3_upd_a_data" {
#step s3_upd_a_data {
# UPDATE trigtest SET data = data || '-ups3'
# WHERE
# noisy_oper('upd', key, '=', 'key-a') AND
@ -175,236 +175,236 @@ step "s2_upsert_a_data" {
### base case verifying that triggers see performed modifications
# s1 updates, s1 commits, s2 updates
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s1_c" "s2_upd_a_data" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s1_c s2_upd_a_data s2_c
s0_rep
# s1 updates, s1 rolls back, s2 updates
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s1_r" "s2_upd_a_data" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s1_r s2_upd_a_data s2_c
s0_rep
# s1 updates, s1 commits back, s2 deletes
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s1_c" "s2_del_a" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s1_c s2_del_a s2_c
s0_rep
# s1 updates, s1 rolls back back, s2 deletes
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s1_r" "s2_del_a" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s1_r s2_del_a s2_c
s0_rep
### Verify EPQ is performed if necessary, and skipped if transaction rolled back
# s1 updates, s2 updates, s1 commits, EPQ
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_c s2_c
s0_rep
# s1 updates, s2 updates, s1 rolls back, no EPQ
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_r s2_c
s0_rep
# s1 updates, s2 deletes, s1 commits, EPQ
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_c s2_c
s0_rep
# s1 updates, s2 deletes, s1 rolls back, no EPQ
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_r s2_c
s0_rep
# s1 deletes, s2 updates, s1 commits, EPQ
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_c s2_c
s0_rep
# s1 deletes, s2 updates, s1 rolls back, no EPQ
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_r s2_c
s0_rep
# s1 inserts, s2 inserts, s1 commits, s2 inserts, unique conflict
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_a_i" "s1_trig_rep_a_d"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s2_ins_a" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_a_i s1_trig_rep_a_d
s1_b_rc s2_b_rc
s1_ins_a s2_ins_a s1_c s2_c
s0_rep
# s1 inserts, s2 inserts, s1 rolls back, s2 inserts, no unique conflict
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_a_i" "s1_trig_rep_a_d"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s2_ins_a" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_a_i s1_trig_rep_a_d
s1_b_rc s2_b_rc
s1_ins_a s2_ins_a s1_r s2_c
s0_rep
# s1 updates, s2 upserts, s1 commits, EPQ
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upsert_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upsert_a_data s1_c s2_c
s0_rep
# s1 updates, s2 upserts, s1 rolls back, no EPQ
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upsert_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upsert_a_data s1_c s2_c
s0_rep
# s1 inserts, s2 upserts, s1 commits
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s2_upsert_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_b_rc s2_b_rc
s1_ins_a s2_upsert_a_data s1_c s2_c
s0_rep
# s1 inserts, s2 upserts, s1 rolls back
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s2_upsert_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_b_rc s2_b_rc
s1_ins_a s2_upsert_a_data s1_r s2_c
s0_rep
# s1 inserts, s2 upserts, s1 updates, s1 commits, EPQ
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s1_upd_a_data" "s2_upsert_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_b_rc s2_b_rc
s1_ins_a s1_upd_a_data s2_upsert_a_data s1_c s2_c
s0_rep
# s1 inserts, s2 upserts, s1 updates, s1 rolls back, no EPQ
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_b_rc" "s2_b_rc"
"s1_ins_a" "s1_upd_a_data" "s2_upsert_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_b_rc s2_b_rc
s1_ins_a s1_upd_a_data s2_upsert_a_data s1_r s2_c
s0_rep
### Verify EPQ is performed if necessary, and skipped if transaction rolled back,
### just without before triggers (for comparison, no additional row locks)
# s1 updates, s2 updates, s1 commits, EPQ
permutation "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_c s2_c
s0_rep
# s1 updates, s2 updates, s1 rolls back, no EPQ
permutation "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_upd_a_data s1_r s2_c
s0_rep
# s1 updates, s2 deletes, s1 commits, EPQ
permutation "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_del_a" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_del_a s1_c s2_c
s0_rep
# s1 updates, s2 deletes, s1 rolls back, no EPQ
permutation "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_upd_a_data" "s2_del_a" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_upd_a_data s2_del_a s1_r s2_c
s0_rep
# s1 deletes, s2 updates, s1 commits, EPQ
permutation "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_c s2_c
s0_rep
# s1 deletes, s2 updates, s1 rolls back, no EPQ
permutation "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_r s2_c
s0_rep
# s1 deletes, s2 deletes, s1 commits, EPQ
permutation "s1_trig_rep_a_d"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_del_a" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_del_a s1_c s2_c
s0_rep
# s1 deletes, s2 deletes, s1 rolls back, no EPQ
permutation "s1_trig_rep_a_d"
"s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_del_a" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_a_d
s1_ins_a s1_ins_b s1_b_rc s2_b_rc
s1_del_a s2_del_a s1_r s2_c
s0_rep
### Verify that an update affecting a row that has been
### updated/deleted to not match the where clause anymore works
### correctly
# s1 updates to different key, s2 updates old key, s1 commits, EPQ failure should lead to no update
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_upd_a_tob" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_upd_a_tob s2_upd_a_data s1_c s2_c
s0_rep
# s1 updates to different key, s2 updates old key, s1 rolls back, no EPQ failure
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_upd_a_tob" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_upd_a_tob s2_upd_a_data s1_r s2_c
s0_rep
# s1 updates to different key, s2 updates new key, s1 commits, s2 will
# not see tuple with new key and not block
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_upd_a_tob" "s2_upd_b_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_upd_a_tob s2_upd_b_data s1_c s2_c
s0_rep
# s1 updates to different key, s2 updates all keys, s1 commits, s2,
# will not see tuple with old key, but block on old, and then follow
# the chain
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_upd_a_tob" "s2_upd_all_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_upd_a_tob s2_upd_all_data s1_c s2_c
s0_rep
# s1 deletes, s2 updates, s1 committs, EPQ failure should lead to no update
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_c s2_c
s0_rep
# s1 deletes, s2 updates, s1 rolls back, no EPQ failure
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_del_a s2_upd_a_data s1_r s2_c
s0_rep
# s1 deletes, s2 deletes, s1 committs, EPQ failure should lead to no delete
permutation "s1_trig_rep_b_d" "s1_trig_rep_a_d"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_del_a" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_a_d
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_del_a s2_del_a s1_c s2_c
s0_rep
# s1 deletes, s2 deletes, s1 rolls back, no EPQ failure
permutation "s1_trig_rep_b_d" "s1_trig_rep_a_d"
"s1_ins_a" "s1_ins_c" "s1_b_rc" "s2_b_rc"
"s1_del_a" "s2_del_a" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_a_d
s1_ins_a s1_ins_c s1_b_rc s2_b_rc
s1_del_a s2_del_a s1_r s2_c
s0_rep
### Verify EPQ with more than two participants works
## XXX: Disable tests, there is some potential for instability here that's not yet fully understood
## s1 updates, s2 updates, s3 updates, s1 commits, s2 EPQ, s2 commits, s3 EPQ
#permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
# "s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc" "s3_b_rc"
# "s1_upd_a_data" "s2_upd_a_data" "s3_upd_a_data" "s1_c" "s2_c" "s3_c"
# "s0_rep"
#permutation s1_trig_rep_b_u s1_trig_rep_a_u
# s1_ins_a s1_ins_b s1_b_rc s2_b_rc s3_b_rc
# s1_upd_a_data s2_upd_a_data s3_upd_a_data s1_c s2_c s3_c
# s0_rep
## s1 updates, s2 updates, s3 updates, s1 commits, s2 EPQ, s2 rolls back, s3 EPQ
#permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
# "s1_ins_a" "s1_ins_b" "s1_b_rc" "s2_b_rc" "s3_b_rc"
# "s1_upd_a_data" "s2_upd_a_data" "s3_upd_a_data" "s1_c" "s2_r" "s3_c"
# "s0_rep"
#permutation s1_trig_rep_b_u s1_trig_rep_a_u
# s1_ins_a s1_ins_b s1_b_rc s2_b_rc s3_b_rc
# s1_upd_a_data s2_upd_a_data s3_upd_a_data s1_c s2_r s3_c
# s0_rep
## s1 updates, s3 updates, s2 upserts, s1 updates, s1 commits, s3 EPQ, s3 deletes, s3 commits, s2 inserts without EPQ recheck
#permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
# "s1_ins_a" "s1_b_rc" "s2_b_rc" "s3_b_rc"
# "s1_upd_a_data" "s3_upd_a_data" "s2_upsert_a_data" "s1_upd_a_data" "s1_c" "s3_del_a" "s3_c" "s2_c"
# "s0_rep"
#permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
# s1_ins_a s1_b_rc s2_b_rc s3_b_rc
# s1_upd_a_data s3_upd_a_data s2_upsert_a_data s1_upd_a_data s1_c s3_del_a s3_c s2_c
# s0_rep
## s1 updates, s3 updates, s2 upserts, s1 updates, s1 commits, s3 EPQ, s3 deletes, s3 rolls back, s2 EPQ
#permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
# "s1_ins_a" "s1_b_rc" "s2_b_rc" "s3_b_rc"
# "s1_upd_a_data" "s3_upd_a_data" "s2_upsert_a_data" "s1_upd_a_data" "s1_c" "s3_del_a" "s3_r" "s2_c"
# "s0_rep"
#permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
# s1_ins_a s1_b_rc s2_b_rc s3_b_rc
# s1_upd_a_data s3_upd_a_data s2_upsert_a_data s1_upd_a_data s1_c s3_del_a s3_r s2_c
# s0_rep
### Document that EPQ doesn't "leap" onto a tuple that would match after blocking
# s1 inserts a, s1 updates b, s2 updates b, s1 deletes b, s1 updates a to b, s1 commits, s2 EPQ finds tuple deleted
permutation "s1_trig_rep_b_i" "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_i" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_b" "s1_b_rc" "s2_b_rc"
"s1_ins_a" "s1_upd_b_data" "s2_upd_b_data" "s1_del_b" "s1_upd_a_tob" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_i s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_i s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_b s1_b_rc s2_b_rc
s1_ins_a s1_upd_b_data s2_upd_b_data s1_del_b s1_upd_a_tob s1_c s2_c
s0_rep
### Triggers for EPQ detect serialization failures
# s1 updates, s2 updates, s1 commits, serialization failure
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rr" "s2_b_rr"
"s1_upd_a_data" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rr s2_b_rr
s1_upd_a_data s2_upd_a_data s1_c s2_c
s0_rep
# s1 updates, s2 updates, s1 rolls back, s2 succeeds
permutation "s1_trig_rep_b_u" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rr" "s2_b_rr"
"s1_upd_a_data" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_u s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rr s2_b_rr
s1_upd_a_data s2_upd_a_data s1_r s2_c
s0_rep
# s1 deletes, s2 updates, s1 commits, serialization failure
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rr" "s2_b_rr"
"s1_del_a" "s2_upd_a_data" "s1_c" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rr s2_b_rr
s1_del_a s2_upd_a_data s1_c s2_c
s0_rep
# s1 deletes, s2 updates, s1 rolls back, s2 succeeds
permutation "s1_trig_rep_b_d" "s1_trig_rep_b_u" "s1_trig_rep_a_d" "s1_trig_rep_a_u"
"s1_ins_a" "s1_ins_b" "s1_b_rr" "s2_b_rr"
"s1_del_a" "s2_upd_a_data" "s1_r" "s2_c"
"s0_rep"
permutation s1_trig_rep_b_d s1_trig_rep_b_u s1_trig_rep_a_d s1_trig_rep_a_u
s1_ins_a s1_ins_b s1_b_rr s2_b_rr
s1_del_a s2_upd_a_data s1_r s2_c
s0_rep

View File

@ -30,14 +30,14 @@ teardown
DROP TABLE table_a, table_b;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
# wx1 then wx2 checks the basic case of re-fetching up-to-date values
step "wx1" { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; }
step wx1 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; }
# wy1 then wy2 checks the case where quals pass then fail
step "wy1" { UPDATE accounts SET balance = balance + 500 WHERE accountid = 'checking'; }
step wy1 { UPDATE accounts SET balance = balance + 500 WHERE accountid = 'checking'; }
# upsert tests are to check writable-CTE cases
step "upsert1" {
step upsert1 {
WITH upsert AS
(UPDATE accounts SET balance = balance + 500
WHERE accountid = 'savings'
@ -51,20 +51,20 @@ step "upsert1" {
# when the first updated tuple was in a non-first child table.
# writep2/returningp1 tests a memory allocation issue
step "readp1" { SELECT tableoid::regclass, ctid, * FROM p WHERE b IN (0, 1) AND c = 0 FOR UPDATE; }
step "writep1" { UPDATE p SET b = -1 WHERE a = 1 AND b = 1 AND c = 0; }
step "writep2" { UPDATE p SET b = -b WHERE a = 1 AND c = 0; }
step "c1" { COMMIT; }
step readp1 { SELECT tableoid::regclass, ctid, * FROM p WHERE b IN (0, 1) AND c = 0 FOR UPDATE; }
step writep1 { UPDATE p SET b = -1 WHERE a = 1 AND b = 1 AND c = 0; }
step writep2 { UPDATE p SET b = -b WHERE a = 1 AND c = 0; }
step c1 { COMMIT; }
# these tests are meant to exercise EvalPlanQualFetchRowMarks,
# ie, handling non-locked tables in an EvalPlanQual recheck
step "partiallock" {
step partiallock {
SELECT * FROM accounts a1, accounts a2
WHERE a1.accountid = a2.accountid
FOR UPDATE OF a1;
}
step "lockwithvalues" {
step lockwithvalues {
SELECT * FROM accounts a1, (values('checking'),('savings')) v(id)
WHERE a1.accountid = v.id
FOR UPDATE OF a1;
@ -73,7 +73,7 @@ step "lockwithvalues" {
# these tests exercise EvalPlanQual with a SubLink sub-select (which should be
# unaffected by any EPQ recheck behavior in the outer query); cf bug #14034
step "updateforss" {
step updateforss {
UPDATE table_a SET value = 'newTableAValue' WHERE id = 1;
UPDATE table_b SET value = 'newTableBValue' WHERE id = 1;
}
@ -81,16 +81,16 @@ step "updateforss" {
# these tests exercise EvalPlanQual with conditional InitPlans which
# have not been executed prior to the EPQ
step "updateforcip" {
step updateforcip {
UPDATE table_a SET value = NULL WHERE id = 1;
}
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "wx2" { UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; }
step "wy2" { UPDATE accounts SET balance = balance + 1000 WHERE accountid = 'checking' AND balance < 1000; }
step "upsert2" {
step wx2 { UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; }
step wy2 { UPDATE accounts SET balance = balance + 1000 WHERE accountid = 'checking' AND balance < 1000; }
step upsert2 {
WITH upsert AS
(UPDATE accounts SET balance = balance + 1234
WHERE accountid = 'savings'
@ -98,35 +98,35 @@ step "upsert2" {
INSERT INTO accounts SELECT 'savings', 1234
WHERE NOT EXISTS (SELECT 1 FROM upsert);
}
step "readp2" { SELECT tableoid::regclass, ctid, * FROM p WHERE b IN (0, 1) AND c = 0 FOR UPDATE; }
step "returningp1" {
step readp2 { SELECT tableoid::regclass, ctid, * FROM p WHERE b IN (0, 1) AND c = 0 FOR UPDATE; }
step returningp1 {
WITH u AS ( UPDATE p SET b = b WHERE a > 0 RETURNING * )
SELECT * FROM u;
}
step "readforss" {
step readforss {
SELECT ta.id AS ta_id, ta.value AS ta_value,
(SELECT ROW(tb.id, tb.value)
FROM table_b tb WHERE ta.id = tb.id) AS tb_row
FROM table_a ta
WHERE ta.id = 1 FOR UPDATE OF ta;
}
step "updateforcip2" {
step updateforcip2 {
UPDATE table_a SET value = COALESCE(value, (SELECT text 'newValue')) WHERE id = 1;
}
step "updateforcip3" {
step updateforcip3 {
WITH d(val) AS (SELECT text 'newValue' FROM generate_series(1,1))
UPDATE table_a SET value = COALESCE(value, (SELECT val FROM d)) WHERE id = 1;
}
step "wrtwcte" { UPDATE table_a SET value = 'tableAValue2' WHERE id = 1; }
step "c2" { COMMIT; }
step wrtwcte { UPDATE table_a SET value = 'tableAValue2' WHERE id = 1; }
step c2 { COMMIT; }
session "s3"
session s3
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "read" { SELECT * FROM accounts ORDER BY accountid; }
step "read_a" { SELECT * FROM table_a ORDER BY id; }
step read { SELECT * FROM accounts ORDER BY accountid; }
step read_a { SELECT * FROM table_a ORDER BY id; }
# this test exercises EvalPlanQual with a CTE, cf bug #14328
step "readwcte" {
step readwcte {
WITH
cte1 AS (
SELECT id FROM table_b WHERE value = 'tableBValue'
@ -140,7 +140,7 @@ step "readwcte" {
}
# this test exercises a different CTE misbehavior, cf bug #14870
step "multireadwcte" {
step multireadwcte {
WITH updated AS (
UPDATE table_a SET value = 'tableAValue3' WHERE id = 1 RETURNING id
)
@ -149,15 +149,15 @@ step "multireadwcte" {
teardown { COMMIT; }
permutation "wx1" "wx2" "c1" "c2" "read"
permutation "wy1" "wy2" "c1" "c2" "read"
permutation "upsert1" "upsert2" "c1" "c2" "read"
permutation "readp1" "writep1" "readp2" "c1" "c2"
permutation "writep2" "returningp1" "c1" "c2"
permutation "wx2" "partiallock" "c2" "c1" "read"
permutation "wx2" "lockwithvalues" "c2" "c1" "read"
permutation "updateforss" "readforss" "c1" "c2"
permutation "updateforcip" "updateforcip2" "c1" "c2" "read_a"
permutation "updateforcip" "updateforcip3" "c1" "c2" "read_a"
permutation "wrtwcte" "readwcte" "c1" "c2"
permutation "wrtwcte" "multireadwcte" "c1" "c2"
permutation wx1 wx2 c1 c2 read
permutation wy1 wy2 c1 c2 read
permutation upsert1 upsert2 c1 c2 read
permutation readp1 writep1 readp2 c1 c2
permutation writep2 returningp1 c1 c2
permutation wx2 partiallock c2 c1 read
permutation wx2 lockwithvalues c2 c1 read
permutation updateforss readforss c1 c2
permutation updateforcip updateforcip2 c1 c2 read_a
permutation updateforcip updateforcip3 c1 c2 read_a
permutation wrtwcte readwcte c1 c2
permutation wrtwcte multireadwcte c1 c2

View File

@ -10,10 +10,10 @@ teardown
DROP TABLE foo, bar;
}
session "s1"
session s1
setup { BEGIN; }
step "ins" { INSERT INTO bar VALUES (42); }
step "com" { COMMIT; }
step ins { INSERT INTO bar VALUES (42); }
step com { COMMIT; }
session "s2"
step "upd" { UPDATE foo SET b = 'Hello World'; }
session s2
step upd { UPDATE foo SET b = 'Hello World'; }

View File

@ -18,29 +18,29 @@ teardown
DROP TABLE parent, child;
}
session "s1"
session s1
setup { BEGIN; SET deadlock_timeout = '100ms'; }
step "s1i" { INSERT INTO child VALUES (1, 1); }
step "s1u" { UPDATE parent SET aux = 'bar'; }
step "s1c" { COMMIT; }
step s1i { INSERT INTO child VALUES (1, 1); }
step s1u { UPDATE parent SET aux = 'bar'; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; SET deadlock_timeout = '10s'; }
step "s2i" { INSERT INTO child VALUES (2, 1); }
step "s2u" { UPDATE parent SET aux = 'baz'; }
step "s2c" { COMMIT; }
step s2i { INSERT INTO child VALUES (2, 1); }
step s2u { UPDATE parent SET aux = 'baz'; }
step s2c { COMMIT; }
permutation "s1i" "s1u" "s1c" "s2i" "s2u" "s2c"
permutation "s1i" "s1u" "s2i" "s1c" "s2u" "s2c"
permutation "s1i" "s1u" "s2i" "s2u" "s1c" "s2c"
permutation "s1i" "s2i" "s1u" "s1c" "s2u" "s2c"
permutation "s1i" "s2i" "s1u" "s2u" "s1c" "s2c"
permutation "s1i" "s2i" "s2u" "s1u" "s2c" "s1c"
permutation "s1i" "s2i" "s2u" "s2c" "s1u" "s1c"
permutation "s2i" "s1i" "s1u" "s1c" "s2u" "s2c"
permutation "s2i" "s1i" "s1u" "s2u" "s1c" "s2c"
permutation "s2i" "s1i" "s2u" "s1u" "s2c" "s1c"
permutation "s2i" "s1i" "s2u" "s2c" "s1u" "s1c"
permutation "s2i" "s2u" "s1i" "s1u" "s2c" "s1c"
permutation "s2i" "s2u" "s1i" "s2c" "s1u" "s1c"
permutation "s2i" "s2u" "s2c" "s1i" "s1u" "s1c"
permutation s1i s1u s1c s2i s2u s2c
permutation s1i s1u s2i s1c s2u s2c
permutation s1i s1u s2i s2u s1c s2c
permutation s1i s2i s1u s1c s2u s2c
permutation s1i s2i s1u s2u s1c s2c
permutation s1i s2i s2u s1u s2c s1c
permutation s1i s2i s2u s2c s1u s1c
permutation s2i s1i s1u s1c s2u s2c
permutation s2i s1i s1u s2u s1c s2c
permutation s2i s1i s2u s1u s2c s1c
permutation s2i s1i s2u s2c s1u s1c
permutation s2i s2u s1i s1u s2c s1c
permutation s2i s2u s1i s2c s1u s1c
permutation s2i s2u s2c s1i s1u s1c

View File

@ -23,26 +23,26 @@ teardown
DROP TABLE a, b;
}
session "s1"
session s1
setup { BEGIN; SET deadlock_timeout = '100ms'; }
step "s1u1" { UPDATE A SET Col1 = 1 WHERE AID = 1; }
step "s1u2" { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step "s1c" { COMMIT; }
step s1u1 { UPDATE A SET Col1 = 1 WHERE AID = 1; }
step s1u2 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; SET deadlock_timeout = '10s'; }
step "s2u1" { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step "s2u2" { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step "s2c" { COMMIT; }
step s2u1 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step s2u2 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
step s2c { COMMIT; }
permutation "s1u1" "s1u2" "s1c" "s2u1" "s2u2" "s2c"
permutation "s1u1" "s1u2" "s2u1" "s1c" "s2u2" "s2c"
permutation "s1u1" "s2u1" "s1u2" "s2u2" "s2c" "s1c"
permutation "s1u1" "s2u1" "s2u2" "s1u2" "s2c" "s1c"
permutation "s1u1" "s2u1" "s2u2" "s2c" "s1u2" "s1c"
permutation "s2u1" "s1u1" "s1u2" "s2u2" "s2c" "s1c"
permutation "s2u1" "s1u1" "s2u2" "s1u2" "s2c" "s1c"
permutation "s2u1" "s1u1" "s2u2" "s2c" "s1u2" "s1c"
permutation "s2u1" "s2u2" "s1u1" "s1u2" "s2c" "s1c"
permutation "s2u1" "s2u2" "s1u1" "s2c" "s1u2" "s1c"
permutation "s2u1" "s2u2" "s2c" "s1u1" "s1u2" "s1c"
permutation s1u1 s1u2 s1c s2u1 s2u2 s2c
permutation s1u1 s1u2 s2u1 s1c s2u2 s2c
permutation s1u1 s2u1 s1u2 s2u2 s2c s1c
permutation s1u1 s2u1 s2u2 s1u2 s2c s1c
permutation s1u1 s2u1 s2u2 s2c s1u2 s1c
permutation s2u1 s1u1 s1u2 s2u2 s2c s1c
permutation s2u1 s1u1 s2u2 s1u2 s2c s1c
permutation s2u1 s1u1 s2u2 s2c s1u2 s1c
permutation s2u1 s2u2 s1u1 s1u2 s2c s1c
permutation s2u1 s2u2 s1u1 s2c s1u2 s1c
permutation s2u1 s2u2 s2c s1u1 s1u2 s1c

View File

@ -15,29 +15,29 @@ teardown
DROP TABLE tab_freeze;
}
session "s1"
step "s1_begin" { BEGIN; }
step "s1_update" { UPDATE tab_freeze SET x = x + 1 WHERE id = 3; }
step "s1_commit" { COMMIT; }
step "s1_selectone" {
session s1
step s1_begin { BEGIN; }
step s1_update { UPDATE tab_freeze SET x = x + 1 WHERE id = 3; }
step s1_commit { COMMIT; }
step s1_selectone {
BEGIN;
SET LOCAL enable_seqscan = false;
SET LOCAL enable_bitmapscan = false;
SELECT * FROM tab_freeze WHERE id = 3;
COMMIT;
}
step "s1_selectall" { SELECT * FROM tab_freeze ORDER BY name, id; }
step s1_selectall { SELECT * FROM tab_freeze ORDER BY name, id; }
session "s2"
step "s2_begin" { BEGIN; }
step "s2_key_share" { SELECT id FROM tab_freeze WHERE id = 3 FOR KEY SHARE; }
step "s2_commit" { COMMIT; }
step "s2_vacuum" { VACUUM FREEZE tab_freeze; }
session s2
step s2_begin { BEGIN; }
step s2_key_share { SELECT id FROM tab_freeze WHERE id = 3 FOR KEY SHARE; }
step s2_commit { COMMIT; }
step s2_vacuum { VACUUM FREEZE tab_freeze; }
session "s3"
step "s3_begin" { BEGIN; }
step "s3_key_share" { SELECT id FROM tab_freeze WHERE id = 3 FOR KEY SHARE; }
step "s3_commit" { COMMIT; }
session s3
step s3_begin { BEGIN; }
step s3_key_share { SELECT id FROM tab_freeze WHERE id = 3 FOR KEY SHARE; }
step s3_commit { COMMIT; }
# This permutation verfies that a previous bug
# https://postgr.es/m/E5711E62-8FDF-4DCA-A888-C200BF6B5742@amazon.com
@ -45,12 +45,12 @@ step "s3_commit" { COMMIT; }
# is not reintroduced. We used to make wrong pruning / freezing
# decision for multixacts, which could lead to a) broken hot chains b)
# dead rows being revived.
permutation "s1_begin" "s2_begin" "s3_begin" # start transactions
"s1_update" "s2_key_share" "s3_key_share" # have xmax be a multi with an updater, updater being oldest xid
"s1_update" # create additional row version that has multis
"s1_commit" "s2_commit" # commit both updater and share locker
"s2_vacuum" # due to bug in freezing logic, we used to *not* prune updated row, and then froze it
"s1_selectone" # if hot chain is broken, the row can't be found via index scan
"s3_commit" # commit remaining open xact
"s2_vacuum" # pruning / freezing in broken hot chains would unset xmax, reviving rows
"s1_selectall" # show borkedness
permutation s1_begin s2_begin s3_begin # start transactions
s1_update s2_key_share s3_key_share # have xmax be a multi with an updater, updater being oldest xid
s1_update # create additional row version that has multis
s1_commit s2_commit # commit both updater and share locker
s2_vacuum # due to bug in freezing logic, we used to *not* prune updated row, and then froze it
s1_selectone # if hot chain is broken, the row can't be found via index scan
s3_commit # commit remaining open xact
s2_vacuum # pruning / freezing in broken hot chains would unset xmax, reviving rows
s1_selectall # show borkedness

View File

@ -23,7 +23,7 @@ teardown
DROP TABLE taby;
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL SERIALIZABLE;
@ -31,10 +31,10 @@ setup
SET LOCAL random_page_cost = 0.1;
SET LOCAL cpu_tuple_cost = 0.03;
}
step "rxwy1" { DELETE FROM taby WHERE id = (SELECT min(id) FROM tabx); }
step "c1" { COMMIT; }
step rxwy1 { DELETE FROM taby WHERE id = (SELECT min(id) FROM tabx); }
step c1 { COMMIT; }
session "s2"
session s2
setup
{
BEGIN ISOLATION LEVEL SERIALIZABLE;
@ -42,5 +42,5 @@ setup
SET LOCAL random_page_cost = 0.1;
SET LOCAL cpu_tuple_cost = 0.03;
}
step "rywx2" { DELETE FROM tabx WHERE id = (SELECT min(id) FROM taby); }
step "c2" { COMMIT; }
step rywx2 { DELETE FROM tabx WHERE id = (SELECT min(id) FROM taby); }
step c2 { COMMIT; }

View File

@ -19,60 +19,60 @@ teardown
# Session 1 executes actions which act directly on both the parent and
# its child. Abbreviation "c" is used for queries working on the child
# and "p" on the parent.
session "s1"
session s1
setup
{
CREATE TEMPORARY TABLE inh_temp_child_s1 () INHERITS (inh_parent);
}
step "s1_begin" { BEGIN; }
step "s1_truncate_p" { TRUNCATE inh_parent; }
step "s1_select_p" { SELECT a FROM inh_parent; }
step "s1_select_c" { SELECT a FROM inh_temp_child_s1; }
step "s1_insert_p" { INSERT INTO inh_parent VALUES (1), (2); }
step "s1_insert_c" { INSERT INTO inh_temp_child_s1 VALUES (3), (4); }
step "s1_update_p" { UPDATE inh_parent SET a = 11 WHERE a = 1; }
step "s1_update_c" { UPDATE inh_parent SET a = 13 WHERE a IN (3, 5); }
step "s1_delete_p" { DELETE FROM inh_parent WHERE a = 2; }
step "s1_delete_c" { DELETE FROM inh_parent WHERE a IN (4, 6); }
step "s1_commit" { COMMIT; }
step s1_begin { BEGIN; }
step s1_truncate_p { TRUNCATE inh_parent; }
step s1_select_p { SELECT a FROM inh_parent; }
step s1_select_c { SELECT a FROM inh_temp_child_s1; }
step s1_insert_p { INSERT INTO inh_parent VALUES (1), (2); }
step s1_insert_c { INSERT INTO inh_temp_child_s1 VALUES (3), (4); }
step s1_update_p { UPDATE inh_parent SET a = 11 WHERE a = 1; }
step s1_update_c { UPDATE inh_parent SET a = 13 WHERE a IN (3, 5); }
step s1_delete_p { DELETE FROM inh_parent WHERE a = 2; }
step s1_delete_c { DELETE FROM inh_parent WHERE a IN (4, 6); }
step s1_commit { COMMIT; }
teardown
{
DROP TABLE inh_temp_child_s1;
}
# Session 2 executes actions on the parent which act only on the child.
session "s2"
session s2
setup
{
CREATE TEMPORARY TABLE inh_temp_child_s2 () INHERITS (inh_parent);
}
step "s2_truncate_p" { TRUNCATE inh_parent; }
step "s2_select_p" { SELECT a FROM inh_parent; }
step "s2_select_c" { SELECT a FROM inh_temp_child_s2; }
step "s2_insert_c" { INSERT INTO inh_temp_child_s2 VALUES (5), (6); }
step "s2_update_c" { UPDATE inh_parent SET a = 15 WHERE a IN (3, 5); }
step "s2_delete_c" { DELETE FROM inh_parent WHERE a IN (4, 6); }
step s2_truncate_p { TRUNCATE inh_parent; }
step s2_select_p { SELECT a FROM inh_parent; }
step s2_select_c { SELECT a FROM inh_temp_child_s2; }
step s2_insert_c { INSERT INTO inh_temp_child_s2 VALUES (5), (6); }
step s2_update_c { UPDATE inh_parent SET a = 15 WHERE a IN (3, 5); }
step s2_delete_c { DELETE FROM inh_parent WHERE a IN (4, 6); }
teardown
{
DROP TABLE inh_temp_child_s2;
}
# Check INSERT behavior across sessions
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation s1_insert_p s1_insert_c s2_insert_c s1_select_p s1_select_c s2_select_p s2_select_c
# Check UPDATE behavior across sessions
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_update_p" "s1_update_c" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s2_update_c" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation s1_insert_p s1_insert_c s2_insert_c s1_update_p s1_update_c s1_select_p s1_select_c s2_select_p s2_select_c
permutation s1_insert_p s1_insert_c s2_insert_c s2_update_c s1_select_p s1_select_c s2_select_p s2_select_c
# Check DELETE behavior across sessions
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_delete_p" "s1_delete_c" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s2_delete_c" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation s1_insert_p s1_insert_c s2_insert_c s1_delete_p s1_delete_c s1_select_p s1_select_c s2_select_p s2_select_c
permutation s1_insert_p s1_insert_c s2_insert_c s2_delete_c s1_select_p s1_select_c s2_select_p s2_select_c
# Check TRUNCATE behavior across sessions
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_truncate_p" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s2_truncate_p" "s1_select_p" "s1_select_c" "s2_select_p" "s2_select_c"
permutation s1_insert_p s1_insert_c s2_insert_c s1_truncate_p s1_select_p s1_select_c s2_select_p s2_select_c
permutation s1_insert_p s1_insert_c s2_insert_c s2_truncate_p s1_select_p s1_select_c s2_select_p s2_select_c
# TRUNCATE on a parent tree does not block access to temporary child relation
# of another session, and blocks when scanning the parent.
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_begin" "s1_truncate_p" "s2_select_p" "s1_commit"
permutation "s1_insert_p" "s1_insert_c" "s2_insert_c" "s1_begin" "s1_truncate_p" "s2_select_c" "s1_commit"
permutation s1_insert_p s1_insert_c s2_insert_c s1_begin s1_truncate_p s2_select_p s1_commit
permutation s1_insert_p s1_insert_c s2_insert_c s1_begin s1_truncate_p s2_select_c s1_commit

View File

@ -11,24 +11,24 @@ teardown
DROP TABLE ints;
}
session "s1"
step "beginrr1" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "begins1" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "donothing1" { INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; }
step "c1" { COMMIT; }
step "show" { SELECT * FROM ints; }
session s1
step beginrr1 { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step begins1 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step donothing1 { INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; }
step c1 { COMMIT; }
step show { SELECT * FROM ints; }
session "s2"
step "beginrr2" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "begins2" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "donothing2" { INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING; }
step "c2" { COMMIT; }
session s2
step beginrr2 { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step begins2 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step donothing2 { INSERT INTO ints(key, val) VALUES(1, 'donothing2'), (1, 'donothing3') ON CONFLICT DO NOTHING; }
step c2 { COMMIT; }
permutation "beginrr1" "beginrr2" "donothing1" "c1" "donothing2" "c2" "show"
permutation "beginrr1" "beginrr2" "donothing2" "c2" "donothing1" "c1" "show"
permutation "beginrr1" "beginrr2" "donothing1" "donothing2" "c1" "c2" "show"
permutation "beginrr1" "beginrr2" "donothing2" "donothing1" "c2" "c1" "show"
permutation "begins1" "begins2" "donothing1" "c1" "donothing2" "c2" "show"
permutation "begins1" "begins2" "donothing2" "c2" "donothing1" "c1" "show"
permutation "begins1" "begins2" "donothing1" "donothing2" "c1" "c2" "show"
permutation "begins1" "begins2" "donothing2" "donothing1" "c2" "c1" "show"
permutation beginrr1 beginrr2 donothing1 c1 donothing2 c2 show
permutation beginrr1 beginrr2 donothing2 c2 donothing1 c1 show
permutation beginrr1 beginrr2 donothing1 donothing2 c1 c2 show
permutation beginrr1 beginrr2 donothing2 donothing1 c2 c1 show
permutation begins1 begins2 donothing1 c1 donothing2 c2 show
permutation begins1 begins2 donothing2 c2 donothing1 c1 show
permutation begins1 begins2 donothing1 donothing2 c1 c2 show
permutation begins1 begins2 donothing2 donothing1 c2 c1 show

View File

@ -16,25 +16,25 @@ teardown
DROP TABLE ints;
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "donothing1" { INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; }
step "c1" { COMMIT; }
step "a1" { ABORT; }
step donothing1 { INSERT INTO ints(key, val) VALUES(1, 'donothing1') ON CONFLICT DO NOTHING; }
step c1 { COMMIT; }
step a1 { ABORT; }
session "s2"
session s2
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "donothing2" { INSERT INTO ints(key, val) VALUES(1, 'donothing2') ON CONFLICT DO NOTHING; }
step "select2" { SELECT * FROM ints; }
step "c2" { COMMIT; }
step donothing2 { INSERT INTO ints(key, val) VALUES(1, 'donothing2') ON CONFLICT DO NOTHING; }
step select2 { SELECT * FROM ints; }
step c2 { COMMIT; }
# Regular case where one session block-waits on another to determine if it
# should proceed with an insert or do nothing.
permutation "donothing1" "donothing2" "c1" "select2" "c2"
permutation "donothing1" "donothing2" "a1" "select2" "c2"
permutation donothing1 donothing2 c1 select2 c2
permutation donothing1 donothing2 a1 select2 c2

View File

@ -15,26 +15,26 @@ teardown
DROP TABLE upsert;
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "insert1" { INSERT INTO upsert(key, payload) VALUES('FooFoo', 'insert1') ON CONFLICT (lower(key)) DO UPDATE set key = EXCLUDED.key, payload = upsert.payload || ' updated by insert1'; }
step "c1" { COMMIT; }
step "a1" { ABORT; }
step insert1 { INSERT INTO upsert(key, payload) VALUES('FooFoo', 'insert1') ON CONFLICT (lower(key)) DO UPDATE set key = EXCLUDED.key, payload = upsert.payload || ' updated by insert1'; }
step c1 { COMMIT; }
step a1 { ABORT; }
session "s2"
session s2
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "insert2" { INSERT INTO upsert(key, payload) VALUES('FOOFOO', 'insert2') ON CONFLICT (lower(key)) DO UPDATE set key = EXCLUDED.key, payload = upsert.payload || ' updated by insert2'; }
step "select2" { SELECT * FROM upsert; }
step "c2" { COMMIT; }
step insert2 { INSERT INTO upsert(key, payload) VALUES('FOOFOO', 'insert2') ON CONFLICT (lower(key)) DO UPDATE set key = EXCLUDED.key, payload = upsert.payload || ' updated by insert2'; }
step select2 { SELECT * FROM upsert; }
step c2 { COMMIT; }
# One session (session 2) block-waits on another (session 1) to determine if it
# should proceed with an insert or update. The user can still usefully UPDATE
# a column constrained by a unique index, as the example illustrates.
permutation "insert1" "insert2" "c1" "select2" "c2"
permutation "insert1" "insert2" "a1" "select2" "c2"
permutation insert1 insert2 c1 select2 c2
permutation insert1 insert2 a1 select2 c2

View File

@ -37,12 +37,12 @@ teardown
DROP TABLE colors;
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "insert1" {
step insert1 {
WITH t AS (
INSERT INTO colors(key, color, is_active)
VALUES(1, 'Brown', true), (2, 'Gray', true)
@ -50,20 +50,20 @@ step "insert1" {
SET color = EXCLUDED.color
WHERE colors.is_active)
SELECT * FROM colors ORDER BY key;}
step "select1surprise" { SELECT * FROM colors ORDER BY key; }
step "c1" { COMMIT; }
step select1surprise { SELECT * FROM colors ORDER BY key; }
step c1 { COMMIT; }
session "s2"
session s2
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "update2" { UPDATE colors SET is_active = true WHERE key = 1; }
step "c2" { COMMIT; }
step update2 { UPDATE colors SET is_active = true WHERE key = 1; }
step c2 { COMMIT; }
# Perhaps surprisingly, the session 1 MVCC-snapshot-visible tuple (the tuple
# with the pre-populated color 'Red') is denied the opportunity to prevent the
# UPDATE from taking place -- only the conclusively-locked tuple version
# matters, and so the tuple with key value 1 was updated to 'Brown' (but not
# tuple with key value 2, since nothing changed there):
permutation "update2" "insert1" "c2" "select1surprise" "c1"
permutation update2 insert1 c2 select1surprise c1

View File

@ -13,27 +13,27 @@ teardown
DROP TABLE upsert;
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "insert1" { INSERT INTO upsert(key, val) VALUES(1, 'insert1') ON CONFLICT (key) DO UPDATE set val = upsert.val || ' updated by insert1'; }
step "c1" { COMMIT; }
step "a1" { ABORT; }
step insert1 { INSERT INTO upsert(key, val) VALUES(1, 'insert1') ON CONFLICT (key) DO UPDATE set val = upsert.val || ' updated by insert1'; }
step c1 { COMMIT; }
step a1 { ABORT; }
session "s2"
session s2
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
}
step "insert2" { INSERT INTO upsert(key, val) VALUES(1, 'insert2') ON CONFLICT (key) DO UPDATE set val = upsert.val || ' updated by insert2'; }
step "select2" { SELECT * FROM upsert; }
step "c2" { COMMIT; }
step insert2 { INSERT INTO upsert(key, val) VALUES(1, 'insert2') ON CONFLICT (key) DO UPDATE set val = upsert.val || ' updated by insert2'; }
step select2 { SELECT * FROM upsert; }
step c2 { COMMIT; }
# One session (session 2) block-waits on another (session 1) to determine if it
# should proceed with an insert or update. Notably, this entails updating a
# tuple while there is no version of that tuple visible to the updating
# session's snapshot. This is permitted only in READ COMMITTED mode.
permutation "insert1" "insert2" "c1" "select2" "c2"
permutation "insert1" "insert2" "a1" "select2" "c2"
permutation insert1 insert2 c1 select2 c2
permutation insert1 insert2 a1 select2 c2

View File

@ -33,39 +33,39 @@ teardown
DROP TABLE upserttest;
}
session "controller"
session controller
setup
{
SET default_transaction_isolation = 'read committed';
}
step "controller_locks" {SELECT pg_advisory_lock(sess, lock), sess, lock FROM generate_series(1, 2) a(sess), generate_series(1,3) b(lock);}
step "controller_unlock_1_1" { SELECT pg_advisory_unlock(1, 1); }
step "controller_unlock_2_1" { SELECT pg_advisory_unlock(2, 1); }
step "controller_unlock_1_2" { SELECT pg_advisory_unlock(1, 2); }
step "controller_unlock_2_2" { SELECT pg_advisory_unlock(2, 2); }
step "controller_unlock_1_3" { SELECT pg_advisory_unlock(1, 3); }
step "controller_unlock_2_3" { SELECT pg_advisory_unlock(2, 3); }
step "controller_show" {SELECT * FROM upserttest; }
step controller_locks {SELECT pg_advisory_lock(sess, lock), sess, lock FROM generate_series(1, 2) a(sess), generate_series(1,3) b(lock);}
step controller_unlock_1_1 { SELECT pg_advisory_unlock(1, 1); }
step controller_unlock_2_1 { SELECT pg_advisory_unlock(2, 1); }
step controller_unlock_1_2 { SELECT pg_advisory_unlock(1, 2); }
step controller_unlock_2_2 { SELECT pg_advisory_unlock(2, 2); }
step controller_unlock_1_3 { SELECT pg_advisory_unlock(1, 3); }
step controller_unlock_2_3 { SELECT pg_advisory_unlock(2, 3); }
step controller_show {SELECT * FROM upserttest; }
session "s1"
session s1
setup
{
SET default_transaction_isolation = 'read committed';
SET spec.session = 1;
}
step "s1_begin" { BEGIN; }
step "s1_upsert" { INSERT INTO upserttest(key, data) VALUES('k1', 'inserted s1') ON CONFLICT (blurt_and_lock(key)) DO UPDATE SET data = upserttest.data || ' with conflict update s1'; }
step "s1_commit" { COMMIT; }
step s1_begin { BEGIN; }
step s1_upsert { INSERT INTO upserttest(key, data) VALUES('k1', 'inserted s1') ON CONFLICT (blurt_and_lock(key)) DO UPDATE SET data = upserttest.data || ' with conflict update s1'; }
step s1_commit { COMMIT; }
session "s2"
session s2
setup
{
SET default_transaction_isolation = 'read committed';
SET spec.session = 2;
}
step "s2_begin" { BEGIN; }
step "s2_upsert" { INSERT INTO upserttest(key, data) VALUES('k1', 'inserted s2') ON CONFLICT (blurt_and_lock(key)) DO UPDATE SET data = upserttest.data || ' with conflict update s2'; }
step "s2_commit" { COMMIT; }
step s2_begin { BEGIN; }
step s2_upsert { INSERT INTO upserttest(key, data) VALUES('k1', 'inserted s2') ON CONFLICT (blurt_and_lock(key)) DO UPDATE SET data = upserttest.data || ' with conflict update s2'; }
step s2_commit { COMMIT; }
# Test that speculative locks are correctly acquired and released, s2
# inserts, s1 updates.
@ -74,23 +74,23 @@ permutation
# blurt_and_lock function acquires advisory locks that allow us to
# continue after a) the optimistic conflict probe b) after the
# insertion of the speculative tuple.
"controller_locks"
"controller_show"
"s1_upsert" "s2_upsert"
"controller_show"
controller_locks
controller_show
s1_upsert s2_upsert
controller_show
# Switch both sessions to wait on the other lock next time (the speculative insertion)
"controller_unlock_1_1" "controller_unlock_2_1"
controller_unlock_1_1 controller_unlock_2_1
# Allow both sessions to continue
"controller_unlock_1_3" "controller_unlock_2_3"
"controller_show"
controller_unlock_1_3 controller_unlock_2_3
controller_show
# Allow the second session to finish insertion
"controller_unlock_2_2"
controller_unlock_2_2
# This should now show a successful insertion
"controller_show"
controller_show
# Allow the first session to finish insertion
"controller_unlock_1_2"
controller_unlock_1_2
# This should now show a successful UPSERT
"controller_show"
controller_show
# Test that speculative locks are correctly acquired and released, s2
# inserts, s1 updates.
@ -99,23 +99,23 @@ permutation
# blurt_and_lock function acquires advisory locks that allow us to
# continue after a) the optimistic conflict probe b) after the
# insertion of the speculative tuple.
"controller_locks"
"controller_show"
"s1_upsert" "s2_upsert"
"controller_show"
controller_locks
controller_show
s1_upsert s2_upsert
controller_show
# Switch both sessions to wait on the other lock next time (the speculative insertion)
"controller_unlock_1_1" "controller_unlock_2_1"
controller_unlock_1_1 controller_unlock_2_1
# Allow both sessions to continue
"controller_unlock_1_3" "controller_unlock_2_3"
"controller_show"
controller_unlock_1_3 controller_unlock_2_3
controller_show
# Allow the first session to finish insertion
"controller_unlock_1_2"
controller_unlock_1_2
# This should now show a successful insertion
"controller_show"
controller_show
# Allow the second session to finish insertion
"controller_unlock_2_2"
controller_unlock_2_2
# This should now show a successful UPSERT
"controller_show"
controller_show
# Test that speculative locks are correctly acquired and released, s2
# inserts, s1 updates. With the added complication that transactions
@ -125,25 +125,25 @@ permutation
# blurt_and_lock function acquires advisory locks that allow us to
# continue after a) the optimistic conflict probe b) after the
# insertion of the speculative tuple.
"controller_locks"
"controller_show"
"s1_begin" "s2_begin"
"s1_upsert" "s2_upsert"
"controller_show"
controller_locks
controller_show
s1_begin s2_begin
s1_upsert s2_upsert
controller_show
# Switch both sessions to wait on the other lock next time (the speculative insertion)
"controller_unlock_1_1" "controller_unlock_2_1"
controller_unlock_1_1 controller_unlock_2_1
# Allow both sessions to continue
"controller_unlock_1_3" "controller_unlock_2_3"
"controller_show"
controller_unlock_1_3 controller_unlock_2_3
controller_show
# Allow the first session to finish insertion
"controller_unlock_1_2"
controller_unlock_1_2
# But the change isn't visible yet, nor should the second session continue
"controller_show"
controller_show
# Allow the second session to finish insertion, but it's blocked
"controller_unlock_2_2"
"controller_show"
controller_unlock_2_2
controller_show
# But committing should unblock
"s1_commit"
"controller_show"
"s2_commit"
"controller_show"
s1_commit
controller_show
s2_commit
controller_show

View File

@ -22,30 +22,30 @@ teardown
DROP FUNCTION ctoast_large_val();
}
session "s1"
session s1
setup
{
BEGIN ISOLATION LEVEL READ COMMITTED;
SELECT pg_advisory_xact_lock(1);
}
step "s1commit" { COMMIT; }
step s1commit { COMMIT; }
session "s2"
session s2
setup
{
SET default_transaction_isolation = 'read committed';
}
step "s2insert" {
step s2insert {
INSERT INTO ctoast (key, val) VALUES (1, ctoast_large_val()) ON CONFLICT DO NOTHING;
}
session "s3"
session s3
setup
{
SET default_transaction_isolation = 'read committed';
}
step "s3insert" {
step s3insert {
INSERT INTO ctoast (key, val) VALUES (1, ctoast_large_val()) ON CONFLICT DO NOTHING;
}
permutation "s2insert" "s3insert" "s1commit"
permutation s2insert s3insert s1commit

View File

@ -18,49 +18,49 @@ teardown
DROP TABLE lcku_table;
}
session "s1"
step "s1b" { BEGIN; }
step "s1l" { SELECT pg_advisory_lock(578902068); }
step "s1u" { UPDATE lcku_table SET id = 2 WHERE id = 3; }
step "s1hint" { SELECT * FROM lcku_table; }
step "s1ul" { SELECT pg_advisory_unlock(578902068); }
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN; }
step s1l { SELECT pg_advisory_lock(578902068); }
step s1u { UPDATE lcku_table SET id = 2 WHERE id = 3; }
step s1hint { SELECT * FROM lcku_table; }
step s1ul { SELECT pg_advisory_unlock(578902068); }
step s1c { COMMIT; }
teardown { SELECT pg_advisory_unlock_all(); }
session "s2"
step "s2b1" { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "s2b2" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "s2b3" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "s2l" { SELECT * FROM lcku_table WHERE pg_advisory_lock(578902068) IS NOT NULL FOR KEY SHARE; }
step "s2c" { COMMIT; }
session s2
step s2b1 { BEGIN ISOLATION LEVEL READ COMMITTED; }
step s2b2 { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step s2b3 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step s2l { SELECT * FROM lcku_table WHERE pg_advisory_lock(578902068) IS NOT NULL FOR KEY SHARE; }
step s2c { COMMIT; }
teardown { SELECT pg_advisory_unlock_all(); }
permutation "s1b" "s2b1" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
#permutation "s1b" "s2b1" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b1 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b1 s1l s1u s2l s1c s1ul s2c
#permutation s1b s2b1 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b1 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b1" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
#permutation "s1b" "s2b1" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b1 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b1 s1l s1u s2l s1c s1hint s1ul s2c
#permutation s1b s2b1 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b1 s1l s1u s1ul s2l s1c s1hint s2c
permutation "s1b" "s2b2" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
#permutation "s1b" "s2b2" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b2 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b2 s1l s1u s2l s1c s1ul s2c
#permutation s1b s2b2 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b2 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b2" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
#permutation "s1b" "s2b2" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b2 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b2 s1l s1u s2l s1c s1hint s1ul s2c
#permutation s1b s2b2 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b2 s1l s1u s1ul s2l s1c s1hint s2c
permutation "s1b" "s2b3" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
#permutation "s1b" "s2b3" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b3 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b3 s1l s1u s2l s1c s1ul s2c
#permutation s1b s2b3 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b3 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b3" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
#permutation "s1b" "s2b3" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b3 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b3 s1l s1u s2l s1c s1hint s1ul s2c
#permutation s1b s2b3 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b3 s1l s1u s1ul s2l s1c s1hint s2c

View File

@ -14,49 +14,49 @@ teardown
DROP TABLE lcu_table;
}
session "s1"
step "s1b" { BEGIN; }
step "s1l" { SELECT pg_advisory_lock(380170116); }
step "s1u" { UPDATE lcu_table SET value = 'two' WHERE id = 1; }
step "s1hint" { SELECT * FROM lcu_table; }
step "s1ul" { SELECT pg_advisory_unlock(380170116); }
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN; }
step s1l { SELECT pg_advisory_lock(380170116); }
step s1u { UPDATE lcu_table SET value = 'two' WHERE id = 1; }
step s1hint { SELECT * FROM lcu_table; }
step s1ul { SELECT pg_advisory_unlock(380170116); }
step s1c { COMMIT; }
teardown { SELECT pg_advisory_unlock_all(); }
session "s2"
step "s2b1" { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "s2b2" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "s2b3" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "s2l" { SELECT * FROM lcu_table WHERE pg_advisory_lock(380170116) IS NOT NULL FOR KEY SHARE; }
step "s2c" { COMMIT; }
session s2
step s2b1 { BEGIN ISOLATION LEVEL READ COMMITTED; }
step s2b2 { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step s2b3 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step s2l { SELECT * FROM lcu_table WHERE pg_advisory_lock(380170116) IS NOT NULL FOR KEY SHARE; }
step s2c { COMMIT; }
teardown { SELECT pg_advisory_unlock_all(); }
permutation "s1b" "s2b1" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b1 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b1 s1l s1u s2l s1c s1ul s2c
permutation s1b s2b1 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b1 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b1" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b1" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b1" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b1 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b1 s1l s1u s2l s1c s1hint s1ul s2c
permutation s1b s2b1 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b1 s1l s1u s1ul s2l s1c s1hint s2c
permutation "s1b" "s2b2" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b2 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b2 s1l s1u s2l s1c s1ul s2c
permutation s1b s2b2 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b2 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b2" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b2" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b2" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b2 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b2 s1l s1u s2l s1c s1hint s1ul s2c
permutation s1b s2b2 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b2 s1l s1u s1ul s2l s1c s1hint s2c
permutation "s1b" "s2b3" "s1l" "s2l" "s1u" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s2l" "s1c" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s2l" "s1ul" "s1u" "s1c" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s1ul" "s2l" "s1c" "s2c"
permutation s1b s2b3 s1l s2l s1u s1c s1ul s2c
permutation s1b s2b3 s1l s1u s2l s1c s1ul s2c
permutation s1b s2b3 s1l s2l s1ul s1u s1c s2c
permutation s1b s2b3 s1l s1u s1ul s2l s1c s2c
permutation "s1b" "s2b3" "s1l" "s2l" "s1u" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s2l" "s1c" "s1hint" "s1ul" "s2c"
permutation "s1b" "s2b3" "s1l" "s2l" "s1ul" "s1u" "s1c" "s1hint" "s2c"
permutation "s1b" "s2b3" "s1l" "s1u" "s1ul" "s2l" "s1c" "s1hint" "s2c"
permutation s1b s2b3 s1l s2l s1u s1c s1hint s1ul s2c
permutation s1b s2b3 s1l s1u s2l s1c s1hint s1ul s2c
permutation s1b s2b3 s1l s2l s1ul s1u s1c s1hint s2c
permutation s1b s2b3 s1l s1u s1ul s2l s1c s1hint s2c

View File

@ -31,31 +31,31 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
# obtain lock on the tuple, traversing its update chain
step "s1l" { SELECT * FROM foo WHERE pg_advisory_xact_lock(0) IS NOT NULL AND key = 1 FOR KEY SHARE; }
step s1l { SELECT * FROM foo WHERE pg_advisory_xact_lock(0) IS NOT NULL AND key = 1 FOR KEY SHARE; }
session "s2"
session s2
setup { SELECT pg_advisory_lock(0); }
step "s2b" { BEGIN; }
step "s2u" { UPDATE foo SET value = 2 WHERE key = 1; }
step "s2_blocker1" { DELETE FROM foo; }
step "s2_blocker2" { UPDATE foo SET key = 2 WHERE key = 1; }
step "s2_blocker3" { UPDATE foo SET value = 2 WHERE key = 1; }
step "s2_unlock" { SELECT pg_advisory_unlock(0); }
step "s2c" { COMMIT; }
step "s2r" { ROLLBACK; }
step s2b { BEGIN; }
step s2u { UPDATE foo SET value = 2 WHERE key = 1; }
step s2_blocker1 { DELETE FROM foo; }
step s2_blocker2 { UPDATE foo SET key = 2 WHERE key = 1; }
step s2_blocker3 { UPDATE foo SET value = 2 WHERE key = 1; }
step s2_unlock { SELECT pg_advisory_unlock(0); }
step s2c { COMMIT; }
step s2r { ROLLBACK; }
permutation "s2b" "s1l" "s2u" "s2_blocker1" "s2_unlock" "s2c"
permutation "s2b" "s1l" "s2u" "s2_blocker2" "s2_unlock" "s2c"
permutation "s2b" "s1l" "s2u" "s2_blocker3" "s2_unlock" "s2c"
permutation "s2b" "s1l" "s2u" "s2_blocker1" "s2_unlock" "s2r"
permutation "s2b" "s1l" "s2u" "s2_blocker2" "s2_unlock" "s2r"
permutation "s2b" "s1l" "s2u" "s2_blocker3" "s2_unlock" "s2r"
permutation s2b s1l s2u s2_blocker1 s2_unlock s2c
permutation s2b s1l s2u s2_blocker2 s2_unlock s2c
permutation s2b s1l s2u s2_blocker3 s2_unlock s2c
permutation s2b s1l s2u s2_blocker1 s2_unlock s2r
permutation s2b s1l s2u s2_blocker2 s2_unlock s2r
permutation s2b s1l s2u s2_blocker3 s2_unlock s2r
permutation "s2b" "s1l" "s2u" "s2_blocker1" "s2c" "s2_unlock"
permutation "s2b" "s1l" "s2u" "s2_blocker2" "s2c" "s2_unlock"
permutation "s2b" "s1l" "s2u" "s2_blocker3" "s2c" "s2_unlock"
permutation "s2b" "s1l" "s2u" "s2_blocker1" "s2r" "s2_unlock"
permutation "s2b" "s1l" "s2u" "s2_blocker2" "s2r" "s2_unlock"
permutation "s2b" "s1l" "s2u" "s2_blocker3" "s2r" "s2_unlock"
permutation s2b s1l s2u s2_blocker1 s2c s2_unlock
permutation s2b s1l s2u s2_blocker2 s2c s2_unlock
permutation s2b s1l s2u s2_blocker3 s2c s2_unlock
permutation s2b s1l s2u s2_blocker1 s2r s2_unlock
permutation s2b s1l s2u s2_blocker2 s2r s2_unlock
permutation s2b s1l s2u s2_blocker3 s2r s2_unlock

View File

@ -19,20 +19,20 @@ teardown
DROP TABLE foo;
}
session "s1"
step "s1b" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "s1s" { SELECT * FROM foo; } # obtain snapshot
step "s1l" { SELECT * FROM foo FOR KEY SHARE; } # obtain lock
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step s1s { SELECT * FROM foo; } # obtain snapshot
step s1l { SELECT * FROM foo FOR KEY SHARE; } # obtain lock
step s1c { COMMIT; }
session "s2"
step "s2b" { BEGIN; }
step "s2u" { UPDATE foo SET value = 2 WHERE key = 1; }
step "s2c" { COMMIT; }
step "s2d1" { DELETE FROM foo WHERE key = 1; }
step "s2d2" { UPDATE foo SET key = 3 WHERE key = 1; }
step "s2d3" { UPDATE foo SET value = 3 WHERE key = 1; }
session s2
step s2b { BEGIN; }
step s2u { UPDATE foo SET value = 2 WHERE key = 1; }
step s2c { COMMIT; }
step s2d1 { DELETE FROM foo WHERE key = 1; }
step s2d2 { UPDATE foo SET key = 3 WHERE key = 1; }
step s2d3 { UPDATE foo SET value = 3 WHERE key = 1; }
permutation "s1b" "s2b" "s1s" "s2u" "s1l" "s2c" "s2d1" "s1c"
permutation "s1b" "s2b" "s1s" "s2u" "s1l" "s2c" "s2d2" "s1c"
permutation "s1b" "s2b" "s1s" "s2u" "s1l" "s2c" "s2d3" "s1c"
permutation s1b s2b s1s s2u s1l s2c s2d1 s1c
permutation s1b s2b s1s s2u s1l s2c s2d2 s1c
permutation s1b s2b s1s s2u s1l s2c s2d3 s1c

View File

@ -22,17 +22,17 @@ teardown
DROP FUNCTION unlck();
}
session "s1"
step "s1i" {
session s1
step s1i {
CREATE INDEX CONCURRENTLY mcic_one_pkey ON mcic_one (id)
WHERE lck_shr(281457);
}
teardown { SELECT unlck(); }
session "s2"
step "s2l" { SELECT pg_advisory_lock(281457); }
step "s2i" {
session s2
step s2l { SELECT pg_advisory_lock(281457); }
step s2i {
CREATE INDEX CONCURRENTLY mcic_two_pkey ON mcic_two (id)
WHERE unlck();
}
@ -40,4 +40,4 @@ step "s2i" {
# (*) marker ensures that s2i is reported as "waiting", even if it
# completes very quickly
permutation "s2l" "s1i" "s2i"(*)
permutation s2l s1i s2i(*)

View File

@ -19,29 +19,29 @@ teardown
DROP TABLE t;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx1" { SELECT * FROM t WHERE id = 1000000; }
step rx1 { SELECT * FROM t WHERE id = 1000000; }
# delay until after T3 commits
step "wz1" { UPDATE t SET txt = 'a' WHERE id = 1; }
step "c1" { COMMIT; }
step wz1 { UPDATE t SET txt = 'a' WHERE id = 1; }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wx2" { UPDATE t SET txt = 'b' WHERE id = 1000000; }
step "c2" { COMMIT; }
step wx2 { UPDATE t SET txt = 'b' WHERE id = 1000000; }
step c2 { COMMIT; }
session "s3"
session s3
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wx3" { UPDATE t SET txt = 'c' WHERE id = 1000000; }
step "ry3" { SELECT * FROM t WHERE id = 500000; }
step wx3 { UPDATE t SET txt = 'c' WHERE id = 1000000; }
step ry3 { SELECT * FROM t WHERE id = 500000; }
# delay until after T4 commits
step "c3" { COMMIT; }
step c3 { COMMIT; }
session "s4"
session s4
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wy4" { UPDATE t SET txt = 'd' WHERE id = 500000; }
step "rz4" { SELECT * FROM t WHERE id = 1; }
step "c4" { COMMIT; }
step wy4 { UPDATE t SET txt = 'd' WHERE id = 500000; }
step rz4 { SELECT * FROM t WHERE id = 1; }
step c4 { COMMIT; }
permutation "rx1" "wx2" "c2" "wx3" "ry3" "wy4" "rz4" "c4" "c3" "wz1" "c1"
permutation rx1 wx2 c2 wx3 ry3 wy4 rz4 c4 c3 wz1 c1

View File

@ -15,21 +15,21 @@ teardown
DROP TABLE justthis;
}
session "s1"
session s1
setup { BEGIN; }
step "s1lock" { SELECT * FROM justthis FOR SHARE; }
step "s1svpt" { SAVEPOINT foo; }
step "s1lock2" { SELECT * FROM justthis FOR SHARE; }
step "s1c" { COMMIT; }
step s1lock { SELECT * FROM justthis FOR SHARE; }
step s1svpt { SAVEPOINT foo; }
step s1lock2 { SELECT * FROM justthis FOR SHARE; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2lock" { SELECT * FROM justthis FOR SHARE; } # ensure it's a multi
step "s2c" { COMMIT; }
step s2lock { SELECT * FROM justthis FOR SHARE; } # ensure it's a multi
step s2c { COMMIT; }
session "s3"
session s3
setup { BEGIN; }
step "s3lock" { SELECT * FROM justthis FOR UPDATE; }
step "s3c" { COMMIT; }
step s3lock { SELECT * FROM justthis FOR UPDATE; }
step s3c { COMMIT; }
permutation "s1lock" "s2lock" "s1svpt" "s3lock" "s1lock2" "s2c" "s1c" "s3c"
permutation s1lock s2lock s1svpt s3lock s1lock2 s2c s1c s3c

View File

@ -14,31 +14,31 @@ teardown
DROP TABLE dont_forget;
}
session "s1"
session s1
setup { BEGIN; }
step "s1_show" { SELECT current_setting('default_transaction_isolation') <> 'read committed'; }
step "s1_lock" { SELECT * FROM dont_forget FOR KEY SHARE; }
step "s1_commit" { COMMIT; }
step s1_show { SELECT current_setting('default_transaction_isolation') <> 'read committed'; }
step s1_lock { SELECT * FROM dont_forget FOR KEY SHARE; }
step s1_commit { COMMIT; }
session "s2"
setup { BEGIN; }
step "s2_update" { UPDATE dont_forget SET value = 2; }
step "s2_abort" { ROLLBACK; }
step "s2_commit" { COMMIT; }
session s2
setup { BEGIN; }
step s2_update { UPDATE dont_forget SET value = 2; }
step s2_abort { ROLLBACK; }
step s2_commit { COMMIT; }
session "s3"
session s3
# try cases with both a non-conflicting lock with s1's and a conflicting one
step "s3_forkeyshr" { SELECT * FROM dont_forget FOR KEY SHARE; }
step "s3_fornokeyupd" { SELECT * FROM dont_forget FOR NO KEY UPDATE; }
step "s3_forupd" { SELECT * FROM dont_forget FOR UPDATE; }
step s3_forkeyshr { SELECT * FROM dont_forget FOR KEY SHARE; }
step s3_fornokeyupd { SELECT * FROM dont_forget FOR NO KEY UPDATE; }
step s3_forupd { SELECT * FROM dont_forget FOR UPDATE; }
permutation "s1_show" "s1_commit" "s2_commit"
permutation "s1_lock" "s2_update" "s2_abort" "s3_forkeyshr" "s1_commit"
permutation "s1_lock" "s2_update" "s2_commit" "s3_forkeyshr" "s1_commit"
permutation "s1_lock" "s2_update" "s1_commit" "s3_forkeyshr" "s2_commit"
permutation "s1_lock" "s2_update" "s2_abort" "s3_fornokeyupd" "s1_commit"
permutation "s1_lock" "s2_update" "s2_commit" "s3_fornokeyupd" "s1_commit"
permutation "s1_lock" "s2_update" "s1_commit" "s3_fornokeyupd" "s2_commit"
permutation "s1_lock" "s2_update" "s2_abort" "s3_forupd" "s1_commit"
permutation "s1_lock" "s2_update" "s2_commit" "s3_forupd" "s1_commit"
permutation "s1_lock" "s2_update" "s1_commit" "s3_forupd" "s2_commit"
permutation s1_show s1_commit s2_commit
permutation s1_lock s2_update s2_abort s3_forkeyshr s1_commit
permutation s1_lock s2_update s2_commit s3_forkeyshr s1_commit
permutation s1_lock s2_update s1_commit s3_forkeyshr s2_commit
permutation s1_lock s2_update s2_abort s3_fornokeyupd s1_commit
permutation s1_lock s2_update s2_commit s3_fornokeyupd s1_commit
permutation s1_lock s2_update s1_commit s3_fornokeyupd s2_commit
permutation s1_lock s2_update s2_abort s3_forupd s1_commit
permutation s1_lock s2_update s2_commit s3_forupd s1_commit
permutation s1_lock s2_update s1_commit s3_forupd s2_commit

View File

@ -14,24 +14,24 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM foo FOR SHARE NOWAIT; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM foo FOR SHARE NOWAIT; }
step s1b { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM foo FOR SHARE NOWAIT; }
step "s2b" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s2c" { COMMIT; }
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"
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"
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"
permutation s2a s2b s1a s1b s2c

View File

@ -14,20 +14,20 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM foo FOR UPDATE; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM foo FOR UPDATE; }
step s1b { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM foo FOR UPDATE; }
step "s2b" { COMMIT; }
step s2a { SELECT * FROM foo FOR UPDATE; }
step s2b { COMMIT; }
session "s3"
session s3
setup { BEGIN; }
step "s3a" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s3b" { COMMIT; }
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"
permutation s1a s2a s3a s1b s2b s3b

View File

@ -14,22 +14,22 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM foo WHERE pg_advisory_lock(0) IS NOT NULL FOR UPDATE NOWAIT; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM foo WHERE pg_advisory_lock(0) IS NOT NULL FOR UPDATE NOWAIT; }
step s1b { COMMIT; }
session "s2"
step "s2a" { SELECT pg_advisory_lock(0); }
step "s2b" { UPDATE foo SET data = data; }
step "s2c" { BEGIN; }
step "s2d" { UPDATE foo SET data = data; }
step "s2e" { SELECT pg_advisory_unlock(0); }
step "s2f" { COMMIT; }
session s2
step s2a { SELECT pg_advisory_lock(0); }
step s2b { UPDATE foo SET data = data; }
step s2c { BEGIN; }
step s2d { UPDATE foo SET data = data; }
step s2e { SELECT pg_advisory_unlock(0); }
step s2f { COMMIT; }
# s1 takes a snapshot but then waits on an advisory lock, then s2
# updates the row in one transaction, then again in another without
# committing, before allowing s1 to proceed to try to lock a row;
# because it has a snapshot that sees the older version, we reach the
# waiting code in EvalPlanQualFetch which ereports when in NOWAIT mode.
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s2e" "s1b" "s2f"
permutation s2a s1a s2b s2c s2d s2e s1b s2f

View File

@ -18,11 +18,11 @@ teardown
DROP TABLE test_nowait;
}
session "sl1"
step "sl1_prep" {
session sl1
step sl1_prep {
PREPARE sl1_run AS SELECT id FROM test_nowait WHERE pg_advisory_lock(0) is not null FOR UPDATE NOWAIT;
}
step "sl1_exec" {
step sl1_exec {
BEGIN ISOLATION LEVEL READ COMMITTED;
EXECUTE sl1_run;
SELECT xmin, xmax, ctid, * FROM test_nowait;
@ -31,22 +31,22 @@ teardown { COMMIT; }
# A session that's used for an UPDATE of the rows to be locked, for when we're testing ctid
# chain following.
session "upd"
step "upd_getlock" {
session upd
step upd_getlock {
SELECT pg_advisory_lock(0);
}
step "upd_doupdate" {
step upd_doupdate {
BEGIN ISOLATION LEVEL READ COMMITTED;
UPDATE test_nowait SET value = value WHERE id % 2 = 0;
COMMIT;
}
step "upd_releaselock" {
step upd_releaselock {
SELECT pg_advisory_unlock(0);
}
# A session that acquires locks that sl1 is supposed to avoid blocking on
session "lk1"
step "lk1_doforshare" {
session lk1
step lk1_doforshare {
BEGIN ISOLATION LEVEL READ COMMITTED;
SELECT id FROM test_nowait WHERE id % 2 = 0 FOR SHARE;
}
@ -54,4 +54,4 @@ teardown {
COMMIT;
}
permutation "sl1_prep" "upd_getlock" "sl1_exec" "upd_doupdate" "lk1_doforshare" "upd_releaselock"
permutation sl1_prep upd_getlock sl1_exec upd_doupdate lk1_doforshare upd_releaselock

View File

@ -14,12 +14,12 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM foo FOR UPDATE NOWAIT; }
step s1b { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM foo FOR UPDATE NOWAIT; }
step "s2b" { COMMIT; }
step s2a { SELECT * FROM foo FOR UPDATE NOWAIT; }
step s2b { COMMIT; }

View File

@ -19,14 +19,14 @@ teardown
DROP TABLE test_t;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rxy1" { select * from test_t where val2 = 1; }
step "wx1" { update test_t set val2 = 2 where val2 = 1 and id = 10; }
step "c1" { COMMIT; }
step rxy1 { select * from test_t where val2 = 1; }
step wx1 { update test_t set val2 = 2 where val2 = 1 and id = 10; }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wy2" { update test_t set val2 = 2 where val2 = 1 and id = 9; }
step "rxy2" { select * from test_t where val2 = 1; }
step "c2" { COMMIT; }
step wy2 { update test_t set val2 = 2 where val2 = 1 and id = 9; }
step rxy2 { select * from test_t where val2 = 1; }
step c2 { COMMIT; }

View File

@ -22,16 +22,16 @@ teardown
DROP TABLE test;
}
session "s1"
step "b1" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r1" { SELECT * FROM test WHERE i IN (5, 7) }
step "w1" { UPDATE test SET t = 'pear_xact1' WHERE i = 7 }
step "c1" { COMMIT; }
session s1
step b1 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step r1 { SELECT * FROM test WHERE i IN (5, 7) }
step w1 { UPDATE test SET t = 'pear_xact1' WHERE i = 7 }
step c1 { COMMIT; }
session "s2"
step "b2" { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r2" { SELECT * FROM test WHERE i IN (5, 7) }
step "w2" { UPDATE test SET t = 'apple_xact2' WHERE i = 5 }
step "c2" { COMMIT; }
session s2
step b2 { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step r2 { SELECT * FROM test WHERE i IN (5, 7) }
step w2 { UPDATE test SET t = 'apple_xact2' WHERE i = 5 }
step c2 { COMMIT; }
permutation "b1" "b2" "r1" "r2" "w1" "w2" "c1" "c2"
permutation b1 b2 r1 r2 w1 w2 c1 c2

View File

@ -12,26 +12,26 @@ teardown
# Sessions for CREATE INDEX CONCURRENTLY test
session "s1"
step "w1" { BEGIN; INSERT INTO cic_test VALUES (1); }
step "p1" { PREPARE TRANSACTION 's1'; }
step "c1" { COMMIT PREPARED 's1'; }
session s1
step w1 { BEGIN; INSERT INTO cic_test VALUES (1); }
step p1 { PREPARE TRANSACTION 's1'; }
step c1 { COMMIT PREPARED 's1'; }
session "s2"
session s2
# The isolation tester never recognizes that a lock of s1 blocks s2, because a
# prepared transaction's locks have no pid associated. While there's a slight
# chance of timeout while waiting for an autovacuum-held lock, that wouldn't
# change the output. Hence, no timeout is too short.
setup { SET lock_timeout = 10; }
step "cic2"
step cic2
{
CREATE INDEX CONCURRENTLY on cic_test(a);
}
step "r2"
step r2
{
SET enable_seqscan to off;
SET enable_bitmapscan to off;
SELECT * FROM cic_test WHERE a = 1;
}
permutation "w1" "p1" "cic2" "c1" "r2"
permutation w1 p1 cic2 c1 r2

File diff suppressed because it is too large Load Diff

View File

@ -17,14 +17,14 @@ teardown
DROP TABLE person, project;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx1" { SELECT count(*) FROM person WHERE person_id = 1 AND is_project_manager; }
step "wy1" { INSERT INTO project VALUES (101, 'Build Great Wall', 1); }
step "c1" { COMMIT; }
step rx1 { SELECT count(*) FROM person WHERE person_id = 1 AND is_project_manager; }
step wy1 { INSERT INTO project VALUES (101, 'Build Great Wall', 1); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "ry2" { SELECT count(*) FROM project WHERE project_manager = 1; }
step "wx2" { UPDATE person SET is_project_manager = false WHERE person_id = 1; }
step "c2" { COMMIT; }
step ry2 { SELECT count(*) FROM project WHERE project_manager = 1; }
step wx2 { UPDATE person SET is_project_manager = false WHERE person_id = 1; }
step c2 { COMMIT; }

View File

@ -14,29 +14,29 @@ teardown
drop table child, parent;
}
session "s1"
step "s1b" { BEGIN; }
step "s1l" { INSERT INTO child VALUES (1); }
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN; }
step s1l { INSERT INTO child VALUES (1); }
step s1c { COMMIT; }
session "s2"
step "s2b" { BEGIN; }
step "s2l" { INSERT INTO child VALUES (1); }
step "s2c" { COMMIT; }
session s2
step s2b { BEGIN; }
step s2l { INSERT INTO child VALUES (1); }
step s2c { COMMIT; }
session "s3"
step "s3b" { BEGIN; }
step "s3u" { UPDATE parent SET c=lower(c); } # no key update
step "s3u2" { UPDATE parent SET i = i; } # key update
step "s3svu" { SAVEPOINT f; UPDATE parent SET c = 'bbb'; ROLLBACK TO f; }
step "s3d" { DELETE FROM parent; }
step "s3c" { COMMIT; }
session s3
step s3b { BEGIN; }
step s3u { UPDATE parent SET c=lower(c); } # no key update
step s3u2 { UPDATE parent SET i = i; } # key update
step s3svu { SAVEPOINT f; UPDATE parent SET c = 'bbb'; ROLLBACK TO f; }
step s3d { DELETE FROM parent; }
step s3c { COMMIT; }
permutation "s1b" "s1l" "s2b" "s2l" "s3b" "s3u" "s3d" "s1c" "s2c" "s3c"
permutation "s1b" "s1l" "s2b" "s2l" "s3b" "s3u" "s3svu" "s3d" "s1c" "s2c" "s3c"
permutation "s1b" "s1l" "s2b" "s2l" "s3b" "s3u2" "s3d" "s1c" "s2c" "s3c"
permutation "s1b" "s1l" "s2b" "s2l" "s3b" "s3u2" "s3svu" "s3d" "s1c" "s2c" "s3c"
permutation "s1b" "s1l" "s3b" "s3u" "s3d" "s1c" "s3c"
permutation "s1b" "s1l" "s3b" "s3u" "s3svu" "s3d" "s1c" "s3c"
permutation "s1b" "s1l" "s3b" "s3u2" "s3d" "s1c" "s3c"
permutation "s1b" "s1l" "s3b" "s3u2" "s3svu" "s3d" "s1c" "s3c"
permutation s1b s1l s2b s2l s3b s3u s3d s1c s2c s3c
permutation s1b s1l s2b s2l s3b s3u s3svu s3d s1c s2c s3c
permutation s1b s1l s2b s2l s3b s3u2 s3d s1c s2c s3c
permutation s1b s1l s2b s2l s3b s3u2 s3svu s3d s1c s2c s3c
permutation s1b s1l s3b s3u s3d s1c s3c
permutation s1b s1l s3b s3u s3svu s3d s1c s3c
permutation s1b s1l s3b s3u2 s3d s1c s3c
permutation s1b s1l s3b s3u2 s3svu s3d s1c s3c

View File

@ -10,27 +10,27 @@ teardown
DROP TABLE test;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r1" { SELECT * FROM test WHERE i = 42; }
step "w1" { INSERT INTO test VALUES (42); }
step "c1" { COMMIT; }
step r1 { SELECT * FROM test WHERE i = 42; }
step w1 { INSERT INTO test VALUES (42); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r2" { SELECT * FROM test WHERE i = 42; }
step "w2" { INSERT INTO test VALUES (42); }
step "c2" { COMMIT; }
step r2 { SELECT * FROM test WHERE i = 42; }
step w2 { INSERT INTO test VALUES (42); }
step c2 { COMMIT; }
# Two SSI transactions see that there is no row with value 42
# in the table, then try to insert that value; T1 inserts,
# and then T2 blocks waiting for T1 to commit. Finally,
# T2 reports a serialization failure.
permutation "r1" "r2" "w1" "w2" "c1" "c2"
permutation r1 r2 w1 w2 c1 c2
# If the value is already visible before T2 begins, then a
# regular unique constraint violation should still be raised
# by T2.
permutation "r1" "w1" "c1" "r2" "w2" "c2"
permutation r1 w1 c1 r2 w2 c2

View File

@ -20,14 +20,14 @@ teardown
DROP TABLE test;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rw1" { SELECT insert_unique(1, '1'); }
step "c1" { COMMIT; }
step rw1 { SELECT insert_unique(1, '1'); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rw2" { SELECT insert_unique(1, '2'); }
step "c2" { COMMIT; }
step rw2 { SELECT insert_unique(1, '2'); }
step c2 { COMMIT; }
permutation "rw1" "rw2" "c1" "c2"
permutation rw1 rw2 c1 c2

View File

@ -17,27 +17,27 @@ teardown
DROP TABLE invoice;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r1" { SELECT COALESCE(MAX(invoice_number) + 1, 1) FROM invoice WHERE year = 2016; }
step "w1" { INSERT INTO invoice VALUES (2016, 3); }
step "c1" { COMMIT; }
step r1 { SELECT COALESCE(MAX(invoice_number) + 1, 1) FROM invoice WHERE year = 2016; }
step w1 { INSERT INTO invoice VALUES (2016, 3); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r2" { SELECT COALESCE(MAX(invoice_number) + 1, 1) FROM invoice WHERE year = 2016; }
step "w2" { INSERT INTO invoice VALUES (2016, 3); }
step "c2" { COMMIT; }
step r2 { SELECT COALESCE(MAX(invoice_number) + 1, 1) FROM invoice WHERE year = 2016; }
step w2 { INSERT INTO invoice VALUES (2016, 3); }
step c2 { COMMIT; }
# if they both read first then there should be an SSI conflict
permutation "r1" "r2" "w1" "w2" "c1" "c2"
permutation r1 r2 w1 w2 c1 c2
# cases where one session doesn't explicitly read before writing:
# if s2 doesn't explicitly read, then trying to insert the value
# generates a unique constraint violation after s1 commits, as if s2
# ran after s1
permutation "r1" "w1" "w2" "c1" "c2"
permutation r1 w1 w2 c1 c2
# if s1 doesn't explicitly read, but s2 does, then s1 inserts and
# commits first, should s2 experience an SSI failure instead of a
@ -45,4 +45,4 @@ permutation "r1" "w1" "w2" "c1" "c2"
# (s1, s2) or (s2, s1) where s1 succeeds, and s2 doesn't see the row
# in an explicit select but then fails to insert due to unique
# constraint violation
permutation "r2" "w1" "w2" "c1" "c2"
permutation r2 w1 w2 c1 c2

View File

@ -10,17 +10,17 @@ teardown
DROP TABLE test;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r1" { SELECT * FROM test; }
step "w1" { INSERT INTO test VALUES (42); }
step "c1" { COMMIT; }
step r1 { SELECT * FROM test; }
step w1 { INSERT INTO test VALUES (42); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r2" { SELECT * FROM test; }
step "w2" { INSERT INTO test VALUES (42); }
step "c2" { COMMIT; }
step r2 { SELECT * FROM test; }
step w2 { INSERT INTO test VALUES (42); }
step c2 { COMMIT; }
# Two SSI transactions see that there is no row with value 42
# in the table, then try to insert that value; T1 inserts,
@ -30,10 +30,10 @@ step "c2" { COMMIT; }
# (In an earlier version of Postgres, T2 would report a unique
# constraint violation).
permutation "r1" "r2" "w1" "w2" "c1" "c2"
permutation r1 r2 w1 w2 c1 c2
# If the value is already visible before T2 begins, then a
# regular unique constraint violation should still be raised
# by T2.
permutation "r1" "w1" "c1" "r2" "w2" "c2"
permutation r1 w1 c1 r2 w2 c2

View File

@ -30,18 +30,18 @@ teardown
DROP TABLE ctl, receipt;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rxwy1" { INSERT INTO receipt VALUES (3, (SELECT deposit_date FROM ctl WHERE k = 'receipt'), 4.00); }
step "c1" { COMMIT; }
step rxwy1 { INSERT INTO receipt VALUES (3, (SELECT deposit_date FROM ctl WHERE k = 'receipt'), 4.00); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wx2" { UPDATE ctl SET deposit_date = DATE '2008-12-23' WHERE k = 'receipt'; }
step "c2" { COMMIT; }
step wx2 { UPDATE ctl SET deposit_date = DATE '2008-12-23' WHERE k = 'receipt'; }
step c2 { COMMIT; }
session "s3"
session s3
setup { BEGIN ISOLATION LEVEL SERIALIZABLE, READ ONLY; }
step "rx3" { SELECT * FROM ctl WHERE k = 'receipt'; }
step "ry3" { SELECT * FROM receipt WHERE deposit_date = DATE '2008-12-22'; }
step "c3" { COMMIT; }
step rx3 { SELECT * FROM ctl WHERE k = 'receipt'; }
step ry3 { SELECT * FROM receipt WHERE deposit_date = DATE '2008-12-22'; }
step c3 { COMMIT; }

View File

@ -18,15 +18,15 @@ teardown
DROP TABLE a, b;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx1" { SELECT i FROM a WHERE i = 1; }
step "wy1" { INSERT INTO b VALUES (1); }
step "c1" { COMMIT; }
step rx1 { SELECT i FROM a WHERE i = 1; }
step wy1 { INSERT INTO b VALUES (1); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx2" { SELECT i FROM a WHERE i = 1; }
step "ry2" { SELECT a_id FROM b WHERE a_id = 1; }
step "wx2" { DELETE FROM a WHERE i = 1; }
step "c2" { COMMIT; }
step rx2 { SELECT i FROM a WHERE i = 1; }
step ry2 { SELECT a_id FROM b WHERE a_id = 1; }
step wx2 { DELETE FROM a WHERE i = 1; }
step c2 { COMMIT; }

View File

@ -41,13 +41,13 @@ teardown
DROP FUNCTION ri_child();
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wxry1" { INSERT INTO child (parent_id) VALUES (0); }
step "c1" { COMMIT; }
step wxry1 { INSERT INTO child (parent_id) VALUES (0); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "r2" { SELECT TRUE; }
step "wyrx2" { DELETE FROM parent WHERE parent_id = 0; }
step "c2" { COMMIT; }
step r2 { SELECT TRUE; }
step wyrx2 { DELETE FROM parent WHERE parent_id = 0; }
step c2 { COMMIT; }

View File

@ -19,12 +19,12 @@ teardown
DROP TABLE test;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rwx1" { UPDATE test SET t = 'apple' WHERE t = 'pear'; }
step "c1" { COMMIT; }
step rwx1 { UPDATE test SET t = 'apple' WHERE t = 'pear'; }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rwx2" { UPDATE test SET t = 'pear' WHERE t = 'apple'}
step "c2" { COMMIT; }
step rwx2 { UPDATE test SET t = 'pear' WHERE t = 'apple'}
step c2 { COMMIT; }

View File

@ -15,27 +15,27 @@ teardown
DROP TABLE queue;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM queue ORDER BY id FOR SHARE SKIP LOCKED LIMIT 1; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM queue ORDER BY id FOR SHARE SKIP LOCKED LIMIT 1; }
step s1b { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM queue ORDER BY id FOR SHARE SKIP LOCKED LIMIT 1; }
step "s2b" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s2c" { COMMIT; }
step s2a { SELECT * FROM queue ORDER BY id FOR SHARE SKIP LOCKED LIMIT 1; }
step s2b { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s2c { COMMIT; }
# s1 and s2 both get SHARE lock, creating a multixact lock, then s2
# tries to update to UPDATE but skips the record because it can't
# acquire a multixact lock
permutation "s1a" "s2a" "s2b" "s1b" "s2c"
permutation s1a s2a s2b s1b s2c
# the same but with the SHARE locks acquired in a different order, so
# s2 again skips because it can't acquired a multixact lock
permutation "s2a" "s1a" "s2b" "s1b" "s2c"
permutation s2a s1a s2b s1b s2c
# s2 acquires SHARE then UPDATE, then s1 tries to acquire SHARE but
# can't so skips the first record because it can't acquire a regular
# lock
permutation "s2a" "s2b" "s1a" "s1b" "s2c"
permutation s2a s2b s1a s1b s2c

View File

@ -15,22 +15,22 @@ teardown
DROP TABLE queue;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM queue ORDER BY id FOR UPDATE LIMIT 1; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM queue ORDER BY id FOR UPDATE LIMIT 1; }
step s1b { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM queue ORDER BY id FOR UPDATE LIMIT 1; }
step "s2b" { COMMIT; }
step s2a { SELECT * FROM queue ORDER BY id FOR UPDATE LIMIT 1; }
step s2b { COMMIT; }
session "s3"
session s3
setup { BEGIN; }
step "s3a" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s3b" { COMMIT; }
step s3a { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s3b { COMMIT; }
# s3 skips to the second record because it can't obtain the tuple lock
# (s2 holds the tuple lock because it is next in line to obtain the
# row lock, and s1 holds the row lock)
permutation "s1a" "s2a" "s3a" "s1b" "s2b" "s3b"
permutation s1a s2a s3a s1b s2b s3b

View File

@ -14,18 +14,18 @@ teardown
DROP TABLE foo;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM foo WHERE pg_advisory_lock(0) IS NOT NULL ORDER BY id LIMIT 1 FOR UPDATE SKIP LOCKED; }
step "s1b" { COMMIT; }
step s1a { SELECT * FROM foo WHERE pg_advisory_lock(0) IS NOT NULL ORDER BY id LIMIT 1 FOR UPDATE SKIP LOCKED; }
step s1b { COMMIT; }
session "s2"
step "s2a" { SELECT pg_advisory_lock(0); }
step "s2b" { UPDATE foo SET data = data WHERE id = 1; }
step "s2c" { BEGIN; }
step "s2d" { UPDATE foo SET data = data WHERE id = 1; }
step "s2e" { SELECT pg_advisory_unlock(0); }
step "s2f" { COMMIT; }
session s2
step s2a { SELECT pg_advisory_lock(0); }
step s2b { UPDATE foo SET data = data WHERE id = 1; }
step s2c { BEGIN; }
step s2d { UPDATE foo SET data = data WHERE id = 1; }
step s2e { SELECT pg_advisory_unlock(0); }
step s2f { COMMIT; }
# s1 takes a snapshot but then waits on an advisory lock, then s2
# updates the row in one transaction, then again in another without
@ -33,4 +33,4 @@ step "s2f" { COMMIT; }
# because it has a snapshot that sees the older version, we reach the
# waiting code in EvalPlanQualFetch which skips rows when in SKIP
# LOCKED mode, so s1 sees the second row
permutation "s2a" "s1a" "s2b" "s2c" "s2d" "s2e" "s1b" "s2f"
permutation s2a s1a s2b s2c s2d s2e s1b s2f

View File

@ -15,14 +15,14 @@ teardown
DROP TABLE queue;
}
session "s1"
session s1
setup { BEGIN; }
step "s1a" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s1b" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s1c" { COMMIT; }
step s1a { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s1b { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s1c { COMMIT; }
session "s2"
session s2
setup { BEGIN; }
step "s2a" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s2b" { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step "s2c" { COMMIT; }
step s2a { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s2b { SELECT * FROM queue ORDER BY id FOR UPDATE SKIP LOCKED LIMIT 1; }
step s2c { COMMIT; }

View File

@ -25,14 +25,14 @@ teardown
DROP TABLE statute, offense;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rx1" { SELECT count(*) FROM statute WHERE statute_cite = '123.45(1)a' AND eff_date <= DATE '2009-05-15' AND (exp_date IS NULL OR exp_date > DATE '2009-05-15'); }
step "wy1" { INSERT INTO offense VALUES (1, '123.45(1)a', DATE '2009-05-15'); }
step "c1" { COMMIT; }
step rx1 { SELECT count(*) FROM statute WHERE statute_cite = '123.45(1)a' AND eff_date <= DATE '2009-05-15' AND (exp_date IS NULL OR exp_date > DATE '2009-05-15'); }
step wy1 { INSERT INTO offense VALUES (1, '123.45(1)a', DATE '2009-05-15'); }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "ry2" { SELECT count(*) FROM offense WHERE statute_cite = '123.45(1)a' AND offense_date >= DATE '2008-01-01'; }
step "wx2" { DELETE FROM statute WHERE statute_cite = '123.45(1)a' AND eff_date = DATE '2008-01-01'; }
step "c2" { COMMIT; }
step ry2 { SELECT count(*) FROM offense WHERE statute_cite = '123.45(1)a' AND offense_date >= DATE '2008-01-01'; }
step wx2 { DELETE FROM statute WHERE statute_cite = '123.45(1)a' AND eff_date = DATE '2008-01-01'; }
step c2 { COMMIT; }

View File

@ -11,20 +11,20 @@ teardown
DROP TABLE accounts;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "rdtbl" { SELECT * FROM accounts; }
step "wrtbl" { UPDATE accounts SET balance = balance + 100; }
step rdtbl { SELECT * FROM accounts; }
step wrtbl { UPDATE accounts SET balance = balance + 100; }
teardown { ABORT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "sto" { SET statement_timeout = '10ms'; }
step "lto" { SET lock_timeout = '10ms'; }
step "lsto" { SET lock_timeout = '10ms'; SET statement_timeout = '10s'; }
step "slto" { SET lock_timeout = '10s'; SET statement_timeout = '10ms'; }
step "locktbl" { LOCK TABLE accounts; }
step "update" { DELETE FROM accounts WHERE accountid = 'checking'; }
step sto { SET statement_timeout = '10ms'; }
step lto { SET lock_timeout = '10ms'; }
step lsto { SET lock_timeout = '10ms'; SET statement_timeout = '10s'; }
step slto { SET lock_timeout = '10s'; SET statement_timeout = '10ms'; }
step locktbl { LOCK TABLE accounts; }
step update { DELETE FROM accounts WHERE accountid = 'checking'; }
teardown { ABORT; }
# It's possible that the isolation tester will not observe the final
@ -32,18 +32,18 @@ teardown { ABORT; }
# We can ensure consistent test output by marking those steps with (*).
# statement timeout, table-level lock
permutation "rdtbl" "sto" "locktbl"(*)
permutation rdtbl sto locktbl(*)
# lock timeout, table-level lock
permutation "rdtbl" "lto" "locktbl"(*)
permutation rdtbl lto locktbl(*)
# lock timeout expires first, table-level lock
permutation "rdtbl" "lsto" "locktbl"(*)
permutation rdtbl lsto locktbl(*)
# statement timeout expires first, table-level lock
permutation "rdtbl" "slto" "locktbl"(*)
permutation rdtbl slto locktbl(*)
# statement timeout, row-level lock
permutation "wrtbl" "sto" "update"(*)
permutation wrtbl sto update(*)
# lock timeout, row-level lock
permutation "wrtbl" "lto" "update"(*)
permutation wrtbl lto update(*)
# lock timeout expires first, row-level lock
permutation "wrtbl" "lsto" "update"(*)
permutation wrtbl lsto update(*)
# statement timeout expires first, row-level lock
permutation "wrtbl" "slto" "update"(*)
permutation wrtbl slto update(*)

View File

@ -15,14 +15,14 @@ teardown
DROP TABLE accounts;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wx1" { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; }
step "rxy1" { SELECT SUM(balance) FROM accounts; }
step "c1" { COMMIT; }
step wx1 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; }
step rxy1 { SELECT SUM(balance) FROM accounts; }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wy2" { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'savings'; }
step "rxy2" { SELECT SUM(balance) FROM accounts; }
step "c2" { COMMIT; }
step wy2 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'savings'; }
step rxy2 { SELECT SUM(balance) FROM accounts; }
step c2 { COMMIT; }

View File

@ -11,53 +11,53 @@ teardown {
DROP TABLE multixact_conflict;
}
session "s1"
step "s1_begin" { BEGIN; }
step "s1_lcksvpt" { SELECT * FROM multixact_conflict FOR KEY SHARE; SAVEPOINT foo; }
step "s1_tuplock1" { SELECT * FROM multixact_conflict FOR KEY SHARE; }
step "s1_tuplock2" { SELECT * FROM multixact_conflict FOR SHARE; }
step "s1_tuplock3" { SELECT * FROM multixact_conflict FOR NO KEY UPDATE; }
step "s1_tuplock4" { SELECT * FROM multixact_conflict FOR UPDATE; }
step "s1_commit" { COMMIT; }
session s1
step s1_begin { BEGIN; }
step s1_lcksvpt { SELECT * FROM multixact_conflict FOR KEY SHARE; SAVEPOINT foo; }
step s1_tuplock1 { SELECT * FROM multixact_conflict FOR KEY SHARE; }
step s1_tuplock2 { SELECT * FROM multixact_conflict FOR SHARE; }
step s1_tuplock3 { SELECT * FROM multixact_conflict FOR NO KEY UPDATE; }
step s1_tuplock4 { SELECT * FROM multixact_conflict FOR UPDATE; }
step s1_commit { COMMIT; }
session "s2"
step "s2_tuplock1" { SELECT * FROM multixact_conflict FOR KEY SHARE; }
step "s2_tuplock2" { SELECT * FROM multixact_conflict FOR SHARE; }
step "s2_tuplock3" { SELECT * FROM multixact_conflict FOR NO KEY UPDATE; }
step "s2_tuplock4" { SELECT * FROM multixact_conflict FOR UPDATE; }
session s2
step s2_tuplock1 { SELECT * FROM multixact_conflict FOR KEY SHARE; }
step s2_tuplock2 { SELECT * FROM multixact_conflict FOR SHARE; }
step s2_tuplock3 { SELECT * FROM multixact_conflict FOR NO KEY UPDATE; }
step s2_tuplock4 { SELECT * FROM multixact_conflict FOR UPDATE; }
# The version with savepoints test the multixact cases
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock1" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock1" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock1" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock1" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock2" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock2" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock2" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock2" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock3" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock3" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock3" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock3" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock4" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock4" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock4" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_lcksvpt" "s1_tuplock4" "s2_tuplock4" "s1_commit"
permutation s1_begin s1_lcksvpt s1_tuplock1 s2_tuplock1 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock1 s2_tuplock2 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock1 s2_tuplock3 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock1 s2_tuplock4 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock1 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock2 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock3 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock2 s2_tuplock4 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock3 s2_tuplock1 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock3 s2_tuplock2 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock3 s2_tuplock3 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock3 s2_tuplock4 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock4 s2_tuplock1 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock4 s2_tuplock2 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock4 s2_tuplock3 s1_commit
permutation s1_begin s1_lcksvpt s1_tuplock4 s2_tuplock4 s1_commit
# no multixacts here
permutation "s1_begin" "s1_tuplock1" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_tuplock1" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_tuplock1" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_tuplock1" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_tuplock2" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_tuplock2" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_tuplock2" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_tuplock2" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_tuplock3" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_tuplock3" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_tuplock3" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_tuplock3" "s2_tuplock4" "s1_commit"
permutation "s1_begin" "s1_tuplock4" "s2_tuplock1" "s1_commit"
permutation "s1_begin" "s1_tuplock4" "s2_tuplock2" "s1_commit"
permutation "s1_begin" "s1_tuplock4" "s2_tuplock3" "s1_commit"
permutation "s1_begin" "s1_tuplock4" "s2_tuplock4" "s1_commit"
permutation s1_begin s1_tuplock1 s2_tuplock1 s1_commit
permutation s1_begin s1_tuplock1 s2_tuplock2 s1_commit
permutation s1_begin s1_tuplock1 s2_tuplock3 s1_commit
permutation s1_begin s1_tuplock1 s2_tuplock4 s1_commit
permutation s1_begin s1_tuplock2 s2_tuplock1 s1_commit
permutation s1_begin s1_tuplock2 s2_tuplock2 s1_commit
permutation s1_begin s1_tuplock2 s2_tuplock3 s1_commit
permutation s1_begin s1_tuplock2 s2_tuplock4 s1_commit
permutation s1_begin s1_tuplock3 s2_tuplock1 s1_commit
permutation s1_begin s1_tuplock3 s2_tuplock2 s1_commit
permutation s1_begin s1_tuplock3 s2_tuplock3 s1_commit
permutation s1_begin s1_tuplock3 s2_tuplock4 s1_commit
permutation s1_begin s1_tuplock4 s2_tuplock1 s1_commit
permutation s1_begin s1_tuplock4 s2_tuplock2 s1_commit
permutation s1_begin s1_tuplock4 s2_tuplock3 s1_commit
permutation s1_begin s1_tuplock4 s2_tuplock4 s1_commit

View File

@ -8,30 +8,30 @@ teardown {
DROP TABLE pktab;
}
session "s1"
step "s1_advlock" {
session s1
step s1_advlock {
SELECT pg_advisory_lock(142857),
pg_advisory_lock(285714),
pg_advisory_lock(571428);
}
step "s1_chain" { UPDATE pktab SET data = DEFAULT; }
step "s1_begin" { BEGIN; }
step "s1_grablock" { SELECT * FROM pktab FOR KEY SHARE; }
step "s1_advunlock1" { SELECT pg_advisory_unlock(142857); }
step "s1_advunlock2" { SELECT pg_advisory_unlock(285714); }
step "s1_advunlock3" { SELECT pg_advisory_unlock(571428); }
step "s1_commit" { COMMIT; }
step s1_chain { UPDATE pktab SET data = DEFAULT; }
step s1_begin { BEGIN; }
step s1_grablock { SELECT * FROM pktab FOR KEY SHARE; }
step s1_advunlock1 { SELECT pg_advisory_unlock(142857); }
step s1_advunlock2 { SELECT pg_advisory_unlock(285714); }
step s1_advunlock3 { SELECT pg_advisory_unlock(571428); }
step s1_commit { COMMIT; }
session "s2"
step "s2_update" { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(142857) IS NOT NULL; }
session s2
step s2_update { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(142857) IS NOT NULL; }
session "s3"
step "s3_update" { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(285714) IS NOT NULL; }
session s3
step s3_update { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(285714) IS NOT NULL; }
session "s4"
step "s4_update" { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(571428) IS NOT NULL; }
session s4
step s4_update { UPDATE pktab SET data = DEFAULT WHERE pg_advisory_lock_shared(571428) IS NOT NULL; }
# We use blocker annotations on the s1_advunlockN steps so that we will not
# move on to the next step until the other session's released step finishes.
# This ensures stable ordering of the test output.
permutation "s1_advlock" "s2_update" "s3_update" "s4_update" "s1_chain" "s1_begin" "s1_grablock" "s1_advunlock1"("s2_update") "s1_advunlock2"("s3_update") "s1_advunlock3"("s4_update") "s1_commit"
permutation s1_advlock s2_update s3_update s4_update s1_chain s1_begin s1_grablock s1_advunlock1(s2_update) s1_advunlock2(s3_update) s1_advunlock3(s4_update) s1_commit

View File

@ -16,54 +16,54 @@ teardown
drop table tlu_job;
}
session "s0"
step "s0_begin" { begin; }
step "s0_keyshare" { select id from tlu_job where id = 1 for key share;}
step "s0_rollback" { rollback; }
session s0
step s0_begin { begin; }
step s0_keyshare { select id from tlu_job where id = 1 for key share;}
step s0_rollback { rollback; }
session "s1"
session s1
setup { begin; }
step "s1_keyshare" { select id from tlu_job where id = 1 for key share;}
step "s1_share" { select id from tlu_job where id = 1 for share; }
step "s1_fornokeyupd" { select id from tlu_job where id = 1 for no key update; }
step "s1_update" { update tlu_job set name = 'b' where id = 1; }
step "s1_savept_e" { savepoint s1_e; }
step "s1_savept_f" { savepoint s1_f; }
step "s1_rollback_e" { rollback to s1_e; }
step "s1_rollback_f" { rollback to s1_f; }
step "s1_rollback" { rollback; }
step "s1_commit" { commit; }
step s1_keyshare { select id from tlu_job where id = 1 for key share;}
step s1_share { select id from tlu_job where id = 1 for share; }
step s1_fornokeyupd { select id from tlu_job where id = 1 for no key update; }
step s1_update { update tlu_job set name = 'b' where id = 1; }
step s1_savept_e { savepoint s1_e; }
step s1_savept_f { savepoint s1_f; }
step s1_rollback_e { rollback to s1_e; }
step s1_rollback_f { rollback to s1_f; }
step s1_rollback { rollback; }
step s1_commit { commit; }
session "s2"
session s2
setup { begin; }
step "s2_for_keyshare" { select id from tlu_job where id = 1 for key share; }
step "s2_fornokeyupd" { select id from tlu_job where id = 1 for no key update; }
step "s2_for_update" { select id from tlu_job where id = 1 for update; }
step "s2_update" { update tlu_job set name = 'b' where id = 1; }
step "s2_delete" { delete from tlu_job where id = 1; }
step "s2_rollback" { rollback; }
step s2_for_keyshare { select id from tlu_job where id = 1 for key share; }
step s2_fornokeyupd { select id from tlu_job where id = 1 for no key update; }
step s2_for_update { select id from tlu_job where id = 1 for update; }
step s2_update { update tlu_job set name = 'b' where id = 1; }
step s2_delete { delete from tlu_job where id = 1; }
step s2_rollback { rollback; }
session "s3"
session s3
setup { begin; }
step "s3_keyshare" { select id from tlu_job where id = 1 for key share; }
step "s3_share" { select id from tlu_job where id = 1 for share; }
step "s3_for_update" { select id from tlu_job where id = 1 for update; }
step "s3_update" { update tlu_job set name = 'c' where id = 1; }
step "s3_delete" { delete from tlu_job where id = 1; }
step "s3_rollback" { rollback; }
step "s3_commit" { commit; }
step s3_keyshare { select id from tlu_job where id = 1 for key share; }
step s3_share { select id from tlu_job where id = 1 for share; }
step s3_for_update { select id from tlu_job where id = 1 for update; }
step s3_update { update tlu_job set name = 'c' where id = 1; }
step s3_delete { delete from tlu_job where id = 1; }
step s3_rollback { rollback; }
step s3_commit { commit; }
# test that s2 will not deadlock with s3 when s1 is rolled back
permutation "s1_share" "s2_for_update" "s3_share" "s3_for_update" "s1_rollback" "s3_rollback" "s2_rollback"
permutation s1_share s2_for_update s3_share s3_for_update s1_rollback s3_rollback s2_rollback
# test that update does not cause deadlocks if it can proceed
permutation "s1_keyshare" "s2_for_update" "s3_keyshare" "s1_update" "s3_update" "s1_rollback" "s3_rollback" "s2_rollback"
permutation "s1_keyshare" "s2_for_update" "s3_keyshare" "s1_update" "s3_update" "s1_commit" "s3_rollback" "s2_rollback"
permutation s1_keyshare s2_for_update s3_keyshare s1_update s3_update s1_rollback s3_rollback s2_rollback
permutation s1_keyshare s2_for_update s3_keyshare s1_update s3_update s1_commit s3_rollback s2_rollback
# test that delete does not cause deadlocks if it can proceed
permutation "s1_keyshare" "s2_for_update" "s3_keyshare" "s3_delete" "s1_rollback" "s3_rollback" "s2_rollback"
permutation "s1_keyshare" "s2_for_update" "s3_keyshare" "s3_delete" "s1_rollback" "s3_commit" "s2_rollback"
permutation s1_keyshare s2_for_update s3_keyshare s3_delete s1_rollback s3_rollback s2_rollback
permutation s1_keyshare s2_for_update s3_keyshare s3_delete s1_rollback s3_commit s2_rollback
# test that sessions that don't upgrade locks acquire them in order
permutation "s1_share" "s2_for_update" "s3_for_update" "s1_rollback" "s2_rollback" "s3_rollback"
permutation "s1_share" "s2_update" "s3_update" "s1_rollback" "s2_rollback" "s3_rollback"
permutation "s1_share" "s2_delete" "s3_delete" "s1_rollback" "s2_rollback" "s3_rollback"
permutation s1_share s2_for_update s3_for_update s1_rollback s2_rollback s3_rollback
permutation s1_share s2_update s3_update s1_rollback s2_rollback s3_rollback
permutation s1_share s2_delete s3_delete s1_rollback s2_rollback s3_rollback
# test s2 retrying the overall tuple lock algorithm after initially avoiding deadlock
permutation "s1_keyshare" "s3_for_update" "s2_for_keyshare" "s1_savept_e" "s1_share" "s1_savept_f" "s1_fornokeyupd" "s2_fornokeyupd" "s0_begin" "s0_keyshare" "s1_rollback_f" "s0_keyshare" "s1_rollback_e" "s1_rollback" "s2_rollback" "s0_rollback" "s3_rollback"
permutation s1_keyshare s3_for_update s2_for_keyshare s1_savept_e s1_share s1_savept_f s1_fornokeyupd s2_fornokeyupd s0_begin s0_keyshare s1_rollback_f s0_keyshare s1_rollback_e s1_rollback s2_rollback s0_rollback s3_rollback

View File

@ -24,17 +24,17 @@ teardown
DROP TABLE D1, D2;
}
session "s1"
session s1
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "wx1" { update D1 set id = id + 1; }
step "c1" { COMMIT; }
step wx1 { update D1 set id = id + 1; }
step c1 { COMMIT; }
session "s2"
session s2
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "rxwy2" { update D2 set id = (select id+1 from D1); }
step "c2" { COMMIT; }
step rxwy2 { update D2 set id = (select id+1 from D1); }
step c2 { COMMIT; }
session "s3"
session s3
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
step "ry3" { select id from D2; }
step "c3" { COMMIT; }
step ry3 { select id from D2; }
step c3 { COMMIT; }

View File

@ -16,39 +16,39 @@ teardown
DROP TABLE txn1;
}
session "foo"
session foo
setup { BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step "foo_select" { SELECT * FROM txn0 WHERE id = 42; }
step "foo_insert" { INSERT INTO txn1 SELECT 7, 'foo_insert'; }
step "foo_commit" { COMMIT; }
step foo_select { SELECT * FROM txn0 WHERE id = 42; }
step foo_insert { INSERT INTO txn1 SELECT 7, 'foo_insert'; }
step foo_commit { COMMIT; }
session "bar"
session bar
setup { BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step "bar_select" { SELECT * FROM txn1 WHERE id = 7; }
step "bar_insert" { INSERT INTO txn0 SELECT 42, 'bar_insert'; }
step "bar_commit" { COMMIT; }
step bar_select { SELECT * FROM txn1 WHERE id = 7; }
step bar_insert { INSERT INTO txn0 SELECT 42, 'bar_insert'; }
step bar_commit { COMMIT; }
# This session creates the conditions that confused bar's "conflict out"
# handling in old releases affected by bug:
session "trouble"
session trouble
setup { BEGIN TRANSACTION ISOLATION LEVEL SERIALIZABLE; }
step "trouble_update" { UPDATE txn1 SET val = 'add physical version for "bar_select"' WHERE id = 7; }
step "trouble_delete" { DELETE FROM txn1 WHERE id = 7; }
step "trouble_abort" { ABORT; }
step trouble_update { UPDATE txn1 SET val = 'add physical version for "bar_select"' WHERE id = 7; }
step trouble_delete { DELETE FROM txn1 WHERE id = 7; }
step trouble_abort { ABORT; }
permutation "foo_select"
"bar_insert"
"foo_insert" "foo_commit"
"trouble_update" # Updates tuple...
"bar_select" # Should observe one distinct XID per version
"bar_commit" # "bar" should fail here at the latest
"trouble_abort"
permutation foo_select
bar_insert
foo_insert foo_commit
trouble_update # Updates tuple...
bar_select # Should observe one distinct XID per version
bar_commit # "bar" should fail here at the latest
trouble_abort
# Same as above, but "trouble" session DELETEs this time around
permutation "foo_select"
"bar_insert"
"foo_insert" "foo_commit"
"trouble_delete" # Deletes tuple...
"bar_select" # Should observe foo's XID
"bar_commit" # "bar" should fail here at the latest
"trouble_abort"
permutation foo_select
bar_insert
foo_insert foo_commit
trouble_delete # Deletes tuple...
bar_select # Should observe foo's XID
bar_commit # "bar" should fail here at the latest
trouble_abort

View File

@ -19,20 +19,20 @@ teardown
DROP TABLE users, orders;
}
session "s1"
step "s1b" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "s1u1" { UPDATE orders SET name = 'order of olivier (2)', user_id = 1 WHERE id = 1; }
step "s1u2" { UPDATE orders SET name = 'order of olivier (3)', user_id = 1 WHERE id = 1; }
step "s1c" { COMMIT; }
session s1
step s1b { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step s1u1 { UPDATE orders SET name = 'order of olivier (2)', user_id = 1 WHERE id = 1; }
step s1u2 { UPDATE orders SET name = 'order of olivier (3)', user_id = 1 WHERE id = 1; }
step s1c { COMMIT; }
session "s2"
step "s2b" { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step "s2u" { UPDATE users SET sometime = '1830-10-04' WHERE id = 1; }
step "s2c" { COMMIT; }
session s2
step s2b { BEGIN ISOLATION LEVEL REPEATABLE READ; }
step s2u { UPDATE users SET sometime = '1830-10-04' WHERE id = 1; }
step s2c { COMMIT; }
permutation "s1b" "s2b" "s2u" "s2c" "s1u1" "s1u2" "s1c"
permutation "s1b" "s2b" "s2u" "s1u1" "s2c" "s1u2" "s1c"
permutation "s1b" "s2b" "s1u1" "s2u" "s2c" "s1u2" "s1c"
permutation "s1b" "s1u1" "s2b" "s2u" "s2c" "s1u2" "s1c"
permutation "s1b" "s1u1" "s2b" "s1u2" "s2u" "s2c" "s1c"
permutation "s1b" "s1u1" "s1u2" "s2b" "s2u" "s2c" "s1c"
permutation s1b s2b s2u s2c s1u1 s1u2 s1c
permutation s1b s2b s2u s1u1 s2c s1u2 s1c
permutation s1b s2b s1u1 s2u s2c s1u2 s1c
permutation s1b s1u1 s2b s2u s2c s1u2 s1c
permutation s1b s1u1 s2b s1u2 s2u s2c s1c
permutation s1b s1u1 s1u2 s2b s2u s2c s1c

View File

@ -19,30 +19,30 @@ teardown {
drop table smalltbl;
}
session "worker"
step "open" {
session worker
step open {
begin;
declare c1 cursor for select 1 as dummy from smalltbl;
}
step "fetch1" {
step fetch1 {
fetch next from c1;
}
step "close" {
step close {
commit;
}
step "stats" {
step stats {
select relpages, reltuples from pg_class
where oid='smalltbl'::regclass;
}
session "vacuumer"
step "vac" {
session vacuumer
step vac {
vacuum smalltbl;
}
step "modify" {
step modify {
insert into smalltbl select max(id)+1 from smalltbl;
}
permutation "modify" "vac" "stats"
permutation "modify" "open" "fetch1" "vac" "close" "stats"
permutation "modify" "vac" "stats"
permutation modify vac stats
permutation modify open fetch1 vac close stats
permutation modify vac stats

View File

@ -32,17 +32,21 @@ static void addlitchar(char c);
%x sql
%x qstr
digit [0123456789]
self [,()*]
%x qident
non_newline [^\n\r]
space [ \t\r\f]
comment ("#"{non_newline}*)
digit [0-9]
ident_start [A-Za-z\200-\377_]
ident_cont [A-Za-z\200-\377_0-9\$]
identifier {ident_start}{ident_cont}*
self [,()*]
%%
%{
@ -50,6 +54,7 @@ comment ("#"{non_newline}*)
litbufsize = LITBUF_INIT;
%}
/* Keywords (must appear before the {identifier} rule!) */
notices { return NOTICES; }
permutation { return PERMUTATION; }
session { return SESSION; }
@ -57,33 +62,35 @@ setup { return SETUP; }
step { return STEP; }
teardown { return TEARDOWN; }
{digit}+ {
yylval.integer = atoi(yytext);
return INTEGER;
}
{self} { return yytext[0]; }
/* Whitespace and comments */
[\n] { yyline++; }
{comment} { /* ignore */ }
{space} { /* ignore */ }
/* Quoted strings: "foo" */
/* Plain identifiers */
{identifier} {
yylval.str = pg_strdup(yytext);
return(identifier);
}
/* Quoted identifiers: "foo" */
\" {
litbufpos = 0;
BEGIN(qstr);
BEGIN(qident);
}
<qstr>\" {
<qident>\"\" { addlitchar(yytext[0]); }
<qident>\" {
litbuf[litbufpos] = '\0';
yylval.str = pg_strdup(litbuf);
BEGIN(INITIAL);
return(string_literal);
return(identifier);
}
<qstr>. { addlitchar(yytext[0]); }
<qstr>\n { yyerror("unexpected newline in quoted string"); }
<qstr><<EOF>> { yyerror("unterminated quoted string"); }
<qident>. { addlitchar(yytext[0]); }
<qident>\n { yyerror("unexpected newline in quoted identifier"); }
<qident><<EOF>> { yyerror("unterminated quoted identifier"); }
/* SQL blocks: { UPDATE ... } */
/* We trim leading/trailing whitespace, otherwise they're unprocessed */
"{"{space}* {
litbufpos = 0;
@ -106,6 +113,15 @@ teardown { return TEARDOWN; }
yyerror("unterminated sql block");
}
/* Numbers and punctuation */
{digit}+ {
yylval.integer = atoi(yytext);
return INTEGER;
}
{self} { return yytext[0]; }
/* Anything else is an error */
. {
fprintf(stderr, "syntax error at line %d: unexpected character \"%s\"\n", yyline, yytext);
exit(1);