Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Changing WAL Header to reduce contention during ReserveXLogInsertLocation()
Date: 2018-02-16 06:54:04
Message-ID: 20180216065404.GD1174@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Feb 12, 2018 at 04:33:51PM +0530, Pavan Deolasee wrote:
> I'm not sure if Michael has spotted a real problem or was that just a
> concern. He himself later rightly pointed out that when a WAL file is
> switched, the old file is filled with zeros. So I don't see a problem
> there. May be I am missing something and Michael can explain further.

Sorry for my late reply here. I have been eyeballing the code for some
time to be sure that I was not missing something. A new segment is
filled with zeros when it is freshly created (see XLogFileInit), or when
doing a forced segment switch, but the checkpointer just renames the old
files which could perfectly contain past data which is reused
afterwards. So after doing one recycling cycle, the old data should be
overwritten when a second recycling cycle happens. One thing that
worries me though is related to timeline switches. The last, partial,
WAL segment may still have garbage data. Since 9.5 the segment is being
renamed with a dedicated suffix, but the file could be renamed if an
operator is willing to finish replay up to the end of the timeline where
this file is the last one, and it could have junk data that your checks
rely on. There may be other things I have not considered, but at least
that's one problem.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-02-16 07:19:00 Re: [bug fix] Cascaded standby cannot start after a clean shutdown
Previous Message Tom Lane 2018-02-16 05:28:53 Re: Removing useless #include's.