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

Commita7800cf

Browse files
committed
injection_points: Add basic isolation test
This test can act as a template when implementing an isolation test withinjection points, and tracks in a much simpler way some of the behaviorsimplied in the existing isolation test "inplace" that has been added inc35f419. Particularly, a detach does not affect a backend wait; await needs to be interrupted by a wakeup.Reviewed-by: Bertrand DrouvotDiscussion:https://postgr.es/m/ZxGTONm_ctQz--io@paquier.xyz
1 parentf1c141f commita7800cf

File tree

4 files changed

+111
-1
lines changed

4 files changed

+111
-1
lines changed

‎src/test/modules/injection_points/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ PGFILEDESC = "injection_points - facility for injection points"
1313
REGRESS = injection_points reindex_conc
1414
REGRESS_OPTS = --dlpath=$(top_builddir)/src/test/regress
1515

16-
ISOLATION = inplace
16+
ISOLATION =basicinplace
1717

1818
TAP_TESTS = 1
1919

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
Parsed test spec with 2 sessions
2+
3+
starting permutation: wait1 wakeup2 detach2
4+
injection_points_attach
5+
-----------------------
6+
7+
(1 row)
8+
9+
step wait1: SELECT injection_points_run('injection-points-wait'); <waiting ...>
10+
step wakeup2: SELECT injection_points_wakeup('injection-points-wait');
11+
injection_points_wakeup
12+
-----------------------
13+
14+
(1 row)
15+
16+
step wait1: <... completed>
17+
injection_points_run
18+
--------------------
19+
20+
(1 row)
21+
22+
step detach2: SELECT injection_points_detach('injection-points-wait');
23+
injection_points_detach
24+
-----------------------
25+
26+
(1 row)
27+
28+
29+
starting permutation: wait1 detach2 wakeup2
30+
injection_points_attach
31+
-----------------------
32+
33+
(1 row)
34+
35+
step wait1: SELECT injection_points_run('injection-points-wait'); <waiting ...>
36+
step detach2: SELECT injection_points_detach('injection-points-wait');
37+
injection_points_detach
38+
-----------------------
39+
40+
(1 row)
41+
42+
step wakeup2: SELECT injection_points_wakeup('injection-points-wait');
43+
injection_points_wakeup
44+
-----------------------
45+
46+
(1 row)
47+
48+
step wait1: <... completed>
49+
injection_points_run
50+
--------------------
51+
52+
(1 row)
53+
54+
55+
starting permutation: detach2 wait1 wakeup2
56+
injection_points_attach
57+
-----------------------
58+
59+
(1 row)
60+
61+
step detach2: SELECT injection_points_detach('injection-points-wait');
62+
injection_points_detach
63+
-----------------------
64+
65+
(1 row)
66+
67+
step wait1: SELECT injection_points_run('injection-points-wait');
68+
injection_points_run
69+
--------------------
70+
71+
(1 row)
72+
73+
step wakeup2: SELECT injection_points_wakeup('injection-points-wait');
74+
ERROR: could not find injection point injection-points-wait to wake up

‎src/test/modules/injection_points/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ tests += {
4242
},
4343
'isolation': {
4444
'specs': [
45+
'basic',
4546
'inplace',
4647
],
4748
},
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Basic isolation test for injection points.
2+
#
3+
# This checks the interactions between wakeup, wait and detach.
4+
# Feel free to use it as a template when implementing an isolation
5+
# test with injection points.
6+
7+
setup
8+
{
9+
CREATEEXTENSIONinjection_points;
10+
}
11+
teardown
12+
{
13+
DROPEXTENSIONinjection_points;
14+
}
15+
16+
# Wait happens in the first session, wakeup in the second session.
17+
sessions1
18+
setup{
19+
SELECTinjection_points_set_local();
20+
SELECTinjection_points_attach('injection-points-wait','wait');
21+
}
22+
stepwait1{SELECTinjection_points_run('injection-points-wait');}
23+
24+
sessions2
25+
stepwakeup2{SELECTinjection_points_wakeup('injection-points-wait');}
26+
stepdetach2{SELECTinjection_points_detach('injection-points-wait');}
27+
28+
# Detach after wait and wakeup.
29+
permutationwait1wakeup2detach2
30+
31+
# Detach before wakeup. s1 waits until wakeup, ignores the detach.
32+
permutationwait1detach2wakeup2
33+
34+
# Detach before wait does not cause a wait, wakeup produces an error.
35+
permutationdetach2wait1wakeup2

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp