Re: Streaming base backups - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Streaming base backups
Date
Msg-id AANLkTi=DJSJ8=pzk=b4tPBVxN7pjm4ot9QxhtWA4o6+q@mail.gmail.com
Whole thread Raw
In response to Re: Streaming base backups  (Magnus Hagander <magnus@hagander.net>)
Responses Re: Streaming base backups  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
On Fri, Jan 14, 2011 at 4:13 AM, Magnus Hagander <magnus@hagander.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
backupdoesn'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
thelast 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


pgsql-hackers by date:

Previous
From: Itagaki Takahiro
Date:
Subject: Re: SQL/MED - file_fdw
Next
From: Jeff Davis
Date:
Subject: Re: WIP: RangeTypes