Re: reaper should restart archiver even on standby

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: reaper should restart archiver even on standby
Date: 2015-06-10 06:18:46
Message-ID: CAHGQGwFRzPh1r7=4Li4T4ic3E5FwwNY6F7nXFN5_8xWdfaBZZQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jun 9, 2015 at 5:21 AM, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> wrote:
> Fujii Masao wrote:
>> Hi,
>>
>> When the archiver exits, currently reaper() restarts it only while
>> the postmaster state is PM_RUN. This is OK in 9.4 or before because
>> the archiver could be running on that state. But in 9.5, we can set
>> archive_mode to "always" and start the archiver even on the standby.
>> So I think that reaper() should restart the archiver even when
>> the postmaster state is PM_RECOVERY or PM_HOT_STANDBY with
>> some conditions. Patch attached.
>
> Sounds reasonable, but the patch looks pretty messy.

Thanks for reviewing the patch!

> Can't we create
> some common function that would be called both here and on ServerLoop?

Agreed. So, what about the attached patch?

> We also have sigusr1_handler that starts an archiver -- why does that
> one use different conditions?

Because that code path can be reached only during recovery.
So XLogArchivingActive() which indicates whether archiver is
allowed to start during normal processing doesn't need to be
checked there.

OTOH, in the other places where archiver is started up,
we can reach there during not only recovery but also normal processing.
So the conditions that we need to check are different.

Regards,

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2015-06-10 06:27:09 Re: Typo fix loged vs logged.
Previous Message Magnus Hagander 2015-06-10 06:17:46 Re: Information of pg_stat_ssl visible to all users