Skip to content

Commit 99e3298

Browse files
committed
Remove pg_dump/parallel.c's useless "aborting" flag.
This was effectively dead code, since the places that tested it could not be reached after we entered the on-exit-cleanup routine that would set it. It seems to have been a leftover from a design in which error abort would try to send fresh commands to the workers --- a design which could never have worked reliably, of course. Since the flag is not cross-platform, it complicates reasoning about the code's behavior, which we could do without. Although this is effectively just cosmetic, back-patch anyway, because there are some actual bugs in the vicinity of this behavior. Discussion: <15583.1464462418@sss.pgh.pa.us>
1 parent 24c1f64 commit 99e3298

File tree

1 file changed

+6
-28
lines changed

1 file changed

+6
-28
lines changed

src/bin/pg_dump/parallel.c

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ static int piperead(int s, char *buf, int len);
9595

9696
#else /* !WIN32 */
9797

98-
/*
99-
* Variables for handling signals. aborting is only ever used in the master,
100-
* the workers just need wantAbort.
101-
*/
102-
static bool aborting = false;
98+
/* Signal handler flag */
10399
static volatile sig_atomic_t wantAbort = 0;
104100

105101
/* Non-Windows implementation of pipe access */
@@ -301,14 +297,6 @@ archive_close_connection(int code, void *arg)
301297
if (si->AHX)
302298
DisconnectDatabase(si->AHX);
303299

304-
#ifndef WIN32
305-
306-
/*
307-
* Setting aborting to true shuts off error/warning messages that
308-
* are no longer useful once we start killing workers.
309-
*/
310-
aborting = true;
311-
#endif
312300
ShutdownWorkersHard(si->pstate);
313301
}
314302
else
@@ -1180,11 +1168,9 @@ select_loop(int maxFd, fd_set *workerset)
11801168
/*
11811169
* If we Ctrl-C the master process, it's likely that we interrupt
11821170
* select() here. The signal handler will set wantAbort == true and
1183-
* the shutdown journey starts from here. Note that we'll come back
1184-
* here later when we tell all workers to terminate and read their
1185-
* responses. But then we have aborting set to true.
1171+
* the shutdown journey starts from here.
11861172
*/
1187-
if (wantAbort && !aborting)
1173+
if (wantAbort)
11881174
exit_horribly(modulename, "terminated by user\n");
11891175

11901176
if (i < 0 && errno == EINTR)
@@ -1281,17 +1267,9 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str)
12811267

12821268
if (pipewrite(pstate->parallelSlot[worker].pipeWrite, str, len) != len)
12831269
{
1284-
/*
1285-
* If we're already aborting anyway, don't care if we succeed or not.
1286-
* The child might have gone already. (XXX but if we're aborting
1287-
* already, why are we here at all?)
1288-
*/
1289-
#ifndef WIN32
1290-
if (!aborting)
1291-
#endif
1292-
exit_horribly(modulename,
1293-
"could not write to the communication channel: %s\n",
1294-
strerror(errno));
1270+
exit_horribly(modulename,
1271+
"could not write to the communication channel: %s\n",
1272+
strerror(errno));
12951273
}
12961274
}
12971275

0 commit comments

Comments
 (0)