Re: BUG #16039: PANIC when activating replication slots in Postgres12.0 64bit under Windows - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #16039: PANIC when activating replication slots in Postgres12.0 64bit under Windows
Date
Msg-id 20191006045548.GA14532@paquier.xyz
Whole thread Raw
In response to Re: BUG #16039: PANIC when activating replication slots in Postgres12.0 64bit under Windows  (Andres Freund <andres@anarazel.de>)
Responses Re: BUG #16039: PANIC when activating replication slots in Postgres12.0 64bit under Windows
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #16042: incorrect .gitignore file
Next
From: Michael Paquier
Date:
Subject: Re: BUG #16039: PANIC when activating replication slots in Postgres12.0 64bit under Windows