Re: Unlogged relation copy is not fsync'd

2024-01-05 Thread Robert Haas
On Fri, Sep 15, 2023 at 7:47 AM Heikki Linnakangas wrote: > Thinking about this some more, I think this is still not 100% correct, > even with the patch I posted earlier: This is marked as needing review, but that doesn't appear to be correct, because there's this comment, indicating that the pat

Re: Unlogged relation copy is not fsync'd

2023-10-07 Thread Noah Misch
On Wed, Sep 20, 2023 at 11:22:10PM -0700, Noah Misch wrote: > On Fri, Sep 15, 2023 at 02:47:45PM +0300, Heikki Linnakangas wrote: > > On 05/09/2023 21:20, Robert Haas wrote: > > > Thinking about this some more, I think this is still not 100% correct, even > > with the patch I posted earlier: > >

Re: Unlogged relation copy is not fsync'd

2023-09-20 Thread Noah Misch
On Fri, Sep 15, 2023 at 02:47:45PM +0300, Heikki Linnakangas wrote: > On 05/09/2023 21:20, Robert Haas wrote: > Thinking about this some more, I think this is still not 100% correct, even > with the patch I posted earlier: > > > /* > > * When we WAL-logged rel pages, we must nonetheless

Re: Unlogged relation copy is not fsync'd

2023-09-15 Thread Heikki Linnakangas
On 05/09/2023 21:20, Robert Haas wrote: In other words, somehow it feels like we ought to be trying to defer the fsync here until a clean shutdown actually occurs, instead of performing it immediately. +1 Admittedly, the bookkeeping seems like a problem, so maybe this is the best we can do, b

Re: Unlogged relation copy is not fsync'd

2023-09-15 Thread Heikki Linnakangas
On 04/09/2023 16:59, Melanie Plageman wrote: The patch looks reasonable to me. Is this [1] case in hash index build that I reported but didn't take the time to reproduce similar? [1] https://www.postgresql.org/message-id/CAAKRu_bPc81M121pOEU7W%3D%2BwSWEebiLnrie4NpaFC%2BkWATFtSA%40mail.gmail.com

Re: Unlogged relation copy is not fsync'd

2023-09-06 Thread Michael Paquier
On Tue, Sep 05, 2023 at 02:20:18PM -0400, Robert Haas wrote: > The general rule throughout the system is that the init-fork of an > unlogged relation is treated the same as a permanent relation: it is > WAL-logged and fsyncd. But the other forks of an unlogged relation are > neither WAL-logged nor

Re: Unlogged relation copy is not fsync'd

2023-09-05 Thread Robert Haas
On Fri, Aug 25, 2023 at 8:47 AM Heikki Linnakangas wrote: > 1. Create an unlogged table > 2. ALTER TABLE unlogged_tbl SET TABLESPACE ... -- This calls > RelationCopyStorage > 3. a checkpoint happens while the command is running > 4. After the ALTER TABLE has finished, shut down postgres cleanly. >

Re: Unlogged relation copy is not fsync'd

2023-09-04 Thread Melanie Plageman
On Fri, Aug 25, 2023 at 8:47 AM Heikki Linnakangas wrote: > > I noticed another missing fsync() with unlogged tables, similar to the > one at [1]. > > RelationCopyStorage does this: > > > /* > >* When we WAL-logged rel pages, we must nonetheless fsync them. The > >* reason i

Re: Unlogged relation copy is not fsync'd

2023-09-04 Thread Michael Paquier
On Fri, Aug 25, 2023 at 03:47:27PM +0300, Heikki Linnakangas wrote: > That 'copying_initfork' condition is wrong. The first hint of that is that > 'use_wal' is always true for an init fork. I believe this was meant to check > for 'relpersistence == RELPERSISTENCE_UNLOGGED'. Otherwise, this bad thin

Unlogged relation copy is not fsync'd

2023-08-25 Thread Heikki Linnakangas
I noticed another missing fsync() with unlogged tables, similar to the one at [1]. RelationCopyStorage does this: /* * When we WAL-logged rel pages, we must nonetheless fsync them. The * reason is that since we're copying outside shared buffers, a CHECKPOINT