On 17.12.2010 19:08, Robert Haas wrote:
> On Fri, Dec 17, 2010 at 11:43 AM, Tom Lane<tgl@sss.pgh.pa.us> wrote:
>> Alvaro Herrera<alvherre@commandprompt.com> writes:
>>> Excerpts from Tom Lane's message of vie dic 17 13:18:35 -0300 2010:
>>>> I think what we ought to be looking to do is get rid of the distinction,
>>>> so that the postmaster treats walsenders the same as other children.
>>
>>> I think the problem with this is that walsenders are treated in a very
>>> special way during shutdown -- they need to stay up until after bgwriter
>>> is gone.
>>
>> Why do they need to survive the bgwriter?
Because we want the shutdown checkpoint record that bgwriter writes just
before it dies to be replicated to the standbys.
>> And more to the point, why
>> does that logic need to be implemented on the postmaster side? Since
>> only the child process really knows reliably whether it's a walsender,
>> it'd be far safer if the behavioral difference could be handled on the
>> child side. I haven't looked at the details, but I'm wondering if we
>> couldn't make this go by having walsender children react differently
>> to the same signals the postmaster sends other children.
>
> I'm not too sure we're shutting down the WAL senders right now.
Sure we do. postmaster sends walsenders SIGUSR2 when bgwriter dies. When
a walsender receives SIGUSR2, it tries to send all pending WAL, and
terminates after that. The postmaster goes into PM_SHUTDOWN_2 state,
waiting for all the walsenders and the archiver process to die.
-- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com