- Notifications
You must be signed in to change notification settings - Fork5
Commit7f7485a
committed
Allow background workers to be started dynamically.
There is a new API, RegisterDynamicBackgroundWorker, which allowsan ordinary user backend to register a new background writer duringnormal running. This means that it's no longer necessary for allbackground workers to be registered during processing ofshared_preload_libraries, although the option of registering workersat that time remains available.When a background worker exits and will not be restarted, theslot previously used by that background worker is automaticallyreleased and becomes available for reuse. Slots used by backgroundworkers that are configured for automatic restart can't (yet) bereleased without shutting down the system.This commit adds a new source file, bgworker.c, and moves someof the existing control logic for background workers there.Previously, there was little enough logic that it made sense tokeep everything in postmaster.c, but not any more.This commit also makes the worker_spi contrib module into anextension and adds a new function, worker_spi_launch, which canbe used to demonstrate the new facility.1 parent233bfe0 commit7f7485a
File tree
13 files changed
+710
-209
lines changed- contrib/worker_spi
- doc/src/sgml
- src
- backend
- postmaster
- storage/ipc
- include
- postmaster
- storage
13 files changed
+710
-209
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
| 6 | + | |
| 7 | + | |
5 | 8 |
| |
6 | 9 |
| |
7 | 10 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + |
Lines changed: 50 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| 45 | + | |
45 | 46 |
| |
46 | 47 |
| |
| 48 | + | |
| 49 | + | |
47 | 50 |
| |
48 | 51 |
| |
49 | 52 |
| |
| |||
153 | 156 |
| |
154 | 157 |
| |
155 | 158 |
| |
156 |
| - | |
157 |
| - | |
| 159 | + | |
| 160 | + | |
158 | 161 |
| |
159 |
| - | |
| 162 | + | |
| 163 | + | |
160 | 164 |
| |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
161 | 175 |
| |
162 | 176 |
| |
163 | 177 |
| |
| |||
279 | 293 |
| |
280 | 294 |
| |
281 | 295 |
| |
282 |
| - | |
| 296 | + | |
283 | 297 |
| |
284 | 298 |
| |
285 | 299 |
| |
| |||
292 | 306 |
| |
293 | 307 |
| |
294 | 308 |
| |
295 |
| - | |
296 | 309 |
| |
297 |
| - | |
298 | 310 |
| |
299 | 311 |
| |
300 | 312 |
| |
| |||
309 | 321 |
| |
310 | 322 |
| |
311 | 323 |
| |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
312 | 328 |
| |
313 | 329 |
| |
314 | 330 |
| |
| |||
328 | 344 |
| |
329 | 345 |
| |
330 | 346 |
| |
331 |
| - | |
332 |
| - | |
| 347 | + | |
| 348 | + | |
333 | 349 |
| |
334 | 350 |
| |
335 | 351 |
| |
336 | 352 |
| |
337 | 353 |
| |
338 | 354 |
| |
339 |
| - | |
340 |
| - | |
341 |
| - | |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
| 355 | + | |
| 356 | + | |
347 | 357 |
| |
348 | 358 |
| |
349 | 359 |
| |
350 | 360 |
| |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + |
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + |
Lines changed: 46 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
30 | 30 |
| |
31 | 31 |
| |
32 | 32 |
| |
33 |
| - | |
34 |
| - | |
35 |
| - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
36 | 37 |
| |
37 |
| - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
38 | 48 |
| |
39 | 49 |
| |
40 | 50 |
| |
41 | 51 |
| |
42 | 52 |
| |
43 | 53 |
| |
44 |
| - | |
| 54 | + | |
45 | 55 |
| |
46 | 56 |
| |
47 | 57 |
| |
48 |
| - | |
49 |
| - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
50 | 62 |
| |
51 | 63 |
| |
52 | 64 |
| |
| |||
101 | 113 |
| |
102 | 114 |
| |
103 | 115 |
| |
104 |
| - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
105 | 139 |
| |
106 | 140 |
| |
107 | 141 |
| |
108 | 142 |
| |
109 | 143 |
| |
110 | 144 |
| |
111 | 145 |
| |
112 |
| - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
113 | 150 |
| |
114 | 151 |
| |
115 | 152 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
15 |
| - | |
16 |
| - | |
| 15 | + | |
| 16 | + | |
17 | 17 |
| |
18 | 18 |
|
0 commit comments
Comments
(0)