Re: GUC patch for Win32

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: GUC patch for Win32
Дата
Msg-id 200305082040.h48KeP324294@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: GUC patch for Win32  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Tom Lane wrote:
> Jan Wieck <JanWieck@Yahoo.com> writes:
> > If the user changes the config and HUP's the postmaster, postmaster
> > rereads the config and merges only those changes, that are changable at
> > runtime into it's status. From that status it creates the new file,
> > renames, HUP's the backends and they reread that file.
>
> That just moves any potential race conditions to another place, doesn't it?
> How's reading this file any safer than reading postgresql.conf?  If the
> PM gets a second SIGHUP in quick succession, it could be rewriting the
> intermediate file while backends are trying to read it.

I have applied the following patch to improve the race condition.  With
the old code, the nondefault setting file would be written after telling
the children to processing the nondefault setting file.  Now, the
nondefaults file is written before sending the children the SIGHUP.
This leaves the only race condition as when a new child is reading the
the nondefaults file for the first time.  I will make sure WIN32 doesn't
lose signals during startup time and processes the new version of the
file as well.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/postmaster/postmaster.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/postmaster/postmaster.c,v
retrieving revision 1.323
diff -c -c -r1.323 postmaster.c
*** src/backend/postmaster/postmaster.c    8 May 2003 14:49:03 -0000    1.323
--- src/backend/postmaster/postmaster.c    8 May 2003 20:30:34 -0000
***************
*** 1582,1592 ****
      if (Shutdown <= SmartShutdown)
      {
          elog(LOG, "Received SIGHUP, reloading configuration files");
-         SignalChildren(SIGHUP);
          ProcessConfigFile(PGC_SIGHUP);
  #ifdef EXEC_BACKEND
          write_nondefault_variables(PGC_SIGHUP);
  #endif
          load_hba();
          load_ident();
      }
--- 1582,1592 ----
      if (Shutdown <= SmartShutdown)
      {
          elog(LOG, "Received SIGHUP, reloading configuration files");
          ProcessConfigFile(PGC_SIGHUP);
  #ifdef EXEC_BACKEND
          write_nondefault_variables(PGC_SIGHUP);
  #endif
+         SignalChildren(SIGHUP);
          load_hba();
          load_ident();
      }

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Cleanup of shared memory attach
Следующее
От: Ian Barwick
Дата:
Сообщение: psql: tab completion for \encoding