Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9e8fa05

Browse files
committed
Fix new test for CATCACHE_FORCE_RELEASE builds
Two of the isolation tests introduce by commitbc32a12 had aproblem under CATCACHE_FORCE_RELEASE, as evidenced by buildfarm memberprion. An injection point is hit ahead of what the test spec expects,so a session goes to sleep and there's no one there to wait it up. Fixin the simplest possible way, which is to conditionally wake the processup if it's waiting. An alternative output file is necessary to coverboth cases.This suggests a couple of possible improvements to the injection pointsinfrastructure: a conditional wakeup (doing nothing if no one issleeping, as opposed to throwing an error), as well as a way to attachto a point in "deactivated" mode, activated later.Author: Álvaro Herrera <alvherre@kurilemu.de>Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>Discussion:https://postgr.es/m/202511261817.fyixgtt3hqdr@alvherre.pgsql
1 parente396a18 commit9e8fa05

File tree

6 files changed

+312
-2
lines changed

6 files changed

+312
-2
lines changed

‎src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Parsed test spec with 5 sessions
22

3-
starting permutation: s5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
3+
starting permutation:s1_attach_invalidate_catalog_snapshot s4_wakeup_s1_setups5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
44
injection_points_attach
55
-----------------------
66

@@ -16,6 +16,27 @@ injection_points_attach
1616

1717
(1 row)
1818

19+
step s1_attach_invalidate_catalog_snapshot:
20+
SELECT injection_points_attach('invalidate-catalog-snapshot-end', 'wait');
21+
22+
injection_points_attach
23+
-----------------------
24+
25+
(1 row)
26+
27+
step s4_wakeup_s1_setup:
28+
SELECT CASE WHEN
29+
(SELECT pid FROM pg_stat_activity
30+
WHERE wait_event_type = 'InjectionPoint' AND
31+
wait_event = 'invalidate-catalog-snapshot-end') IS NOT NULL
32+
THEN injection_points_wakeup('invalidate-catalog-snapshot-end')
33+
END;
34+
35+
case
36+
----
37+
38+
(1 row)
39+
1940
step s5_noop:
2041
<waiting ...>
2142
step s3_start_create_index:
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Parsed test spec with 5 sessions
2+
3+
starting permutation: s1_attach_invalidate_catalog_snapshot s4_wakeup_s1_setup s5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
4+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
5+
injection_points_attach
6+
-----------------------
7+
8+
(1 row)
9+
10+
injection_points_attach
11+
-----------------------
12+
13+
(1 row)
14+
15+
injection_points_attach
16+
-----------------------
17+
18+
(1 row)
19+
20+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
21+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
22+
step s1_attach_invalidate_catalog_snapshot:
23+
SELECT injection_points_attach('invalidate-catalog-snapshot-end', 'wait');
24+
<waiting ...>
25+
step s4_wakeup_s1_setup:
26+
SELECT CASE WHEN
27+
(SELECT pid FROM pg_stat_activity
28+
WHERE wait_event_type = 'InjectionPoint' AND
29+
wait_event = 'invalidate-catalog-snapshot-end') IS NOT NULL
30+
THEN injection_points_wakeup('invalidate-catalog-snapshot-end')
31+
END;
32+
33+
case
34+
----
35+
36+
(1 row)
37+
38+
step s1_attach_invalidate_catalog_snapshot: <... completed>
39+
injection_points_attach
40+
-----------------------
41+
42+
(1 row)
43+
44+
step s5_noop:
45+
<waiting ...>
46+
step s3_start_create_index:
47+
CREATE UNIQUE INDEX CONCURRENTLY tbl_pkey_special_duplicate ON test.tbl(abs(i)) WHERE i < 10000;
48+
<waiting ...>
49+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
50+
step s1_start_upsert:
51+
INSERT INTO test.tbl VALUES(13,now()) ON CONFLICT (abs(i)) WHERE i < 100 DO UPDATE SET updated_at = now();
52+
<waiting ...>
53+
step s5_noop: <... completed>
54+
step s4_wakeup_define_index_before_set_valid:
55+
SELECT injection_points_detach('define-index-before-set-valid');
56+
SELECT injection_points_wakeup('define-index-before-set-valid');
57+
58+
injection_points_detach
59+
-----------------------
60+
61+
(1 row)
62+
63+
injection_points_wakeup
64+
-----------------------
65+
66+
(1 row)
67+
68+
step s2_start_upsert:
69+
INSERT INTO test.tbl VALUES(13,now()) ON CONFLICT (abs(i)) WHERE i < 100 DO UPDATE SET updated_at = now();
70+
<waiting ...>
71+
step s5_wakeup_s1_from_invalidate_catalog_snapshot:
72+
SELECT injection_points_detach('invalidate-catalog-snapshot-end');
73+
SELECT injection_points_wakeup('invalidate-catalog-snapshot-end');
74+
75+
injection_points_detach
76+
-----------------------
77+
78+
(1 row)
79+
80+
injection_points_wakeup
81+
-----------------------
82+
83+
(1 row)
84+
85+
step s4_wakeup_s2:
86+
SELECT injection_points_detach('exec-insert-before-insert-speculative');
87+
SELECT injection_points_wakeup('exec-insert-before-insert-speculative');
88+
89+
injection_points_detach
90+
-----------------------
91+
92+
(1 row)
93+
94+
injection_points_wakeup
95+
-----------------------
96+
97+
(1 row)
98+
99+
step s4_wakeup_s1:
100+
SELECT injection_points_detach('check-exclusion-or-unique-constraint-no-conflict');
101+
SELECT injection_points_wakeup('check-exclusion-or-unique-constraint-no-conflict');
102+
103+
injection_points_detach
104+
-----------------------
105+
106+
(1 row)
107+
108+
injection_points_wakeup
109+
-----------------------
110+
111+
(1 row)
112+
113+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
114+
step s1_start_upsert: <... completed>
115+
step s2_start_upsert: <... completed>
116+
step s3_start_create_index: <... completed>

‎src/test/modules/injection_points/expected/index-concurrently-upsert.out‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Parsed test spec with 5 sessions
22

3-
starting permutation: s5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
3+
starting permutation:s1_attach_invalidate_catalog_snapshot s4_wakeup_s1_setups5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
44
injection_points_attach
55
-----------------------
66

@@ -16,6 +16,27 @@ injection_points_attach
1616

1717
(1 row)
1818

19+
step s1_attach_invalidate_catalog_snapshot:
20+
SELECT injection_points_attach('invalidate-catalog-snapshot-end', 'wait');
21+
22+
injection_points_attach
23+
-----------------------
24+
25+
(1 row)
26+
27+
step s4_wakeup_s1_setup:
28+
SELECT CASE WHEN
29+
(SELECT pid FROM pg_stat_activity
30+
WHERE wait_event_type = 'InjectionPoint' AND
31+
wait_event = 'invalidate-catalog-snapshot-end') IS NOT NULL
32+
THEN injection_points_wakeup('invalidate-catalog-snapshot-end')
33+
END;
34+
35+
case
36+
----
37+
38+
(1 row)
39+
1940
step s5_noop:
2041
<waiting ...>
2142
step s3_start_create_index:
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Parsed test spec with 5 sessions
2+
3+
starting permutation: s1_attach_invalidate_catalog_snapshot s4_wakeup_s1_setup s5_noop s3_start_create_index s1_start_upsert s4_wakeup_define_index_before_set_valid s2_start_upsert s5_wakeup_s1_from_invalidate_catalog_snapshot s4_wakeup_s2 s4_wakeup_s1
4+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
5+
injection_points_attach
6+
-----------------------
7+
8+
(1 row)
9+
10+
injection_points_attach
11+
-----------------------
12+
13+
(1 row)
14+
15+
injection_points_attach
16+
-----------------------
17+
18+
(1 row)
19+
20+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
21+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
22+
step s1_attach_invalidate_catalog_snapshot:
23+
SELECT injection_points_attach('invalidate-catalog-snapshot-end', 'wait');
24+
<waiting ...>
25+
step s4_wakeup_s1_setup:
26+
SELECT CASE WHEN
27+
(SELECT pid FROM pg_stat_activity
28+
WHERE wait_event_type = 'InjectionPoint' AND
29+
wait_event = 'invalidate-catalog-snapshot-end') IS NOT NULL
30+
THEN injection_points_wakeup('invalidate-catalog-snapshot-end')
31+
END;
32+
33+
case
34+
----
35+
36+
(1 row)
37+
38+
step s1_attach_invalidate_catalog_snapshot: <... completed>
39+
injection_points_attach
40+
-----------------------
41+
42+
(1 row)
43+
44+
step s5_noop:
45+
<waiting ...>
46+
step s3_start_create_index:
47+
CREATE UNIQUE INDEX CONCURRENTLY tbl_pkey_duplicate ON test.tbl(i);
48+
<waiting ...>
49+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
50+
step s1_start_upsert:
51+
INSERT INTO test.tbl VALUES (13,now()) ON CONFLICT (i) DO UPDATE SET updated_at = now();
52+
<waiting ...>
53+
step s5_noop: <... completed>
54+
step s4_wakeup_define_index_before_set_valid:
55+
SELECT injection_points_detach('define-index-before-set-valid');
56+
SELECT injection_points_wakeup('define-index-before-set-valid');
57+
58+
injection_points_detach
59+
-----------------------
60+
61+
(1 row)
62+
63+
injection_points_wakeup
64+
-----------------------
65+
66+
(1 row)
67+
68+
step s2_start_upsert:
69+
INSERT INTO test.tbl VALUES (13,now()) ON CONFLICT (i) DO UPDATE SET updated_at = now();
70+
<waiting ...>
71+
step s5_wakeup_s1_from_invalidate_catalog_snapshot:
72+
SELECT injection_points_detach('invalidate-catalog-snapshot-end');
73+
SELECT injection_points_wakeup('invalidate-catalog-snapshot-end');
74+
75+
injection_points_detach
76+
-----------------------
77+
78+
(1 row)
79+
80+
injection_points_wakeup
81+
-----------------------
82+
83+
(1 row)
84+
85+
step s4_wakeup_s2:
86+
SELECT injection_points_detach('exec-insert-before-insert-speculative');
87+
SELECT injection_points_wakeup('exec-insert-before-insert-speculative');
88+
89+
injection_points_detach
90+
-----------------------
91+
92+
(1 row)
93+
94+
injection_points_wakeup
95+
-----------------------
96+
97+
(1 row)
98+
99+
step s4_wakeup_s1:
100+
SELECT injection_points_detach('check-exclusion-or-unique-constraint-no-conflict');
101+
SELECT injection_points_wakeup('check-exclusion-or-unique-constraint-no-conflict');
102+
103+
injection_points_detach
104+
-----------------------
105+
106+
(1 row)
107+
108+
injection_points_wakeup
109+
-----------------------
110+
111+
(1 row)
112+
113+
s1: NOTICE: notice triggered for injection point pre-invalidate-catalog-snapshot-end
114+
step s1_start_upsert: <... completed>
115+
step s2_start_upsert: <... completed>
116+
step s3_start_create_index: <... completed>

‎src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ setup
2828
SELECTinjection_points_set_local();
2929
SELECTinjection_points_attach('check-exclusion-or-unique-constraint-no-conflict','wait');
3030
SELECTinjection_points_attach('pre-invalidate-catalog-snapshot-end','notice');
31+
}
32+
steps1_attach_invalidate_catalog_snapshot
33+
{
3134
SELECTinjection_points_attach('invalidate-catalog-snapshot-end','wait');
3235
}
3336
steps1_start_upsert
@@ -58,6 +61,19 @@ step s3_start_create_index
5861
}
5962

6063
sessions4
64+
# Step s1_attach_invalidate_catalog_snapshot sleeps or not depending on
65+
# build conditions (CATCACHE_FORCE_RELEASE). Here we send a wakeup signal if
66+
# it's sleeping or do nothing otherwise, and print a null value in either
67+
# case.
68+
steps4_wakeup_s1_setup
69+
{
70+
SELECTCASEWHEN
71+
(SELECTpidFROMpg_stat_activity
72+
WHEREwait_event_type='InjectionPoint'AND
73+
wait_event='invalidate-catalog-snapshot-end')ISNOTNULL
74+
THENinjection_points_wakeup('invalidate-catalog-snapshot-end')
75+
END;
76+
}
6177
steps4_wakeup_s1
6278
{
6379
SELECTinjection_points_detach('check-exclusion-or-unique-constraint-no-conflict');
@@ -85,6 +101,8 @@ step s5_wakeup_s1_from_invalidate_catalog_snapshot
85101
}
86102

87103
permutation
104+
s1_attach_invalidate_catalog_snapshot
105+
s4_wakeup_s1_setup
88106
s5_noop(s1_start_upsertnotices1)
89107
s3_start_create_index(s1_start_upsert,s2_start_upsert)
90108
s1_start_upsert

‎src/test/modules/injection_points/specs/index-concurrently-upsert.spec‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ setup
2727
SELECTinjection_points_set_local();
2828
SELECTinjection_points_attach('check-exclusion-or-unique-constraint-no-conflict','wait');
2929
SELECTinjection_points_attach('pre-invalidate-catalog-snapshot-end','notice');
30+
}
31+
steps1_attach_invalidate_catalog_snapshot
32+
{
3033
SELECTinjection_points_attach('invalidate-catalog-snapshot-end','wait');
3134
}
3235
steps1_start_upsert
@@ -57,6 +60,19 @@ step s3_start_create_index
5760
}
5861

5962
sessions4
63+
# Step s1_attach_invalidate_catalog_snapshot sleeps or not depending on
64+
# build conditions (CATCACHE_FORCE_RELEASE). Here we send a wakeup signal if
65+
# it's sleeping or do nothing otherwise, and print a null value in either
66+
# case.
67+
steps4_wakeup_s1_setup
68+
{
69+
SELECTCASEWHEN
70+
(SELECTpidFROMpg_stat_activity
71+
WHEREwait_event_type='InjectionPoint'AND
72+
wait_event='invalidate-catalog-snapshot-end')ISNOTNULL
73+
THENinjection_points_wakeup('invalidate-catalog-snapshot-end')
74+
END;
75+
}
6076
steps4_wakeup_s1
6177
{
6278
SELECTinjection_points_detach('check-exclusion-or-unique-constraint-no-conflict');
@@ -84,6 +100,8 @@ step s5_wakeup_s1_from_invalidate_catalog_snapshot
84100
}
85101

86102
permutation
103+
s1_attach_invalidate_catalog_snapshot
104+
s4_wakeup_s1_setup
87105
s5_noop(s1_start_upsertnotices1)
88106
s3_start_create_index(s1_start_upsert,s2_start_upsert)
89107
s1_start_upsert

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp