forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5d43c3c
committed
Fix query cancellation handling in psql
The refactoring done ina4fd3aa for query cancellation has messed upwith the logic in psql by mixing CancelRequested and cancel_pressed,breaking for example \watch. The former would be switched to true if acancellation request has been attempted and that it actually succeeded,and the latter tracks if a cancellation attempt has been done.This commit brings back the code of psql to a state consistent to whatit was beforea4fd3aa, without giving up on the refactoring piecesintroduced. It should be actually possible to merge more both flags astheir concepts are close enough, however note that psql's --single-stepmode relies on cancel_pressed to be always set, so this requires morecareful analysis left for later.While on it, fix the declarations of CancelRequested (in cancel.c) andcancel_pressed (in psql) to be volatile sig_atomic_t. Previously,both were declared as booleans, which should be fine on modernplatforms, but the C standard recommends the use of sig_atomic_t forvariables used in signal handlers. Note that since its introduction ina179232, CancelRequested declaration was not volatile.Reported-by: Jeff JanesAuthor: Michael PaquierDiscussion:https://postgr.es/m/CAMkU=1zpoUDGKqWKuMWkj7t-bOCaJDx0r=5te_-d0B2HVLABXg@mail.gmail.com1 parentb925a00 commit5d43c3c
5 files changed
+29
-25
lines changedLines changed: 9 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
233 | 233 |
| |
234 | 234 |
| |
235 | 235 |
| |
236 |
| - | |
| 236 | + | |
237 | 237 |
| |
238 | 238 |
| |
239 | 239 |
| |
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
249 |
| - | |
250 |
| - | |
251 | 249 |
| |
252 | 250 |
| |
253 | 251 |
| |
| 252 | + | |
254 | 253 |
| |
255 | 254 |
| |
256 | 255 |
| |
257 | 256 |
| |
258 | 257 |
| |
259 | 258 |
| |
| 259 | + | |
260 | 260 |
| |
261 | 261 |
| |
262 |
| - | |
263 |
| - | |
264 |
| - | |
265 |
| - | |
266 |
| - | |
267 |
| - | |
268 |
| - | |
269 |
| - | |
270 |
| - | |
| 262 | + | |
271 | 263 |
| |
272 | 264 |
| |
273 |
| - | |
274 |
| - | |
275 | 265 |
| |
276 | 266 |
| |
277 | 267 |
| |
| |||
638 | 628 |
| |
639 | 629 |
| |
640 | 630 |
| |
641 |
| - | |
| 631 | + | |
642 | 632 |
| |
643 | 633 |
| |
644 | 634 |
| |
| |||
838 | 828 |
| |
839 | 829 |
| |
840 | 830 |
| |
841 |
| - | |
842 |
| - | |
| 831 | + | |
| 832 | + | |
843 | 833 |
| |
844 | 834 |
| |
845 | 835 |
| |
| |||
1207 | 1197 |
| |
1208 | 1198 |
| |
1209 | 1199 |
| |
1210 |
| - | |
| 1200 | + | |
1211 | 1201 |
| |
1212 | 1202 |
| |
1213 | 1203 |
| |
| |||
1751 | 1741 |
| |
1752 | 1742 |
| |
1753 | 1743 |
| |
1754 |
| - | |
| 1744 | + | |
1755 | 1745 |
| |
1756 | 1746 |
| |
1757 | 1747 |
| |
|
Lines changed: 13 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
19 |
| - | |
20 | 19 |
| |
21 | 20 |
| |
22 | 21 |
| |
| |||
37 | 36 |
| |
38 | 37 |
| |
39 | 38 |
| |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
40 | 43 |
| |
41 |
| - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 |
| |
43 | 54 |
| |
44 | 55 |
| |
|
Lines changed: 1 addition & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
19 | 19 |
| |
20 | 20 |
| |
21 | 21 |
| |
22 |
| - | |
23 | 22 |
| |
24 | 23 |
| |
25 | 24 |
| |
| |||
41 | 40 |
| |
42 | 41 |
| |
43 | 42 |
| |
44 |
| - | |
| 43 | + | |
45 | 44 |
| |
46 | 45 |
| |
47 | 46 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| 17 | + | |
| 18 | + | |
17 | 19 |
| |
18 | 20 |
| |
19 |
| - | |
| 21 | + | |
20 | 22 |
| |
21 | 23 |
| |
22 | 24 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
13 | 13 |
| |
14 | 14 |
| |
15 | 15 |
| |
| 16 | + | |
| 17 | + | |
16 | 18 |
| |
17 | 19 |
| |
18 | 20 |
| |
| |||
175 | 177 |
| |
176 | 178 |
| |
177 | 179 |
| |
178 |
| - | |
| 180 | + | |
179 | 181 |
| |
180 | 182 |
| |
181 | 183 |
| |
|
0 commit comments
Comments
(0)