diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-06-28 02:07:02 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-06-28 02:07:02 +0000 |
commit | 04d9f4dab4723a0736157542b1d1a24ad2b8aa1d (patch) | |
tree | 6d28a971442116455da1c612ff5da6558a47d8fc /src/bin/pg_dump/pg_backup_custom.c | |
parent | b779ea8a9a2dc3a089b3ac152b1ec4568bfeb26f (diff) | |
download | postgresql-04d9f4dab4723a0736157542b1d1a24ad2b8aa1d.tar.gz postgresql-04d9f4dab4723a0736157542b1d1a24ad2b8aa1d.zip |
Improve pg_dump's checkSeek() function to verify the functioning of ftello
as well as fseeko, and to not assume that fseeko(fp, 0, SEEK_CUR) proves
anything. Also improve some related comments. Per my observation that
the SEEK_CUR test didn't actually work on some platforms, and subsequent
discussion with Robert Haas.
Back-patch to 8.4. In earlier releases it's not that important whether
we get the hasSeek test right, but with parallel restore it matters.
Diffstat (limited to 'src/bin/pg_dump/pg_backup_custom.c')
-rw-r--r-- | src/bin/pg_dump/pg_backup_custom.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/bin/pg_dump/pg_backup_custom.c b/src/bin/pg_dump/pg_backup_custom.c index 11d71a66798..3c1678ca9cd 100644 --- a/src/bin/pg_dump/pg_backup_custom.c +++ b/src/bin/pg_dump/pg_backup_custom.c @@ -19,7 +19,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.45 2010/06/27 19:07:24 tgl Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_custom.c,v 1.46 2010/06/28 02:07:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -835,9 +835,10 @@ _CloseArchive(ArchiveHandle *AH) WriteDataChunks(AH); /* - * This is not an essential operation - it is really only needed if we - * expect to be doing seeks to read the data back - it may be ok to - * just use the existing self-consistent block formatting. + * If possible, re-write the TOC in order to update the data offset + * information. This is not essential, as pg_restore can cope in + * most cases without it; but it can make pg_restore significantly + * faster in some situations (especially parallel restore). */ if (ctx->hasSeek && fseeko(AH->FH, tpos, SEEK_SET) == 0) @@ -914,7 +915,8 @@ _getFilePos(ArchiveHandle *AH, lclContext *ctx) /* * Prior to 1.7 (pg7.3) we relied on the internally maintained - * pointer. Now we rely on pgoff_t always. pos = ctx->filePos; + * pointer. Now we rely on ftello() always, unless the file has + * been found to not support it. */ } } |