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

Commit b2694ae

Browse files
committed
Reduce test runtime of src/test/modules/snapshot_too_old.
The sto_using_cursor and sto_using_select tests were coded to exercise every permutation of their test steps, but AFAICS there is no value in exercising more than one. This matters because each permutation costs about six seconds, thanks to the "pg_sleep(6)". Perhaps we could reduce that, but the useless permutations seem worth getting rid of in any case. (Note that sto_using_hash_index got it right already.) While here, clean up some other sloppiness such as an unused table. This doesn't make too much difference in interactive testing, since the wasted time is typically masked by parallelization with other tests. However, the buildfarm runs this as a serial step, which means we can expect to shave ~40 seconds from every buildfarm run. That makes it worth back-patching. Discussion: https://postgr.es/m/2515192.1659454702@sss.pgh.pa.us
1 parent 6b67db1 commit b2694ae

File tree

4 files changed

+8
-137
lines changed

4 files changed

+8
-137
lines changed
Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11
Parsed test spec with 2 sessions
22

3-
starting permutation: s1decl s1f1 s1sleep s1f2 s2u
4-
step s1decl: DECLARE cursor1 CURSOR FOR SELECT c FROM sto1;
5-
step s1f1: FETCH FIRST FROM cursor1;
6-
c
7-
-
8-
1
9-
(1 row)
10-
11-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
12-
setting|pg_sleep
13-
-------+--------
14-
0|
15-
(1 row)
16-
17-
step s1f2: FETCH FIRST FROM cursor1;
18-
c
19-
-
20-
1
21-
(1 row)
22-
23-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
24-
253
starting permutation: s1decl s1f1 s1sleep s2u s1f2
264
step s1decl: DECLARE cursor1 CURSOR FOR SELECT c FROM sto1;
275
step s1f1: FETCH FIRST FROM cursor1;
@@ -39,57 +17,3 @@ setting|pg_sleep
3917
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
4018
step s1f2: FETCH FIRST FROM cursor1;
4119
ERROR: snapshot too old
42-
43-
starting permutation: s1decl s1f1 s2u s1sleep s1f2
44-
step s1decl: DECLARE cursor1 CURSOR FOR SELECT c FROM sto1;
45-
step s1f1: FETCH FIRST FROM cursor1;
46-
c
47-
-
48-
1
49-
(1 row)
50-
51-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
52-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
53-
setting|pg_sleep
54-
-------+--------
55-
0|
56-
(1 row)
57-
58-
step s1f2: FETCH FIRST FROM cursor1;
59-
ERROR: snapshot too old
60-
61-
starting permutation: s1decl s2u s1f1 s1sleep s1f2
62-
step s1decl: DECLARE cursor1 CURSOR FOR SELECT c FROM sto1;
63-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
64-
step s1f1: FETCH FIRST FROM cursor1;
65-
c
66-
-
67-
1
68-
(1 row)
69-
70-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
71-
setting|pg_sleep
72-
-------+--------
73-
0|
74-
(1 row)
75-
76-
step s1f2: FETCH FIRST FROM cursor1;
77-
ERROR: snapshot too old
78-
79-
starting permutation: s2u s1decl s1f1 s1sleep s1f2
80-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
81-
step s1decl: DECLARE cursor1 CURSOR FOR SELECT c FROM sto1;
82-
step s1f1: FETCH FIRST FROM cursor1;
83-
c
84-
-
85-
2
86-
(1 row)
87-
88-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
89-
setting|pg_sleep
90-
-------+--------
91-
0|
92-
(1 row)
93-
94-
step s1f2: FETCH FIRST FROM cursor1;
95-
ERROR: snapshot too old
Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,5 @@
11
Parsed test spec with 2 sessions
22

3-
starting permutation: s1f1 s1sleep s1f2 s2u
4-
step s1f1: SELECT c FROM sto1 ORDER BY c LIMIT 1;
5-
c
6-
-
7-
1
8-
(1 row)
9-
10-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
11-
setting|pg_sleep
12-
-------+--------
13-
0|
14-
(1 row)
15-
16-
step s1f2: SELECT c FROM sto1 ORDER BY c LIMIT 1;
17-
c
18-
-
19-
1
20-
(1 row)
21-
22-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
23-
243
starting permutation: s1f1 s1sleep s2u s1f2
254
step s1f1: SELECT c FROM sto1 ORDER BY c LIMIT 1;
265
c
@@ -37,37 +16,3 @@ setting|pg_sleep
3716
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
3817
step s1f2: SELECT c FROM sto1 ORDER BY c LIMIT 1;
3918
ERROR: snapshot too old
40-
41-
starting permutation: s1f1 s2u s1sleep s1f2
42-
step s1f1: SELECT c FROM sto1 ORDER BY c LIMIT 1;
43-
c
44-
-
45-
1
46-
(1 row)
47-
48-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
49-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
50-
setting|pg_sleep
51-
-------+--------
52-
0|
53-
(1 row)
54-
55-
step s1f2: SELECT c FROM sto1 ORDER BY c LIMIT 1;
56-
ERROR: snapshot too old
57-
58-
starting permutation: s2u s1f1 s1sleep s1f2
59-
step s2u: UPDATE sto1 SET c = 1001 WHERE c = 1;
60-
step s1f1: SELECT c FROM sto1 ORDER BY c LIMIT 1;
61-
c
62-
-
63-
2
64-
(1 row)
65-
66-
step s1sleep: SELECT setting, pg_sleep(6) FROM pg_settings WHERE name = 'old_snapshot_threshold';
67-
setting|pg_sleep
68-
-------+--------
69-
0|
70-
(1 row)
71-
72-
step s1f2: SELECT c FROM sto1 ORDER BY c LIMIT 1;
73-
ERROR: snapshot too old

src/test/modules/snapshot_too_old/specs/sto_using_cursor.spec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
# granularity is in minutes.
77
#
88
# Since results depend on the value of old_snapshot_threshold, sneak that into
9-
# the line generated by the sleep, so that a surprising values isn't so hard
9+
# the line generated by the sleep, so that a surprising value isn't so hard
1010
# to identify.
1111

1212
setup
1313
{
1414
CREATE TABLE sto1 (c int NOT NULL);
1515
INSERT INTO sto1 SELECT generate_series(1, 1000);
16-
CREATE TABLE sto2 (c int NOT NULL);
1716
}
1817
setup
1918
{
@@ -22,7 +21,7 @@ setup
2221

2322
teardown
2423
{
25-
DROP TABLE sto1, sto2;
24+
DROP TABLE sto1;
2625
}
2726

2827
session "s1"
@@ -35,3 +34,5 @@ teardown { COMMIT; }
3534

3635
session "s2"
3736
step "s2u" { UPDATE sto1 SET c = 1001 WHERE c = 1; }
37+
38+
permutation "s1decl" "s1f1" "s1sleep" "s2u" "s1f2"

src/test/modules/snapshot_too_old/specs/sto_using_select.spec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@
66
# granularity is in minutes.
77
#
88
# Since results depend on the value of old_snapshot_threshold, sneak that into
9-
# the line generated by the sleep, so that a surprising values isn't so hard
9+
# the line generated by the sleep, so that a surprising value isn't so hard
1010
# to identify.
1111

1212
setup
1313
{
1414
CREATE TABLE sto1 (c int NOT NULL);
1515
INSERT INTO sto1 SELECT generate_series(1, 1000);
16-
CREATE TABLE sto2 (c int NOT NULL);
1716
}
1817
setup
1918
{
@@ -22,7 +21,7 @@ setup
2221

2322
teardown
2423
{
25-
DROP TABLE sto1, sto2;
24+
DROP TABLE sto1;
2625
}
2726

2827
session "s1"
@@ -34,3 +33,5 @@ teardown { COMMIT; }
3433

3534
session "s2"
3635
step "s2u" { UPDATE sto1 SET c = 1001 WHERE c = 1; }
36+
37+
permutation "s1f1" "s1sleep" "s2u" "s1f2"

0 commit comments

Comments
 (0)