Skip to content
Snippets Groups Projects
  1. Jan 24, 2013
    • Tom Lane's avatar
      Fix failure to rotate postmaster log file for size reasons on Windows. · 8556869f
      Tom Lane authored
      When we eliminated "unnecessary" wakeups of the syslogger process, we
      broke size-based logfile rotation on Windows, because on that platform
      data transfer is done in a separate thread.  While non-Windows platforms
      would recheck the output file size after every log message, Windows only
      did so when the control thread woke up for some other reason, which might
      be quite infrequent.  Per bug #7814 from Tsunezumi.  Back-patch to 9.2
      where the problem was introduced.
      
      Jeff Janes
      8556869f
  2. Jan 01, 2013
  3. Nov 18, 2012
    • Tom Lane's avatar
      Fix syslogger to not fail when log_rotation_age exceeds 2^31 milliseconds. · d038966d
      Tom Lane authored
      We need to avoid calling WaitLatch with timeouts exceeding INT_MAX.
      Fortunately a simple clamp will do the trick, since no harm is done if
      the wait times out before it's really time to rotate the log file.
      Per bug #7670 (probably bug #7545 is the same thing, too).
      
      In passing, fix bogus definition of log_rotation_age's maximum value in
      guc.c --- it was numerically right, but only because MINS_PER_HOUR and
      SECS_PER_MINUTE have the same value.
      
      Back-patch to 9.2.  Before that, syslogger wasn't using WaitLatch.
      d038966d
  4. Oct 15, 2012
    • Tom Lane's avatar
      Split up process latch initialization for more-fail-soft behavior. · e81e8f93
      Tom Lane authored
      In the previous coding, new backend processes would attempt to create their
      self-pipe during the OwnLatch call in InitProcess.  However, pipe creation
      could fail if the kernel is short of resources; and the system does not
      recover gracefully from a FATAL error right there, since we have armed the
      dead-man switch for this process and not yet set up the on_shmem_exit
      callback that would disarm it.  The postmaster then forces an unnecessary
      database-wide crash and restart, as reported by Sean Chittenden.
      
      There are various ways we could rearrange the code to fix this, but the
      simplest and sanest seems to be to split out creation of the self-pipe into
      a new function InitializeLatchSupport, which must be called from a place
      where failure is allowed.  For most processes that gets called in
      InitProcess or InitAuxiliaryProcess, but processes that don't call either
      but still use latches need their own calls.
      
      Back-patch to 9.1, which has only a part of the latch logic that 9.2 and
      HEAD have, but nonetheless includes this bug.
      e81e8f93
  5. Jul 31, 2012
    • Tom Lane's avatar
      Fix syslogger so that log_truncate_on_rotation works in the first rotation. · b76356ac
      Tom Lane authored
      In the original coding of the log rotation stuff, we did not bother to make
      the truncation logic work for the very first rotation after postmaster
      start (or after a syslogger crash and restart).  It just always appended
      in that case.  It did not seem terribly important at the time, but we've
      recently had two separate complaints from people who expected it to work
      unsurprisingly.  (Both users tend to restart the postmaster about as often
      as a log rotation is configured to happen, which is maybe not typical use,
      but still...)  Since the initial log file is opened in the postmaster,
      fixing this requires passing down some more state to the syslogger child
      process.
      
      It's always been like this, so back-patch to all supported branches.
      b76356ac
  6. Jun 25, 2012
    • Peter Eisentraut's avatar
      Unify calling conventions for postgres/postmaster sub-main functions · eeece9e6
      Peter Eisentraut authored
      There was a wild mix of calling conventions: Some were declared to
      return void and didn't return, some returned an int exit code, some
      claimed to return an exit code, which the callers checked, but
      actually never returned, and so on.
      
      Now all of these functions are declared to return void and decorated
      with attribute noreturn and don't return.  That's easiest, and most
      code already worked that way.
      eeece9e6
  7. Jun 10, 2012
  8. May 13, 2012
    • Tom Lane's avatar
      Avoid unnecessary process wakeups in the log collector. · 398b2401
      Tom Lane authored
      syslogger was coded to wake up once per second whether there was anything
      useful to do or not.  As part of our campaign to reduce the server's idle
      power consumption, change it to use a latch for waiting.  Now, in the
      absence of any data to log or any signals to service, it will only wake up
      at the programmed logfile rotation times (if any).
      398b2401
  9. Apr 27, 2012
    • Tom Lane's avatar
      Fix syslogger's rotation disable/re-enable logic. · 537b2669
      Tom Lane authored
      If it fails to open a new log file, the syslogger assumes there's something
      wrong with its parameters (such as log_directory), and stops attempting
      automatic time-based or size-based log file rotations.  Sending it SIGHUP
      is supposed to start that up again.  However, the original coding for that
      was really bogus, involving clobbering a couple of GUC variables and hoping
      that SIGHUP processing would restore them.  Get rid of that technique in
      favor of maintaining a separate flag showing we've turned rotation off.
      Per report from Mark Kirkwood.
      
      Also, the syslogger will automatically attempt to create the log_directory
      directory if it doesn't exist, but that was only happening at startup.
      For consistency and ease of use, it should do the same whenever the value
      of log_directory is changed by SIGHUP.
      
      Back-patch to all supported branches.
      537b2669
  10. Apr 04, 2012
    • Tom Lane's avatar
      Fix syslogger to not lose log coherency under high load. · c17e863b
      Tom Lane authored
      The original coding of the syslogger had an arbitrary limit of 20 large
      messages concurrently in progress, after which it would just punt and dump
      message fragments to the output file separately.  Our ambitions are a bit
      higher than that now, so allow the data structure to expand as necessary.
      
      Reported and patched by Andrew Dunstan; some editing by Tom
      c17e863b
  11. Mar 29, 2012
  12. Feb 21, 2012
  13. Jan 02, 2012
  14. Apr 28, 2011
  15. Apr 10, 2011
  16. Jan 01, 2011
  17. Dec 10, 2010
    • Tom Lane's avatar
      Use symbolic names not octal constants for file permission flags. · 04f4e10c
      Tom Lane authored
      Purely cosmetic patch to make our coding standards more consistent ---
      we were doing symbolic some places and octal other places.  This patch
      fixes all C-coded uses of mkdir, chmod, and umask.  There might be some
      other calls I missed.  Inconsistency noted while researching tablespace
      directory permissions issue.
      04f4e10c
  18. Sep 20, 2010
  19. Jul 17, 2010
  20. Jul 06, 2010
  21. Apr 16, 2010
    • Heikki Linnakangas's avatar
      On Windows, syslogger runs in two threads. The main thread processes config · 961ad3fd
      Heikki Linnakangas authored
      reload and rotation signals, and a helper thread reads messages from the
      pipe and writes them to the log file. However, server code isn't generally
      thread-safe, so if both try to do e.g palloc()/pfree() at the same time,
      bad things will happen. To fix that, use a critical section (which is like
      a mutex) to enforce that only one the threads are active at a time.
      961ad3fd
  22. Apr 01, 2010
    • Heikki Linnakangas's avatar
      Don't pass an invalid file handle to dup2(). That causes a crash on · 93001dfd
      Heikki Linnakangas authored
      Windows, thanks to a feature in CRT called Parameter Validation.
      
      Backpatch to 8.2, which is the oldest version supported on Windows. In
      8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead of
      NULL_DEV #define for a /dev/null-like device. NULL_DEV was hard-coded to
      "/dev/null" regardless of platform, which didn't work on Windows, while
      DEVNULL works on all platforms. Restarting syslogger didn't work on
      Windows on versions 8.3 and below because of that.
      93001dfd
  23. Jan 02, 2010
  24. Nov 19, 2009
    • Tom Lane's avatar
      Fix memory leak in syslogger: logfile_rotate() would leak a copy of the · b1d55dca
      Tom Lane authored
      output filename if CSV logging was enabled and only one of the two possible
      output files got rotated during a particular call (which would, in fact,
      typically be the case during a size-based rotation).  This would amount to
      about MAXPGPATH (1KB) per rotation, and it's been there since the CSV
      code was put in, so it's surprising that nobody noticed it before.
      Per bug #5196 from Thomas Poindessous.
      b1d55dca
  25. Nov 05, 2009
  26. Jun 11, 2009
  27. Mar 18, 2009
  28. Feb 24, 2009
  29. Feb 03, 2009
  30. Jan 01, 2009
  31. Dec 11, 2008
  32. Feb 17, 2008
    • Tom Lane's avatar
      Replace time_t with pg_time_t (same values, but always int64) in on-disk · cd004067
      Tom Lane authored
      data structures and backend internal APIs.  This solves problems we've seen
      recently with inconsistent layout of pg_control between machines that have
      32-bit time_t and those that have already migrated to 64-bit time_t.  Also,
      we can get out from under the problem that Windows' Unix-API emulation is not
      consistent about the width of time_t.
      
      There are a few remaining places where local time_t variables are used to hold
      the current or recent result of time(NULL).  I didn't bother changing these
      since they do not affect any cross-module APIs and surely all platforms will
      have 64-bit time_t before overflow becomes an actual risk.  time_t should
      be avoided for anything visible to extension modules, however.
      cd004067
  33. Jan 25, 2008
  34. Jan 01, 2008
  35. Nov 15, 2007
  36. Sep 22, 2007
  37. Sep 20, 2007
  38. Aug 21, 2007
Loading