- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit5d60df8
committed
Fix parallel pg_dump/pg_restore for failure to create worker processes.
If we failed to fork a worker process, or create a communication pipefor one, WaitForTerminatingWorkers would suffer an assertion failureif assert-enabled, otherwise crash or go into an infinite loop. Thiswas a consequence of not accounting for the startup condition wherewe've not yet forked all the workers.The original bug was that ParallelBackupStart would set workerStatus toWRKR_IDLE before it had successfully forked a worker. I made thingsworse in commitb7b8cc0 by not understanding the undocumented factthat the WRKR_TERMINATED state was also meant to represent the casewhere a worker hadn't been started yet: I changed enum T_WorkerStatusso that *all* the worker slots were initially in WRKR_IDLE state. Butthis wasn't any more broken in practice, since even one slot in thewrong state would keep WaitForTerminatingWorkers from terminating.In v10 and later, introduce an explicit T_WorkerStatus value forworker-not-started, in hopes of preventing future oversights of thesame ilk. Before that, just document that WRKR_TERMINATED is supposedto cover that case (partly because it wasn't actively broken, andpartly because the enum is exposed outside parallel.c in those branches,so there's microscopically more risk involved in changing it).In all branches, introduce a WORKER_IS_RUNNING status test macroto hide which T_WorkerStatus values mean that, and be more carefulnot to access ParallelSlot fields till we're sure they're valid.Per report from Vignesh C, though this is my patch not his.Back-patch to all supported branches.Discussion:https://postgr.es/m/CALDaNm1Luv-E3sarR+-unz-BjchquHHyfP+YC+2FS2pt_J+wxg@mail.gmail.com1 parent56bc82a commit5d60df8
2 files changed
+20
-11
lines changedLines changed: 17 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
53 |
| - | |
| 53 | + | |
54 | 54 |
| |
55 | 55 |
| |
56 | 56 |
| |
| |||
381 | 381 |
| |
382 | 382 |
| |
383 | 383 |
| |
384 |
| - | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
385 | 387 |
| |
386 | 388 |
| |
387 | 389 |
| |
| |||
455 | 457 |
| |
456 | 458 |
| |
457 | 459 |
| |
458 |
| - | |
| 460 | + | |
459 | 461 |
| |
460 | 462 |
| |
461 | 463 |
| |
| |||
891 | 893 |
| |
892 | 894 |
| |
893 | 895 |
| |
| 896 | + | |
894 | 897 |
| |
895 | 898 |
| |
896 | 899 |
| |
| |||
932 | 935 |
| |
933 | 936 |
| |
934 | 937 |
| |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
935 | 942 |
| |
936 | 943 |
| |
937 | 944 |
| |
938 | 945 |
| |
939 | 946 |
| |
940 | 947 |
| |
941 |
| - | |
942 |
| - | |
943 |
| - | |
944 |
| - | |
945 |
| - | |
946 | 948 |
| |
947 | 949 |
| |
948 | 950 |
| |
| |||
961 | 963 |
| |
962 | 964 |
| |
963 | 965 |
| |
| 966 | + | |
964 | 967 |
| |
965 | 968 |
| |
966 | 969 |
| |
| |||
1005 | 1008 |
| |
1006 | 1009 |
| |
1007 | 1010 |
| |
| 1011 | + | |
1008 | 1012 |
| |
1009 | 1013 |
| |
1010 | 1014 |
| |
| |||
1121 | 1125 |
| |
1122 | 1126 |
| |
1123 | 1127 |
| |
1124 |
| - | |
| 1128 | + | |
1125 | 1129 |
| |
1126 | 1130 |
| |
1127 | 1131 |
| |
| |||
1130 | 1134 |
| |
1131 | 1135 |
| |
1132 | 1136 |
| |
1133 |
| - | |
| 1137 | + | |
1134 | 1138 |
| |
1135 | 1139 |
| |
1136 | 1140 |
| |
| |||
1530 | 1534 |
| |
1531 | 1535 |
| |
1532 | 1536 |
| |
1533 |
| - | |
| 1537 | + | |
1534 | 1538 |
| |
1535 | 1539 |
| |
1536 | 1540 |
| |
| |||
1555 | 1559 |
| |
1556 | 1560 |
| |
1557 | 1561 |
| |
| 1562 | + | |
| 1563 | + | |
1558 | 1564 |
| |
1559 | 1565 |
| |
1560 | 1566 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 |
| |
36 | 39 |
| |
37 | 40 |
| |
|
0 commit comments
Comments
(0)