Skip to content

Commit 210981a

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 6b3094c commit 210981a

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
@@ -1178,11 +1166,9 @@ select_loop(int maxFd, fd_set *workerset)
11781166
/*
11791167
* If we Ctrl-C the master process, it's likely that we interrupt
11801168
* select() here. The signal handler will set wantAbort == true and
1181-
* the shutdown journey starts from here. Note that we'll come back
1182-
* here later when we tell all workers to terminate and read their
1183-
* responses. But then we have aborting set to true.
1169+
* the shutdown journey starts from here.
11841170
*/
1185-
if (wantAbort && !aborting)
1171+
if (wantAbort)
11861172
exit_horribly(modulename, "terminated by user\n");
11871173

11881174
if (i < 0 && errno == EINTR)
@@ -1279,17 +1265,9 @@ sendMessageToWorker(ParallelState *pstate, int worker, const char *str)
12791265

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

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