On Fri, Jan 14, 2011 at 4:13 AM, Magnus Hagander <mag...@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 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers