Skip to content

Commit 937b858

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 bf7b169 commit 937b858

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
@@ -94,11 +94,7 @@ static int piperead(int s, char *buf, int len);
9494

9595
#else /* !WIN32 */
9696

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

104100
/* Non-Windows implementation of pipe access */
@@ -300,14 +296,6 @@ archive_close_connection(int code, void *arg)
300296
if (si->AHX)
301297
DisconnectDatabase(si->AHX);
302298

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

11871173
if (i < 0 && errno == EINTR)
@@ -1278,17 +1264,9 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str)
12781264

12791265
if (pipewrite(pstate->parallelSlot[worker].pipeWrite, str, len) != len)
12801266
{
1281-
/*
1282-
* If we're already aborting anyway, don't care if we succeed or not.
1283-
* The child might have gone already. (XXX but if we're aborting
1284-
* already, why are we here at all?)
1285-
*/
1286-
#ifndef WIN32
1287-
if (!aborting)
1288-
#endif
1289-
exit_horribly(modulename,
1290-
"could not write to the communication channel: %s\n",
1291-
strerror(errno));
1267+
exit_horribly(modulename,
1268+
"could not write to the communication channel: %s\n",
1269+
strerror(errno));
12921270
}
12931271
}
12941272

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy