forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork0
Commit9662143
committed
Allow regex operations to be terminated early by query cancel requests.
The regex code didn't have any provision for query cancel; which isunsurprising given its non-Postgres origin, but still problematic sincesome operations can take a long time. Introduce a callback function tocheck for a pending query cancel or session termination request, andcall it in a couple of strategic spots where we can make the regex codeexit with an error indicator.If we ever actually split out the regex code as a standalone library,some additional work will be needed to let the cancel callback functionbe specified externally to the library. But that's straightforward(certainly so by comparison to putting the locale-dependent characterclassification logic on a similar arms-length basis), and there seemsno need to do it right now.A bigger issue is that there may be more places than these two wherewe need to check for cancels. We can always add more checks later,now that the infrastructure is in place.Since there are known examples of not-terribly-long regexes that canlock up a backend for a long time, back-patch to all supported branches.I have hopes of fixing the known performance problems later, but addingquery cancel ability seems like a good idea even if they were all fixed.1 parentd8a42b1 commit9662143
8 files changed
+57
-0
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
174 | 174 |
| |
175 | 175 |
| |
176 | 176 |
| |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
177 | 188 |
| |
178 | 189 |
| |
179 | 190 |
| |
180 | 191 |
| |
181 | 192 |
| |
| 193 | + | |
182 | 194 |
| |
183 | 195 |
| |
184 | 196 |
| |
|
Lines changed: 20 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
34 | 34 |
| |
35 | 35 |
| |
36 | 36 |
| |
| 37 | + | |
| 38 | + | |
37 | 39 |
| |
38 | 40 |
| |
39 | 41 |
| |
| |||
67 | 69 |
| |
68 | 70 |
| |
69 | 71 |
| |
| 72 | + | |
70 | 73 |
| |
71 | 74 |
| |
72 | 75 |
| |
| |||
276 | 279 |
| |
277 | 280 |
| |
278 | 281 |
| |
| 282 | + | |
279 | 283 |
| |
280 | 284 |
| |
281 | 285 |
| |
| |||
1893 | 1897 |
| |
1894 | 1898 |
| |
1895 | 1899 |
| |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
1896 | 1916 |
| |
1897 | 1917 |
| |
1898 | 1918 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
595 | 595 |
| |
596 | 596 |
| |
597 | 597 |
| |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
598 | 602 |
| |
599 | 603 |
| |
600 | 604 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
31 | 31 |
| |
32 | 32 |
| |
33 | 33 |
| |
| 34 | + | |
34 | 35 |
| |
35 | 36 |
| |
36 | 37 |
| |
| |||
188 | 189 |
| |
189 | 190 |
| |
190 | 191 |
| |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
191 | 201 |
| |
192 | 202 |
| |
193 | 203 |
| |
| |||
268 | 278 |
| |
269 | 279 |
| |
270 | 280 |
| |
| 281 | + | |
271 | 282 |
| |
272 | 283 |
| |
273 | 284 |
| |
| |||
1216 | 1227 |
| |
1217 | 1228 |
| |
1218 | 1229 |
| |
| 1230 | + | |
1219 | 1231 |
| |
1220 | 1232 |
| |
1221 | 1233 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3035 | 3035 |
| |
3036 | 3036 |
| |
3037 | 3037 |
| |
| 3038 | + | |
3038 | 3039 |
| |
3039 | 3040 |
| |
3040 | 3041 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
| 157 | + | |
157 | 158 |
| |
158 | 159 |
| |
159 | 160 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
446 | 446 |
| |
447 | 447 |
| |
448 | 448 |
| |
| 449 | + | |
449 | 450 |
| |
450 | 451 |
| |
| 452 | + | |
| 453 | + | |
451 | 454 |
| |
452 | 455 |
| |
453 | 456 |
| |
|
0 commit comments
Comments
(0)