Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: l(at)lrowe(dot)co(dot)uk
Cc: PostgreSQL mailing lists <pgsql-bugs(at)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby
Date: 2015-11-02 05:53:14
Message-ID: CAB7nPqS-joTOdjqBUYGdawVcOw5UwrMZf+vOdzzbgHtDBg6SRg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, Oct 20, 2015 at 2:21 AM, Michael Paquier wrote:
> On Sat, Oct 17, 2015 at 11:10 PM, Michael Paquier wrote:
>> I think that a simple idea would be to not call LogStandbySnapshot() when
>> we are still at the beginning of a new segment. We know that the first page
>> of a WAL segment has a size of SizeOfXLogLongPHD, so just having a check on
>> that sounds enough to me. Per se the patch attached that should be applied
>> down to 9.4. This fixes the regression reported by Laurence for me.
>
> This bug fix is registered in next CF so as we do not lose track of it;
> https://commitfest.postgresql.org/7/398/

Andres has mentioned me during Postgres Europe that instead of looking
at if the last inserted record was at the beginning of a new segment,
we had better check if some progress has been done since the last
checkpoint that happened. Attached is a patch adding some logic to
track the LSN position of the last checkpoint record created, and log
the standby activity only if some progress has been done since. It
seems that we had better be sure that the last checkpoint record is
neither the last inserted record, nor the one previously inserted
before logging the standby activity, as a XLOG_STANDBY_LOCK record may
be added in between.
Regards,
--
Michael

Attachment Content-Type Size
20151102_archive_idle_v2.patch text/x-patch 4.6 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jeff Janes 2015-11-02 05:58:41 Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby
Previous Message Kevin Grittner 2015-10-31 20:12:10 Re: BUG #13667: SSI violation...

Browse pgsql-hackers by date

  From Date Subject
Next Message YuanyuanLiu 2015-11-02 05:54:58 Why not to use 'pg_ctl start -D ../data' to register posgtresql windows service
Previous Message Craig Ringer 2015-11-02 05:21:42 Re: remove wal_level archive