1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

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.
This commit is contained in:
Tom Lane
2010-06-28 02:07:02 +00:00
parent b779ea8a9a
commit 04d9f4dab4
2 changed files with 44 additions and 23 deletions

View File

@ -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.
*/
}
}