pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix transient mdsync() errors of truncated relations due to 72a9
2+ messages / 2 participants
[nested] [flat]

* pgsql: Fix transient mdsync() errors of truncated relations due to 72a9
@ 2016-05-04 08:59 Andres Freund <andres@anarazel.de>
  2017-09-17 22:22 ` Re: pgsql: Fix transient mdsync() errors of truncated relations due to 72a9 Peter Geoghegan <pg@bowt.ie>
  0 siblings, 1 reply; 2+ messages in thread

From: Andres Freund @ 2016-05-04 08:59 UTC (permalink / raw)
  To: pgsql-committers

Fix transient mdsync() errors of truncated relations due to 72a98a6395.

Unfortunately the segment size checks from 72a98a6395 had the negative
side-effect of breaking a corner case in mdsync(): When processing a
fsync request for a truncated away segment mdsync() could fail with
"could not fsync file" (if previous segment < RELSEG_SIZE) because
_mdfd_getseg() now wouldn't return the relevant segment anymore.

The cleanest fix seems to be to allow the caller of _mdfd_getseg() to
specify whether checks for RELSEG_SIZE are performed. To allow doing so,
change the ExtensionBehavior enum into a bitmask. Besides allowing for
the addition of EXTENSION_DONT_CHECK_SIZE, this makes for a nicer
implementation of EXTENSION_REALLY_RETURN_NULL.

Besides mdsync() the only callsite that should change behaviour due to
this is mdprefetch() which now doesn't create segments anymore, even in
recovery. Given the uses of mdprefetch() that seems better.

Reported-By: Thom Brown
Discussion: CAA-aLv72QazLvPdKZYpVn4a_Eh+i4_cxuB03k+iCuZM_xjc+6Q@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a712487087c73eee880ff1a7c50528cbab2f1b90

Modified Files
--------------
src/backend/storage/smgr/md.c | 81 +++++++++++++++++++++++++------------------
1 file changed, 47 insertions(+), 34 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pgsql: Fix transient mdsync() errors of truncated relations due to 72a9
  2016-05-04 08:59 pgsql: Fix transient mdsync() errors of truncated relations due to 72a9 Andres Freund <andres@anarazel.de>
@ 2017-09-17 22:22 ` Peter Geoghegan <pg@bowt.ie>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Geoghegan @ 2017-09-17 22:22 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers

On Wed, May 4, 2016 at 1:59 AM, Andres Freund <andres@anarazel.de> wrote:
> The cleanest fix seems to be to allow the caller of _mdfd_getseg() to
> specify whether checks for RELSEG_SIZE are performed. To allow doing so,
> change the ExtensionBehavior enum into a bitmask. Besides allowing for
> the addition of EXTENSION_DONT_CHECK_SIZE, this makes for a nicer
> implementation of EXTENSION_REALLY_RETURN_NULL.

You missed a remaining reference to EXTENSION_REALLY_RETURN_NULL
within _mdfd_getseg().

-- 
Peter Geoghegan


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2017-09-17 22:22 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-04 08:59 pgsql: Fix transient mdsync() errors of truncated relations due to 72a9 Andres Freund <andres@anarazel.de>
2017-09-17 22:22 ` Peter Geoghegan <pg@bowt.ie>

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