pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: emre@hasegeli.com
Cc: tomas.vondra@2ndquadrant.com
Cc: pgsql-bugs@postgresql.org
Cc: gurkan.gur@innogames.com
Cc: david.pusch@innogames.com
Cc: patrick.schmidt@innogames.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Standby corruption after master is restarted
Date: Thu, 26 Apr 2018 21:13:48 +0900
Message-ID: <20180426121348.GA2365@paquier.xyz> (raw)
In-Reply-To: <20180426.195304.118373455.horiguchi.kyotaro@lab.ntt.co.jp>
References: <CAE2gYzwDDnYLMW999NGyTjB9Vr84eARJ5-uWdctKq5zPtGeruQ@mail.gmail.com>
	<1da55c73-4bd1-f13e-2d4b-c4049ffd73f5@2ndquadrant.com>
	<CAE2gYzwB0+MM3L6-zdK0JKO_aXqHNCKU7VAiDJk_kKRRJ4B=yA@mail.gmail.com>
	<20180426.195304.118373455.horiguchi.kyotaro@lab.ntt.co.jp>

On Thu, Apr 26, 2018 at 07:53:04PM +0900, Kyotaro HORIGUCHI wrote:
> I think this behavior is a bug. XLogReadRecord is considering the
> case but palloc_extended() breaks it. So in the attached, add a
> new flag MCXT_ALLOC_NO_PARAMERR to palloc_extended() and
> allocate_recordbuf calls it with the new flag. That alone fixes
> the problem. However, the patch frees read state buffer facing
> errorneous records since such records can leave a too-large
> buffer allocated.

This problem is already discussed here:
https://commitfest.postgresql.org/18/1516/

And here is the thread:
https://www.postgresql.org/message-id/flat/0A3221C70F24FB45833433255569204D1F8B57AD@G01JPEXMBYT05

Tsunakawa-san and I discussed a couple of approaches.  Extending
palloc_extended so as an incorrect length does not result in an error is
also something that crossed by mind, but the length handling is
different on the backend and the frontend, so I discarded the idea you
are proposing here and instead relied on a check with AllocSizeIsValid,
which gives a more simple patch:
https://www.postgresql.org/message-id/20180314052753.GA16179%40paquier.xyz

This got no interest from committers yet unfortunately, but I think that
this is a real problem which should be back-patched :(
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (18+ messages)  latest in thread

Message-ID: <20180426121348.GA2365@paquier.xyz>
Permalink:  ../20180426121348.GA2365@paquier.xyz/
Also on:    postgresql.org/message-id/20180426121348.GA2365@paquier.xyz

 · 

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-bugs@postgresql.org
  Cc: michael@paquier.xyz, horiguchi.kyotaro@lab.ntt.co.jp, emre@hasegeli.com, tomas.vondra@2ndquadrant.com, gurkan.gur@innogames.com, david.pusch@innogames.com, patrick.schmidt@innogames.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Standby corruption after master is restarted
  In-Reply-To: <20180426121348.GA2365@paquier.xyz>
  References: <CAE2gYzwDDnYLMW999NGyTjB9Vr84eARJ5-uWdctKq5zPtGeruQ@mail.gmail.com> <1da55c73-4bd1-f13e-2d4b-c4049ffd73f5@2ndquadrant.com> <CAE2gYzwB0+MM3L6-zdK0JKO_aXqHNCKU7VAiDJk_kKRRJ4B=yA@mail.gmail.com> <20180426.195304.118373455.horiguchi.kyotaro@lab.ntt.co.jp> <20180426121348.GA2365@paquier.xyz>

* 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