- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit37b369d
committed
injection_points: Add wait and wakeup of processes
This commit adds two features to the in-core module for injectionpoints:- A new callback called "wait" that can be attached to an injectionpoint to make it wait.- A new SQL function to update the shared state and broadcast the updateusing a condition variable. This function uses an input an injectionpoint name.This offers the possibility to stop a process in flight and wake it upin a controlled manner, which is useful when implementing tests that aimto trigger scenarios for race conditions (some tests are planned forintegration). The logic uses a set of counters with a conditionvariable to monitor and broadcast the changes. Up to 8 waits can beregistered in a single run, which should be plenty enough. Waits can bemonitored in pg_stat_activity, based on the injection point name whichis registered in a custom wait event under the "Extension" category.The shared memory state used by the module is registered using the DSMregistry, and is optional, so there is no need to load the module withshared_preload_libraries to be able to use these features.Author: Michael PaquierReviewed-by: Andrey Borodin, Bertrand DrouvotDiscussion:https://postgr.es/m/ZdLuxBk5hGpol91B@paquier.xyz1 parent024c521 commit37b369d
File tree
3 files changed
+166
-0
lines changed- src
- test/modules/injection_points
- tools/pgindent
3 files changed
+166
-0
lines changedLines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
27 | 37 |
| |
28 | 38 |
| |
29 | 39 |
| |
|
Lines changed: 155 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
| 21 | + | |
21 | 22 |
| |
22 | 23 |
| |
| 24 | + | |
23 | 25 |
| |
24 | 26 |
| |
25 | 27 |
| |
26 | 28 |
| |
27 | 29 |
| |
28 | 30 |
| |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
29 | 54 |
| |
30 | 55 |
| |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
31 | 80 |
| |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
32 | 89 |
| |
33 | 90 |
| |
34 | 91 |
| |
| |||
43 | 100 |
| |
44 | 101 |
| |
45 | 102 |
| |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 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 | + | |
46 | 163 |
| |
47 | 164 |
| |
48 | 165 |
| |
| |||
58 | 175 |
| |
59 | 176 |
| |
60 | 177 |
| |
| 178 | + | |
| 179 | + | |
61 | 180 |
| |
62 | 181 |
| |
63 | 182 |
| |
| |||
80 | 199 |
| |
81 | 200 |
| |
82 | 201 |
| |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
83 | 238 |
| |
84 | 239 |
| |
85 | 240 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1210 | 1210 |
| |
1211 | 1211 |
| |
1212 | 1212 |
| |
| 1213 | + | |
1213 | 1214 |
| |
1214 | 1215 |
| |
1215 | 1216 |
| |
|
0 commit comments
Comments
(0)