mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
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>
This commit is contained in:
@ -95,11 +95,7 @@ static int piperead(int s, char *buf, int len);
|
|||||||
|
|
||||||
#else /* !WIN32 */
|
#else /* !WIN32 */
|
||||||
|
|
||||||
/*
|
/* Signal handler flag */
|
||||||
* Variables for handling signals. aborting is only ever used in the master,
|
|
||||||
* the workers just need wantAbort.
|
|
||||||
*/
|
|
||||||
static bool aborting = false;
|
|
||||||
static volatile sig_atomic_t wantAbort = 0;
|
static volatile sig_atomic_t wantAbort = 0;
|
||||||
|
|
||||||
/* Non-Windows implementation of pipe access */
|
/* Non-Windows implementation of pipe access */
|
||||||
@ -301,14 +297,6 @@ archive_close_connection(int code, void *arg)
|
|||||||
if (si->AHX)
|
if (si->AHX)
|
||||||
DisconnectDatabase(si->AHX);
|
DisconnectDatabase(si->AHX);
|
||||||
|
|
||||||
#ifndef WIN32
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Setting aborting to true shuts off error/warning messages that
|
|
||||||
* are no longer useful once we start killing workers.
|
|
||||||
*/
|
|
||||||
aborting = true;
|
|
||||||
#endif
|
|
||||||
ShutdownWorkersHard(si->pstate);
|
ShutdownWorkersHard(si->pstate);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1180,11 +1168,9 @@ select_loop(int maxFd, fd_set *workerset)
|
|||||||
/*
|
/*
|
||||||
* If we Ctrl-C the master process, it's likely that we interrupt
|
* If we Ctrl-C the master process, it's likely that we interrupt
|
||||||
* select() here. The signal handler will set wantAbort == true and
|
* select() here. The signal handler will set wantAbort == true and
|
||||||
* the shutdown journey starts from here. Note that we'll come back
|
* the shutdown journey starts from here.
|
||||||
* here later when we tell all workers to terminate and read their
|
|
||||||
* responses. But then we have aborting set to true.
|
|
||||||
*/
|
*/
|
||||||
if (wantAbort && !aborting)
|
if (wantAbort)
|
||||||
exit_horribly(modulename, "terminated by user\n");
|
exit_horribly(modulename, "terminated by user\n");
|
||||||
|
|
||||||
if (i < 0 && errno == EINTR)
|
if (i < 0 && errno == EINTR)
|
||||||
@ -1281,17 +1267,9 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str)
|
|||||||
|
|
||||||
if (pipewrite(pstate->parallelSlot[worker].pipeWrite, str, len) != len)
|
if (pipewrite(pstate->parallelSlot[worker].pipeWrite, str, len) != len)
|
||||||
{
|
{
|
||||||
/*
|
exit_horribly(modulename,
|
||||||
* If we're already aborting anyway, don't care if we succeed or not.
|
"could not write to the communication channel: %s\n",
|
||||||
* The child might have gone already. (XXX but if we're aborting
|
strerror(errno));
|
||||||
* already, why are we here at all?)
|
|
||||||
*/
|
|
||||||
#ifndef WIN32
|
|
||||||
if (!aborting)
|
|
||||||
#endif
|
|
||||||
exit_horribly(modulename,
|
|
||||||
"could not write to the communication channel: %s\n",
|
|
||||||
strerror(errno));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user