1. 09 9月, 2009 2 次提交
    • T
      Add a boolean GUC parameter "bonjour" to control whether a Bonjour-enabled · eeb6cb14
      Tom Lane 提交于
      build actually attempts to advertise itself via Bonjour.  Formerly it always
      did so, which meant that packagers had to decide for their users whether
      this behavior was wanted or not.  The default is "off" to be on the safe
      side, though this represents a change in the default behavior of a
      Bonjour-enabled build.  Per discussion.
      eeb6cb14
    • T
      Replace use of the long-deprecated Bonjour API DNSServiceRegistrationCreate · 59b9f3d3
      Tom Lane 提交于
      with the not-so-deprecated DNSServiceRegister.  This patch shouldn't change
      any user-visible behavior, it just gets rid of a deprecation warning in
      --with-bonjour builds.  The new code will fail on OS X releases before 10.3,
      but it seems unlikely that anyone will want to run Postgres 8.5 on 10.2.
      59b9f3d3
  2. 01 9月, 2009 1 次提交
    • T
      Change the autovacuum launcher to read pg_database directly, rather than · 00e6a16d
      Tom Lane 提交于
      via the "flat files" facility.  This requires making it enough like a backend
      to be able to run transactions; it's no longer an "auxiliary process" but
      more like the autovacuum worker processes.  Also, its signal handling has
      to be brought into line with backends/workers.  In particular, since it
      now has to handle procsignal.c processing, the special autovac-launcher-only
      signal conditions are moved to SIGUSR2.
      
      Alvaro, with some cleanup from Tom
      00e6a16d
  3. 30 8月, 2009 1 次提交
    • T
      Remove the use of the pg_auth flat file for client authentication. · e710b65c
      Tom Lane 提交于
      (That flat file is now completely useless, but removal will come later.)
      
      To do this, postpone client authentication into the startup transaction
      that's run by InitPostgres.  We still collect the startup packet and do
      SSL initialization (if needed) at the same time we did before.  The
      AuthenticationTimeout is applied separately to startup packet collection
      and the actual authentication cycle.  (This is a bit annoying, since it
      means a couple extra syscalls; but the signal handling requirements inside
      and outside a transaction are sufficiently different that it seems best
      to treat the timeouts as completely independent.)
      
      A small security disadvantage is that if the given database name is invalid,
      this will be reported to the client before any authentication happens.
      We could work around that by connecting to database "postgres" instead,
      but consensus seems to be that it's not worth introducing such surprising
      behavior.
      
      Processing of all command-line switches and GUC options received from the
      client is now postponed until after authentication.  This means that
      PostAuthDelay is much less useful than it used to be --- if you need to
      investigate problems during InitPostgres you'll have to set PreAuthDelay
      instead.  However, allowing an unauthenticated user to set any GUC options
      whatever seems a bit too risky, so we'll live with that.
      e710b65c
  4. 29 8月, 2009 2 次提交
    • T
      Remove useless code that propagated FrontendProtocol to a backend via a · 0a00c9a8
      Tom Lane 提交于
      PostgresMain switch.  In point of fact, FrontendProtocol is already set
      in a backend process, since ProcessStartupPacket() is executed inside
      the backend --- it hasn't been run by the postmaster for many years.
      And if it were, we'd still certainly want FrontendProtocol to be set before
      we get as far as PostgresMain, so that startup errors get reported in the
      right protocol.
      
      -v might have some future use in standalone backends, so I didn't go so
      far as to remove the switch outright.
      
      Also, initialize FrontendProtocol to 0 not PG_PROTOCOL_LATEST.  The only
      likely result of presetting it like that is to mask failure-to-set-it
      mistakes.
      0a00c9a8
    • T
      Non-Windows EXEC_BACKEND path was broken by recent write_inheritable_socket · c66d9ce7
      Tom Lane 提交于
      change ... it's got to return true.
      c66d9ce7
  5. 25 8月, 2009 3 次提交
    • T
      Try to make silent_mode behave somewhat reasonably. · 8bed238c
      Tom Lane 提交于
      Instead of sending stdout/stderr to /dev/null after forking away from the
      terminal, send them to postmaster.log within the data directory.  Since
      this opens the door to indefinite logfile bloat, recommend even more
      strongly that log output be redirected when using silent_mode.
      
      Move the postmaster's initial calls of load_hba() and load_ident() down
      to after we have started the log collector, if we are going to.  This
      is so that errors reported by them will appear in the "usual" place.
      
      Reclassify silent_mode as a LOGGING_WHERE, not LOGGING_WHEN, parameter,
      since it's got absolutely nothing to do with the latter category.
      
      In passing, fix some obsolete references to -S ... this option hasn't
      had that switch letter for a long time.
      
      Back-patch to 8.4, since as of 8.4 load_hba() and load_ident() are more
      picky (and thus more likely to fail) than they used to be.  This entire
      change was driven by a complaint about those errors disappearing into
      the bit bucket.
      8bed238c
    • T
      Small correction to previous patch: we shouldn't ReleasePostmasterChildSlot · 5a4f7638
      Tom Lane 提交于
      for a dead_end child, because we didn't AssignPostmasterChildSlot.
      5a4f7638
    • A
      Avoid calling kill() in a postmaster signal handler. · 45f9b464
      Alvaro Herrera 提交于
      This causes problems when the system load is high, per report from Zdenek
      Kotala in <1250860954.1239.114.camel@localhost>; instead of calling kill
      directly, have the signal handler set a flag which is checked in ServerLoop.
      This way, the handler can return before being called again by a subsequent
      signal sent from the autovacuum launcher.  Also, increase the sleep in the
      launcher in this failure path to 1 second.
      
      Backpatch to 8.3, which is when the signalling between autovacuum
      launcher/postmaster was introduced.
      
      Also, add a couple of ReleasePostmasterChildSlot calls in error paths; this
      part backpatched to 8.4 which is when the child slot stuff was introduced.
      45f9b464
  6. 07 8月, 2009 1 次提交
  7. 06 8月, 2009 1 次提交
  8. 25 7月, 2009 1 次提交
  9. 09 7月, 2009 1 次提交
  10. 27 6月, 2009 1 次提交
    • T
      Cleanup and code review for the patch that made bgwriter active during · 2de48a83
      Tom Lane 提交于
      archive recovery.  Invent a separate state variable and inquiry function
      for XLogInsertAllowed() to clarify some tests and make the management of
      writing the end-of-recovery checkpoint less klugy.  Fix several places
      that were incorrectly testing InRecovery when they should be looking at
      RecoveryInProgress or XLogInsertAllowed (because they will now be executed
      in the bgwriter not startup process).  Clarify handling of bad LSNs passed
      to XLogFlush during recovery.  Use a spinlock for setting/testing
      SharedRecoveryInProgress.  Improve quite a lot of comments.
      
      Heikki and Tom
      2de48a83
  11. 11 6月, 2009 1 次提交
  12. 06 5月, 2009 1 次提交
    • T
      Install a "dead man switch" to allow the postmaster to detect cases where · 969d7cd4
      Tom Lane 提交于
      a backend has done exit(0) or exit(1) without having disengaged itself
      from shared memory.  We are at risk for this whenever third-party code is
      loaded into a backend, since such code might not know it's supposed to go
      through proc_exit() instead.  Also, it is reported that under Windows
      there are ways to externally kill a process that cause the status code
      returned to the postmaster to be indistinguishable from a voluntary exit
      (thank you, Microsoft).  If this does happen then the system is probably
      hosed --- for instance, the dead session might still be holding locks.
      So the best recovery method is to treat this like a backend crash.
      
      The dead man switch is armed for a particular child process when it
      acquires a regular PGPROC, and disarmed when the PGPROC is released;
      these should be the first and last touches of shared memory resources
      in a backend, or close enough anyway.  This choice means there is no
      coverage for auxiliary processes, but I doubt we need that, since they
      shouldn't be executing any user-provided code anyway.
      
      This patch also improves the management of the EXEC_BACKEND
      ShmemBackendArray array a bit, by reducing search costs.
      
      Although this problem is of long standing, the lack of field complaints
      seems to mean it's not critical enough to risk back-patching; at least
      not till we get some more testing of this mechanism.
      969d7cd4
  13. 04 5月, 2009 2 次提交
  14. 03 5月, 2009 1 次提交
    • T
      Install some simple defenses in postmaster startup to help ensure a useful · d90984f4
      Tom Lane 提交于
      error message if the installation directory layout is messed up (or at least,
      something more useful than the behavior exhibited in bug #4787).  During
      postmaster startup, check that get_pkglib_path resolves as a readable
      directory; and if ParseTzFile() fails to open the expected timezone
      abbreviation file, check the possibility that the directory is missing rather
      than just the specified file.  In case of either failure, issue a hint
      suggesting that the installation is broken.  These two checks cover the lib/
      and share/ trees of a full installation, which should take care of most
      scenarios where a sysadmin decides to get cute.
      d90984f4
  15. 05 4月, 2009 1 次提交
  16. 04 3月, 2009 1 次提交
  17. 03 3月, 2009 1 次提交
  18. 25 2月, 2009 1 次提交
  19. 23 2月, 2009 1 次提交
  20. 20 2月, 2009 1 次提交
  21. 18 2月, 2009 1 次提交
    • H
      Start background writer during archive recovery. Background writer now performs · cdd46c76
      Heikki Linnakangas 提交于
      its usual buffer cleaning duties during archive recovery, and it's responsible
      for performing restartpoints.
      
      This requires some changes in postmaster. When the startup process has done
      all the initialization and is ready to start WAL redo, it signals the
      postmaster to launch the background writer. The postmaster is signaled again
      when the point in recovery is reached where we know that the database is in
      consistent state. Postmaster isn't interested in that at the moment, but
      that's the point where we could let other backends in to perform read-only
      queries. The postmaster is signaled third time when the recovery has ended,
      so that postmaster knows that it's safe to start accepting connections.
      
      The startup process now traps SIGTERM, and performs a "clean" shutdown. If
      you do a fast shutdown during recovery, a shutdown restartpoint is performed,
      like a shutdown checkpoint, and postmaster kills the processes cleanly. You
      still have to continue the recovery at next startup, though.
      
      Currently, the background writer is only launched during archive recovery.
      We could launch it during crash recovery as well, but it seems better to keep
      that codepath as simple as possible, for the sake of robustness. And it
      couldn't do any restartpoints during crash recovery anyway, so it wouldn't be
      that useful.
      
      log_restartpoints is gone. Use log_checkpoints instead. This is yet to be
      documented.
      
      This whole operation is a pre-requisite for Hot Standby, but has some value of
      its own whether the hot standby patch makes 8.4 or not.
      
      Simon Riggs, with lots of modifications by me.
      cdd46c76
  22. 05 1月, 2009 1 次提交
  23. 04 1月, 2009 1 次提交
    • T
      Create a "shmem_startup_hook" to be called at the end of shared memory · dad75a62
      Tom Lane 提交于
      initialization, to give loadable modules a reasonable place to perform
      creation of any shared memory areas they need.  This is the logical conclusion
      of our previous creation of RequestAddinShmemSpace() and RequestAddinLWLocks().
      We don't need an explicit shmem_shutdown_hook, because the existing
      on_shmem_exit and on_proc_exit mechanisms serve that need.
      
      Also, adjust SubPostmasterMain so that libraries that got loaded into the
      postmaster will be loaded into all child processes, not only regular backends.
      This improves consistency with the non-EXEC_BACKEND behavior, and might be
      necessary for functionality for some types of add-ons.
      dad75a62
  24. 02 1月, 2009 1 次提交
  25. 11 12月, 2008 1 次提交
  26. 28 10月, 2008 1 次提交
  27. 24 9月, 2008 1 次提交
  28. 23 9月, 2008 1 次提交
  29. 15 9月, 2008 1 次提交
  30. 25 8月, 2008 1 次提交
  31. 26 6月, 2008 2 次提交
  32. 20 6月, 2008 1 次提交
    • T
      Rewrite the sinval messaging mechanism to reduce contention and avoid · fad153ec
      Tom Lane 提交于
      unnecessary cache resets.  The major changes are:
      
      * When the queue overflows, we only issue a cache reset to the specific
      backend or backends that still haven't read the oldest message, rather
      than resetting everyone as in the original coding.
      
      * When we observe backend(s) falling well behind, we signal SIGUSR1
      to only one backend, the one that is furthest behind and doesn't already
      have a signal outstanding for it.  When it finishes catching up, it will
      in turn signal SIGUSR1 to the next-furthest-back guy, if there is one that
      is far enough behind to justify a signal.  The PMSIGNAL_WAKEN_CHILDREN
      mechanism is removed.
      
      * We don't attempt to clean out dead messages after every message-receipt
      operation; rather, we do it on the insertion side, and only when the queue
      fullness passes certain thresholds.
      
      * Split SInvalLock into SInvalReadLock and SInvalWriteLock so that readers
      don't block writers nor vice versa (except during the infrequent queue
      cleanout operations).
      
      * Transfer multiple sinval messages for each acquisition of a read or
      write lock.
      fad153ec
  33. 07 6月, 2008 1 次提交
  34. 05 5月, 2008 1 次提交