Commit 4b21100
committed
Support loading of injection points
This can be used to load an injection point and prewarm the
backend-level cache before running it, to avoid issues if the point
cannot be loaded due to restrictions in the code path where it would be
run, like a critical section where no memory allocation can happen
(load_external_function() can do allocations when expanding a library
name).
Tests can use a macro called INJECTION_POINT_LOAD() to load an injection
point. The test module injection_points gains some tests, and a SQL
function able to load an injection point.
Based on a request from Andrey Borodin, who has implemented a test for
multixacts requiring this facility.
Reviewed-by: Andrey Borodin
Discussion: https://postgr.es/m/ZkrBE1e2q2wGvsoN@paquier.xyz1 parent 98347b5 commit 4b21100Copy full SHA for 4b21100
File tree
Expand file treeCollapse file tree
7 files changed
+168
-36
lines changedOpen diff view settings
Filter options
- doc/src/sgml
- src
- backend/utils/misc
- include/utils
- test/modules/injection_points
- expected
- sql
Expand file treeCollapse file tree
7 files changed
+168
-36
lines changedOpen diff view settings
Collapse file
+14Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
3618 | 3618 | |
3619 | 3619 | |
3620 | 3620 | |
| 3621 | + |
| 3622 | + |
| 3623 | + |
| 3624 | + |
| 3625 | + |
| 3626 | + |
| 3627 | + |
| 3628 | + |
| 3629 | + |
| 3630 | + |
| 3631 | + |
| 3632 | + |
| 3633 | + |
| 3634 | + |
3621 | 3635 | |
3622 | 3636 | |
3623 | 3637 | |
|
Collapse file
src/backend/utils/misc/injection_point.c
Copy file name to clipboardExpand all lines: src/backend/utils/misc/injection_point.c+85-36Lines changed: 85 additions & 36 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
129 | 129 | |
130 | 130 | |
131 | 131 | |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
132 | 162 | |
133 | 163 | |
134 | 164 | |
135 | 165 | |
136 | 166 | |
137 | | - |
138 | | - |
| 167 | + |
| 168 | + |
139 | 169 | |
140 | 170 | |
141 | 171 | |
142 | 172 | |
143 | | - |
144 | | - |
145 | | - |
146 | 173 | |
147 | 174 | |
148 | 175 | |
| ||
151 | 178 | |
152 | 179 | |
153 | 180 | |
154 | | - |
155 | | - |
156 | | - |
157 | | - |
158 | | - |
| 181 | + |
159 | 182 | |
160 | 183 | |
161 | 184 | |
| ||
278 | 301 | |
279 | 302 | |
280 | 303 | |
| 304 | + |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
| 322 | + |
| 323 | + |
| 324 | + |
| 325 | + |
| 326 | + |
| 327 | + |
| 328 | + |
| 329 | + |
| 330 | + |
| 331 | + |
| 332 | + |
| 333 | + |
| 334 | + |
| 335 | + |
| 336 | + |
| 337 | + |
| 338 | + |
| 339 | + |
| 340 | + |
| 341 | + |
| 342 | + |
| 343 | + |
| 344 | + |
| 345 | + |
| 346 | + |
| 347 | + |
| 348 | + |
| 349 | + |
281 | 350 | |
282 | 351 | |
283 | 352 | |
| ||
290 | 359 | |
291 | 360 | |
292 | 361 | |
293 | | - |
294 | | - |
| 362 | + |
295 | 363 | |
296 | 364 | |
297 | 365 | |
| ||
313 | 381 | |
314 | 382 | |
315 | 383 | |
316 | | - |
| 384 | + |
317 | 385 | |
318 | | - |
319 | | - |
320 | | - |
321 | | - |
322 | | - |
323 | | - |
324 | | - |
325 | | - |
326 | | - |
327 | | - |
328 | | - |
329 | | - |
330 | | - |
331 | | - |
332 | | - |
333 | | - |
334 | | - |
335 | | - |
336 | | - |
337 | | - |
338 | | - |
| 386 | + |
| 387 | + |
339 | 388 | |
340 | 389 | |
341 | 390 | |
342 | | - |
| 391 | + |
343 | 392 | |
344 | 393 | |
345 | 394 | |
346 | | - |
| 395 | + |
347 | 396 | |
348 | 397 | |
349 | 398 | |
|
Collapse file
src/include/utils/injection_point.h
Copy file name to clipboardExpand all lines: src/include/utils/injection_point.h+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
15 | 15 | |
16 | 16 | |
17 | 17 | |
| 18 | + |
18 | 19 | |
19 | 20 | |
| 21 | + |
20 | 22 | |
21 | 23 | |
22 | 24 | |
| ||
34 | 36 | |
35 | 37 | |
36 | 38 | |
| 39 | + |
37 | 40 | |
38 | 41 | |
39 | 42 | |
|
Collapse file
src/test/modules/injection_points/expected/injection_points.out
Copy file name to clipboardExpand all lines: src/test/modules/injection_points/expected/injection_points.out+32Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
128 | 128 | |
129 | 129 | |
130 | 130 | |
| 131 | + |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
| 138 | + |
| 139 | + |
| 140 | + |
| 141 | + |
| 142 | + |
| 143 | + |
| 144 | + |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | + |
| 157 | + |
| 158 | + |
| 159 | + |
| 160 | + |
| 161 | + |
| 162 | + |
131 | 163 | |
132 | 164 | |
133 | 165 | |
|
Collapse file
src/test/modules/injection_points/injection_points--1.0.sql
Copy file name to clipboardExpand all lines: src/test/modules/injection_points/injection_points--1.0.sql+10Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
14 | 14 | |
15 | 15 | |
16 | 16 | |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
17 | 27 | |
18 | 28 | |
19 | 29 | |
|
Collapse file
src/test/modules/injection_points/injection_points.c
Copy file name to clipboardExpand all lines: src/test/modules/injection_points/injection_points.c+17Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
302 | 302 | |
303 | 303 | |
304 | 304 | |
| 305 | + |
| 306 | + |
| 307 | + |
| 308 | + |
| 309 | + |
| 310 | + |
| 311 | + |
| 312 | + |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
| 317 | + |
| 318 | + |
| 319 | + |
| 320 | + |
| 321 | + |
305 | 322 | |
306 | 323 | |
307 | 324 | |
|
Collapse file
src/test/modules/injection_points/sql/injection_points.sql
Copy file name to clipboardExpand all lines: src/test/modules/injection_points/sql/injection_points.sql+7Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
41 | 41 | |
42 | 42 | |
43 | 43 | |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + |
44 | 51 | |
45 | 52 | |
46 | 53 | |
|
0 commit comments