Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 42bdaeb

Browse files
committed
Add a regression test for snapshot too old with hash indexes.
Amit Kapila, but I changed the comment not to be a copy-and-paste of an existing one, and instead referred to it. Discussion: http://postgr.es/m/CAA4eK1K0UJswCRf81WwJFO4H=+ZvbmKTNhAps-NkdmHRsq1GnQ@mail.gmail.com
1 parent d8f356e commit 42bdaeb

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

src/test/modules/snapshot_too_old/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# we have to clean those result files explicitly
55
EXTRA_CLEAN = $(pg_regress_clean_files)
66

7-
ISOLATIONCHECKS=sto_using_cursor sto_using_select
7+
ISOLATIONCHECKS=sto_using_cursor sto_using_select sto_using_hash_index
88

99
ifdef USE_PGXS
1010
PG_CONFIG = pg_config
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: noseq s1f1 s2sleep s2u s1f2
4+
step noseq: SET enable_seqscan = false;
5+
step s1f1: SELECT c FROM sto1 where c = 1000;
6+
c
7+
8+
1000
9+
step s2sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
10+
setting pg_sleep
11+
12+
0
13+
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1000;
14+
step s1f2: SELECT c FROM sto1 where c = 1001;
15+
ERROR: snapshot too old
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This test is like sto_using_select, except that we test access via a
2+
# hash index.
3+
4+
setup
5+
{
6+
CREATE TABLE sto1 (c int NOT NULL);
7+
INSERT INTO sto1 SELECT generate_series(1, 1000);
8+
CREATE INDEX idx_sto1 ON sto1 USING HASH (c);
9+
}
10+
setup
11+
{
12+
VACUUM ANALYZE sto1;
13+
}
14+
15+
teardown
16+
{
17+
DROP TABLE sto1;
18+
}
19+
20+
session "s1"
21+
setup { BEGIN ISOLATION LEVEL REPEATABLE READ; }
22+
step "noseq" { SET enable_seqscan = false; }
23+
step "s1f1" { SELECT c FROM sto1 where c = 1000; }
24+
step "s1f2" { SELECT c FROM sto1 where c = 1001; }
25+
teardown { ROLLBACK; }
26+
27+
session "s2"
28+
step "s2sleep" { SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold'; }
29+
step "s2u" { UPDATE sto1 SET c = 1001 WHERE c = 1000; }
30+
31+
permutation "noseq" "s1f1" "s2sleep" "s2u" "s1f2"

0 commit comments

Comments
 (0)