mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-27 08:39:28 +08:00
Lots of comment-fixing, and minor cosmetic cleanup, in pg_dump/parallel.c.
The commentary in this file was in extremely sad shape. The author(s) had clearly never heard of the project convention that a function header comment should provide an API spec of some sort for that function. Much of it was flat out wrong, too --- maybe it was accurate when written, but if so it had not been updated to track subsequent code revisions. Rewrite and rearrange to try to bring it up to speed, and annotate some of the places where more work is needed. (I've refrained from actually fixing anything of substance ... yet.) Also, rename a couple of functions for more clarity as to what they do, do some very minor code rearrangement, remove some pointless Asserts, fix an incorrect Assert in readMessageFromPipe, and add a missing socket close in one error exit from pgpipe(). The last would be a bug if we tried to continue after pgpipe() failure, but since we don't, it's just cosmetic at present. Although this is only cosmetic, back-patch to 9.3 where parallel.c was added. It's sufficiently invasive that it'll pose a hazard for future back-patching if we don't. Discussion: <25239.1464386067@sss.pgh.pa.us>
This commit is contained in:
parent
807b45375b
commit
6b3094c26f
File diff suppressed because it is too large
Load Diff
@ -2326,6 +2326,9 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt,
|
||||
return AH;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write out all data (tables & blobs)
|
||||
*/
|
||||
void
|
||||
WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate)
|
||||
{
|
||||
@ -2343,15 +2346,18 @@ WriteDataChunks(ArchiveHandle *AH, ParallelState *pstate)
|
||||
{
|
||||
/*
|
||||
* If we are in a parallel backup, then we are always the master
|
||||
* process.
|
||||
* process. Dispatch each data-transfer job to a worker.
|
||||
*/
|
||||
EnsureIdleWorker(AH, pstate);
|
||||
Assert(GetIdleWorker(pstate) != NO_SLOT);
|
||||
DispatchJobForTocEntry(AH, pstate, te, ACT_DUMP);
|
||||
}
|
||||
else
|
||||
WriteDataChunksForTocEntry(AH, te);
|
||||
}
|
||||
|
||||
/*
|
||||
* If parallel, wait for workers to finish.
|
||||
*/
|
||||
EnsureWorkersFinished(AH, pstate);
|
||||
}
|
||||
|
||||
@ -3819,13 +3825,11 @@ restore_toc_entries_parallel(ArchiveHandle *AH, ParallelState *pstate,
|
||||
|
||||
par_list_remove(next_work_item);
|
||||
|
||||
Assert(GetIdleWorker(pstate) != NO_SLOT);
|
||||
DispatchJobForTocEntry(AH, pstate, next_work_item, ACT_RESTORE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* at least one child is working and we have nothing ready. */
|
||||
Assert(!IsEveryWorkerIdle(pstate));
|
||||
}
|
||||
|
||||
for (;;)
|
||||
|
Loading…
Reference in New Issue
Block a user