Commit 47556a0
committed
Fix pg_recvlogical upon signal termination
When pg_recvlogical needs to abort on a signal like SIGINT/SIGTERM, it
is expected to exit cleanly as the code documents. However, the code
forgot to clean up the state of the connection before leaving. This
would cause the tool to emit messages like "unexpected termination of
replication stream" error, which is meant for really unexpected
termination or a crash.
The code is refactored to apply the same termination abort operations for
signals, end LSN and keepalive cases, registering a "reason" for the
termination with a message printed under --verbose adapted to the reason
used.
This is arguably a bug, but this has been this way since the tool exists
and the signal termination can now become slower depending on the change
being decoded when the signal is received.
Reported-by: Andres Freund
Author: Bharath Rupireddy
Reviewed-by: Andres Freund, Kyotaro Horiguchi, Cary Huang, Michael
Paquier
Discussion: https://postgr.es/m/20221019213953.htdtzikf4f45ywil@awork3.anarazel.de1 parent ab29a7a commit 47556a0
File tree
2 files changed
+44
-12
lines changed- src
- bin/pg_basebackup
- tools/pgindent
2 files changed
+44
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
| |||
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| 66 | + | |
58 | 67 | | |
59 | 68 | | |
60 | 69 | | |
| |||
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
69 | | - | |
| 78 | + | |
| 79 | + | |
70 | 80 | | |
71 | 81 | | |
72 | 82 | | |
| |||
207 | 217 | | |
208 | 218 | | |
209 | 219 | | |
| 220 | + | |
210 | 221 | | |
211 | 222 | | |
212 | 223 | | |
| 224 | + | |
213 | 225 | | |
214 | 226 | | |
215 | 227 | | |
| |||
275 | 287 | | |
276 | 288 | | |
277 | 289 | | |
278 | | - | |
| 290 | + | |
| 291 | + | |
279 | 292 | | |
280 | 293 | | |
281 | 294 | | |
| |||
487 | 500 | | |
488 | 501 | | |
489 | 502 | | |
490 | | - | |
| 503 | + | |
491 | 504 | | |
492 | 505 | | |
493 | 506 | | |
| |||
527 | 540 | | |
528 | 541 | | |
529 | 542 | | |
530 | | - | |
| 543 | + | |
531 | 544 | | |
532 | 545 | | |
533 | 546 | | |
| |||
572 | 585 | | |
573 | 586 | | |
574 | 587 | | |
575 | | - | |
| 588 | + | |
576 | 589 | | |
577 | 590 | | |
578 | 591 | | |
579 | 592 | | |
580 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
581 | 598 | | |
582 | 599 | | |
583 | 600 | | |
| |||
656 | 673 | | |
657 | 674 | | |
658 | 675 | | |
| 676 | + | |
659 | 677 | | |
660 | 678 | | |
661 | 679 | | |
| |||
1021 | 1039 | | |
1022 | 1040 | | |
1023 | 1041 | | |
1024 | | - | |
| 1042 | + | |
| 1043 | + | |
1025 | 1044 | | |
1026 | 1045 | | |
1027 | 1046 | | |
1028 | 1047 | | |
1029 | 1048 | | |
1030 | 1049 | | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
1037 | 1068 | | |
1038 | 1069 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2639 | 2639 | | |
2640 | 2640 | | |
2641 | 2641 | | |
| 2642 | + | |
2642 | 2643 | | |
2643 | 2644 | | |
2644 | 2645 | | |
| |||
0 commit comments