pgsql: Remove manual tracking of file position in pg_dump/pg_backup_cus

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Remove manual tracking of file position in pg_dump/pg_backup_cus
Date: 2020-07-17 17:04:20
Message-ID: E1jwTmW-0005Sl-H9@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Remove manual tracking of file position in pg_dump/pg_backup_custom.c.

We do not really need to track the file position by hand. We were
already relying on ftello() whenever the archive file is seekable,
while if it's not seekable we don't need the file position info
anyway because we're not going to be able to re-write the TOC.

Moreover, that tracking was buggy since it failed to account for
the effects of fseeko(). Somewhat remarkably, that seems not to
have made for any live bugs up to now. We could fix the oversights,
but it seems better to just get rid of the whole error-prone mess.

In itself this is merely code cleanup. However, it's necessary
infrastructure for an upcoming bug-fix patch (because that code
*does* need valid file position after fseeko). The bug fix
needs to go back as far as v12; hence, back-patch that far.

Discussion: https://postgr.es/m/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/447cf2f8e9dcf9fd89c935f2daee13326a91630a

Modified Files
--------------
src/bin/pg_dump/pg_backup_custom.c | 53 ++++++++++----------------------------
1 file changed, 14 insertions(+), 39 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-07-18 00:50:34 pgsql: Add Valgrind buffer access instrumentation.
Previous Message Peter Geoghegan 2020-07-17 16:51:37 pgsql: Avoid CREATE INDEX unique index deduplication.