postgresql/src/test/isolation/specs/timeouts.spec
Tom Lane a7921f71a3 Bump up timeout delays some more in timeouts isolation test.
The buildfarm members using -DCLOBBER_CACHE_ALWAYS still don't like this
test.  Some experimentation shows that on my machine, isolationtester's
query to check for "waiting" state takes 2 to 2.5 seconds to bind+execute
under -DCLOBBER_CACHE_ALWAYS.  Set the timeouts to 5 seconds to leave some
headroom for possibly-slower buildfarm critters.

Really we ought to fix the "waiting" query, which is not only horridly
slow but outright wrong in detail; and then maybe we can back off these
timeouts.  But right now I'm just trying to get the buildfarm green again.
2013-03-20 13:53:43 -04:00

45 lines
1.4 KiB
RPMSpec

# Simple tests for statement_timeout and lock_timeout features
setup
{
CREATE TABLE accounts (accountid text PRIMARY KEY, balance numeric not null);
INSERT INTO accounts VALUES ('checking', 600), ('savings', 600);
}
teardown
{
DROP TABLE accounts;
}
session "s1"
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "rdtbl" { SELECT * FROM accounts; }
step "wrtbl" { UPDATE accounts SET balance = balance + 100; }
teardown { ABORT; }
session "s2"
setup { BEGIN ISOLATION LEVEL READ COMMITTED; }
step "sto" { SET statement_timeout = 5000; }
step "lto" { SET lock_timeout = 5000; }
step "lsto" { SET lock_timeout = 5000; SET statement_timeout = 6000; }
step "slto" { SET lock_timeout = 6000; SET statement_timeout = 5000; }
step "locktbl" { LOCK TABLE accounts; }
step "update" { DELETE FROM accounts WHERE accountid = 'checking'; }
teardown { ABORT; }
# statement timeout, table-level lock
permutation "rdtbl" "sto" "locktbl"
# lock timeout, table-level lock
permutation "rdtbl" "lto" "locktbl"
# lock timeout expires first, table-level lock
permutation "rdtbl" "lsto" "locktbl"
# statement timeout expires first, table-level lock
permutation "rdtbl" "slto" "locktbl"
# statement timeout, row-level lock
permutation "wrtbl" "sto" "update"
# lock timeout, row-level lock
permutation "wrtbl" "lto" "update"
# lock timeout expires first, row-level lock
permutation "wrtbl" "lsto" "update"
# statement timeout expires first, row-level lock
permutation "wrtbl" "slto" "update"