Re: BUG #16039: PANIC when activating replication slots in Postgres 12.0 64bit under Windows

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: buschmann(at)nidsa(dot)net, pgsql-bugs(at)lists(dot)postgresql(dot)org, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Subject: Re: BUG #16039: PANIC when activating replication slots in Postgres 12.0 64bit under Windows
Date: 2019-10-06 04:55:48
Message-ID: 20191006045548.GA14532@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Fri, Oct 04, 2019 at 01:06:05PM -0700, Andres Freund wrote:
> I realize I perhaps should have added a comment explaining this, but
> this is far from the only location that knows we have to know open fds
> r/w to be able to fsync them.

Sorry for the late reply here. It looks like I messed up here, my
apologies for that. And thanks for fixing the issue.

It would have been nice to add some sanity checks based on fcntl() but
directory handling in pg_fsync() makes that annoying. Anyway, I have
checked the code with a little trick, and I have spotted a second bug:
CheckPointLogicalRewriteHeap() fsyncs a logical rewrite mapping file
with RDONLY. This is incorrect since b89e151.

> What were you even trying to fix by changing this?

Hardening of the code. Some code paths clearly relied on the
operations to be read-only.

> Seems also pretty clear that we need a few animals running with fsync
> enabled. Not sure how we best can write test infrastructure to make it
> easy to set that for all tests. Guess I best start a thread about it on
> -hackers.

I think that we would need more infrastructure here for TAP tests, aka
how to be able to enforce some parameters when setting the
configuration of a new node.

Attached are two patches: the actual bug fix and an extra patch with
the trick I have used to find it out (contrib/test_decoding/ was the
part which has blown up).
--
Michael

Attachment Content-Type Size
fsync-chkpt-fix.patch text/x-diff 558 bytes
fsync-trick.patch text/x-diff 1.3 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2019-10-06 05:00:11 Re: BUG #16039: PANIC when activating replication slots in Postgres 12.0 64bit under Windows
Previous Message Tom Lane 2019-10-05 16:48:04 Re: BUG #16042: incorrect .gitignore file