Re: Streaming base backups

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Magnus Hagander <magnus(at)hagander(dot)net>
Cc: Cédric Villemain <cedric(dot)villemain(dot)debian(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Streaming base backups
Date: 2011-01-14 06:45:52
Message-ID: AANLkTi=DJSJ8=pzk=b4tPBVxN7pjm4ot9QxhtWA4o6+q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 14, 2011 at 4:13 AM, Magnus Hagander <magnus(at)hagander(dot)net> wrote:
>> While walsender is sending a base backup, WalSndWakeup should
>> not send the signal to that walsender?
>
> True, it's not necessary. How bad does it actually hurt things though?
> Given that the walsender running the backup isn't actually waiting on
> the latch, it doesn't actually send a signal, does it?

Yeah, you are right. Once WalSndWakeup sends the signal to walsender,
latch->is_set is set. So, then WalSndWakeup does nothing against that
walsender until latch->is_set is reset. Since ResetLatch is not called while
walsender is sending a base backup, that would be harmless.

>> At the end of the backup by walsender, it forces a switch to a new
>> WAL file and waits until the last WAL file has been archived. So we
>> should change postmaster so that it doesn't cause the archiver to
>> end before walsender ends when shutdown is requested?
>
> Um. I have to admit I'm not entirely following what you mean enough to
> confirm it, but it *sounds* correct :-)
>
> What scenario exactly is the problematic one?

1. Smart shutdown is requested while walsender is sending a backup.
2. Shutdown causes archiver to end.
(Though shutdown sends SIGUSR2 to walsender to exit, walsender
running backup doesn't respond for now)
3. At the end of backup, walsender calls do_pg_stop_backup, which
forces a switch to a new WAL file and waits until the last WAL file has
been archived.
*BUT*, since archiver has already been dead, walsender waits for
that forever.

>> Also, when shutdown is requested, the walsender which is
>> streaming WAL should not end before another walsender which
>> is sending a backup ends, to stream the backup-end WAL?
>
> Not sure I see the reason for that. If we're shutting down in the
> middle of the base backup, we don't have any support for continuing
> that one after we're back up - you have to start over.

For now, shutdown is designed to cause walsender to end after
sending all the WAL records. So I thought that.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2011-01-14 08:27:04 Re: WIP: RangeTypes
Previous Message Itagaki Takahiro 2011-01-14 06:09:04 Re: SQL/MED - file_fdw