Re: Improve shutdown during online backup

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Improve shutdown during online backup
Дата
Msg-id 1207076598.4238.60.camel@ebony.site
обсуждение исходный текст
Ответ на Re: Improve shutdown during online backup  (Simon Riggs <simon@2ndquadrant.com>)
Ответы Re: Improve shutdown during online backup  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Re: Improve shutdown during online backup  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-patches
On Tue, 2008-04-01 at 17:42 +0100, Simon Riggs wrote:

> Few comments:
>
> * smart shutdown waits for sessions to complete, yet this just ignores
> smart shutdowns which is something a little different. I think we
> should wait for the backup to complete and then shutdown.

> * The #defines at top of postmaster.c are duplicated from xlog.c
> If we can't agree on a common header file then we should at least add a
> comment to mention they are duplicated (in both locations).

If we add a function called something like BackupInProgress() to xlog.c,
exported via miscadmin.h then we can use it within the
PostmasterStateMachine() function like this

    if (pmState == PM_WAIT_BACKENDS)
    {
        if (CountChildren() == 0 &&
            StartupPID == 0 &&
            (BgWriterPID == 0 || !FatalError) &&
            WalWriterPID == 0 &&
            AutoVacPID == 0 &&
            !BackupInProgress())   <---- new line

so that the postmaster doesn't need to know about how we do backups.

That way you don't need any of the special cases in your patch, nor is
there any need to duplicate the #defines.

--
  Simon Riggs
  2ndQuadrant  http://www.2ndQuadrant.com

  PostgreSQL UK 2008 Conference: http://www.postgresql.org.uk


В списке pgsql-patches по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Improve shutdown during online backup
Следующее
От: David Fetter
Дата:
Сообщение: Re: Consistent \d commands in psql