pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove manual tracking of file position in pg_dump/pg_backup_cus
Date: Fri, 17 Jul 2020 17:04:20 +0000
Message-ID: <E1jwTmW-0005Sr-Hv@gemulon.postgresql.org> (raw)

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_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39a068ce66758c2c2138754e75bebc2f59160edc

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



view thread (3+ messages)

Message-ID: <E1jwTmW-0005Sr-Hv@gemulon.postgresql.org>
Permalink:  ../E1jwTmW-0005Sr-Hv@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1jwTmW-0005Sr-Hv@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove manual tracking of file position in pg_dump/pg_backup_cus
  In-Reply-To: <E1jwTmW-0005Sr-Hv@gemulon.postgresql.org>
  References: <E1jwTmW-0005Sr-Hv@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox