Re: Can PostgreSQL create new WAL files instead of reusing old ones? - Mailing list pgsql-general

From Fabio Ugo Venchiarutti
Subject Re: Can PostgreSQL create new WAL files instead of reusing old ones?
Date
Msg-id 984c4678-6a10-7457-81e3-74b3be15efc1@ocado.com
Whole thread Raw
In response to Re: Can PostgreSQL create new WAL files instead of reusing old ones?  (Bruce Momjian <bruce@momjian.us>)
List pgsql-general
I was wondering the same. The WAL writer is overwriting the same inodes
again and again, so block COW logic should only happen once: at allocation.

I'm no expert: does XFS track COW based on path (ugh?)


Maybe I'm crazy but here's a possible workaround if the problem is
effectively at that level: OP could use the archive_command to
deliberately allocate a new segment and switch the old one with it
before returning zero to the archiver.

The WAL writer will then recycle what it thinks is the same inode and
not your impostor.


I'm rather confident this should work ok but you may want to make sure
with the hackers that no file descriptors are open on a ready-to-archive
segments while you shuffle things around in your command (or some other
weird implication I'm missing).





On 27/04/18 17:28, Bruce Momjian wrote:
> On Wed, Apr 18, 2018 at 09:34:50AM -0400, Vick Khera wrote:
>> On Wed, Apr 18, 2018 at 12:35 AM, Michael Paquier <michael@paquier.xyz> wrote:
>>
>>
>>      That looks like a rather difficult problem to solve in PostgreSQL
>>      itself, as the operator running the cluster is in charge of setting up
>>      the FS options which would control the COW behavior, so it seems to me
>>
>>
>> You cannot turn off CoW on ZFS. What other behavior would you refer to here?
>>
>> I suppose one could make a dedicated data set for the WAL and have ZFS make a
>> reservation for about 2x the total expected WAL size. It would require careful
>> attention to detail if you increase WAL segments configuration, though, and if
>> you had any kind of hiccup with streaming replication that caused the segments
>> to stick around longer than expected (but that's no different from any other
>> file system).
>
> Uh, at the risk of asking an obvious question, why is the WAL file COW
> if it was renamed?  No one has the old WAL file open, as far as I know.
>

--
Regards

Fabio Ugo Venchiarutti
Data Services Department
Ocado Technology

--


Notice:  This email is confidential and may contain copyright material of
members of the Ocado Group. Opinions and views expressed in this message
may not necessarily reflect the opinions and views of the members of the
Ocado Group. 

 

If you are not the intended recipient, please notify us
immediately and delete all copies of this message. Please note that it is
your responsibility to scan this message for viruses. 

 

Fetch and Sizzle
are trading names of Speciality Stores Limited and Fabled is a trading name
of Marie Claire Beauty Limited, both members of the Ocado Group.

 


References to the “Ocado Group” are to Ocado Group plc (registered in
England and Wales with number 7098618) and its subsidiary undertakings (as
that expression is defined in the Companies Act 2006) from time to time.  
The registered office of Ocado Group plc is Buildings One & Two, Trident
Place, Mosquito Way, Hatfield, Hertfordshire, AL10 9UL.


pgsql-general by date:

Previous
From: Vitaliy Garnashevich
Date:
Subject: Re: Long running INSERT+SELECT query
Next
From: Michael Loftis
Date:
Subject: Re: Asynchronous Trigger?