Skip to content

Commit 9cea52a

Browse files
committed
Remove misleading comments. Move _Clone and _DeClone functions before
the "END OF FORMAT CALLBACKS" comment, because they are format callbacks too.
1 parent fd223c7 commit 9cea52a

File tree

1 file changed

+33
-40
lines changed

1 file changed

+33
-40
lines changed

src/bin/pg_dump/pg_backup_custom.c

Lines changed: 33 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,6 @@ _skipData(ArchiveHandle *AH)
597597
* Mandatory.
598598
*
599599
* Called by the archiver to do integer & byte output to the archive.
600-
* These routines are only used to read & write headers & TOC.
601-
*
602600
*/
603601
static int
604602
_WriteByte(ArchiveHandle *AH, const int i)
@@ -620,7 +618,6 @@ _WriteByte(ArchiveHandle *AH, const int i)
620618
* Mandatory
621619
*
622620
* Called by the archiver to read bytes & integers from the archive.
623-
* These routines are only used to read & write headers & TOC.
624621
* EOF should be treated as a fatal error.
625622
*/
626623
static int
@@ -642,8 +639,6 @@ _ReadByte(ArchiveHandle *AH)
642639
* Mandatory.
643640
*
644641
* Called by the archiver to write a block of bytes to the archive.
645-
* These routines are only used to read & write headers & TOC.
646-
*
647642
*/
648643
static size_t
649644
_WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
@@ -667,8 +662,6 @@ _WriteBuf(ArchiveHandle *AH, const void *buf, size_t len)
667662
* Mandatory.
668663
*
669664
* Called by the archiver to read a block of bytes from the archive
670-
* These routines are only used to read & write headers & TOC.
671-
*
672665
*/
673666
static size_t
674667
_ReadBuf(ArchiveHandle *AH, void *buf, size_t len)
@@ -770,6 +763,39 @@ _ReopenArchive(ArchiveHandle *AH)
770763
strerror(errno));
771764
}
772765

766+
/*
767+
* Clone format-specific fields during parallel restoration.
768+
*/
769+
static void
770+
_Clone(ArchiveHandle *AH)
771+
{
772+
lclContext *ctx = (lclContext *) AH->formatData;
773+
774+
AH->formatData = (lclContext *) malloc(sizeof(lclContext));
775+
if (AH->formatData == NULL)
776+
die_horribly(AH, modulename, "out of memory\n");
777+
memcpy(AH->formatData, ctx, sizeof(lclContext));
778+
ctx = (lclContext *) AH->formatData;
779+
780+
/* sanity check, shouldn't happen */
781+
if (ctx->cs != NULL)
782+
die_horribly(AH, modulename, "compressor active\n");
783+
784+
/*
785+
* Note: we do not make a local lo_buf because we expect at most one BLOBS
786+
* entry per archive, so no parallelism is possible. Likewise,
787+
* TOC-entry-local state isn't an issue because any one TOC entry is
788+
* touched by just one worker child.
789+
*/
790+
}
791+
792+
static void
793+
_DeClone(ArchiveHandle *AH)
794+
{
795+
lclContext *ctx = (lclContext *) AH->formatData;
796+
free(ctx);
797+
}
798+
773799
/*--------------------------------------------------
774800
* END OF FORMAT CALLBACKS
775801
*--------------------------------------------------
@@ -889,36 +915,3 @@ _CustomReadFunc(ArchiveHandle *AH, char **buf, size_t *buflen)
889915
}
890916
return cnt;
891917
}
892-
893-
/*
894-
* Clone format-specific fields during parallel restoration.
895-
*/
896-
static void
897-
_Clone(ArchiveHandle *AH)
898-
{
899-
lclContext *ctx = (lclContext *) AH->formatData;
900-
901-
AH->formatData = (lclContext *) malloc(sizeof(lclContext));
902-
if (AH->formatData == NULL)
903-
die_horribly(AH, modulename, "out of memory\n");
904-
memcpy(AH->formatData, ctx, sizeof(lclContext));
905-
ctx = (lclContext *) AH->formatData;
906-
907-
/* sanity check, shouldn't happen */
908-
if (ctx->cs != NULL)
909-
die_horribly(AH, modulename, "compressor active\n");
910-
911-
/*
912-
* Note: we do not make a local lo_buf because we expect at most one BLOBS
913-
* entry per archive, so no parallelism is possible. Likewise,
914-
* TOC-entry-local state isn't an issue because any one TOC entry is
915-
* touched by just one worker child.
916-
*/
917-
}
918-
919-
static void
920-
_DeClone(ArchiveHandle *AH)
921-
{
922-
lclContext *ctx = (lclContext *) AH->formatData;
923-
free(ctx);
924-
}

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