1. 17 Apr, 2017 1 commit
    • Tom Lane's avatar
      Ensure BackgroundWorker struct contents are well-defined. · b6dd1271
      Tom Lane authored
      Coverity complained because bgw.bgw_extra wasn't being filled in by
      ApplyLauncherRegister().  The most future-proof fix is to memset the
      whole BackgroundWorker struct to zeroes.  While at it, let's apply the
      same coding rule to other places that set up BackgroundWorker structs;
      four out of five had the same or related issues.
      b6dd1271
  2. 01 Apr, 2017 1 commit
  3. 03 Jan, 2017 1 commit
  4. 05 Oct, 2016 1 commit
    • Robert Haas's avatar
      Rename WAIT_* constants to PG_WAIT_*. · d2ce38e2
      Robert Haas authored
      Windows apparently has a constant named WAIT_TIMEOUT, and some of these
      other names are pretty generic, too.  Insert "PG_" at the front of each
      name in order to disambiguate.
      
      Michael Paquier
      d2ce38e2
  5. 04 Oct, 2016 1 commit
    • Robert Haas's avatar
      Extend framework from commit 53be0b1a to report latch waits. · 6f3bd98e
      Robert Haas authored
      WaitLatch, WaitLatchOrSocket, and WaitEventSetWait now taken an
      additional wait_event_info parameter; legal values are defined in
      pgstat.h.  This makes it possible to uniquely identify every point in
      the core code where we are waiting for a latch; extensions can pass
      WAIT_EXTENSION.
      
      Because latches were the major wait primitive not previously covered
      by this patch, it is now possible to see information in
      pg_stat_activity on a large number of important wait events not
      previously addressed, such as ClientRead, ClientWrite, and SyncRep.
      
      Unfortunately, many of the wait events added by this patch will fail
      to appear in pg_stat_activity because they're only used in background
      processes which don't currently appear in pg_stat_activity.  We should
      fix this either by creating a separate view for such information, or
      else by deciding to include them in pg_stat_activity after all.
      
      Michael Paquier and Robert Haas, reviewed by Alexander Korotkov and
      Thomas Munro.
      6f3bd98e
  6. 01 Aug, 2016 1 commit
    • Tom Lane's avatar
      Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch. · 887feefe
      Tom Lane authored
      This coding pattern creates a race condition, because if an interesting
      interrupt happens after we've checked InterruptPending but before we reset
      our latch, the latch-setting done by the signal handler would get lost,
      and then we might block at WaitLatch in the next iteration without ever
      noticing the interrupt condition.  You can put the CHECK_FOR_INTERRUPTS
      before WaitLatch or after ResetLatch, but not between them.
      
      Aside from fixing the bugs, add some explanatory comments to latch.h
      to perhaps forestall the next person from making the same mistake.
      
      In HEAD, also replace gather_readnext's direct call of
      HandleParallelMessages with CHECK_FOR_INTERRUPTS.  It does not seem clean
      or useful for this one caller to bypass ProcessInterrupts and go straight
      to HandleParallelMessages; not least because that fails to consider the
      InterruptPending flag, resulting in useless work both here
      (if InterruptPending isn't set) and in the next CHECK_FOR_INTERRUPTS call
      (if it is).
      
      This thinko seems to have been introduced in the initial coding of
      storage/ipc/shm_mq.c (commit ec9037df), and then blindly copied into all
      the subsequent parallel-query support logic.  Back-patch relevant hunks
      to 9.4 to extirpate the error everywhere.
      
      Discussion: <1661.1469996911@sss.pgh.pa.us>
      887feefe
  7. 02 Jan, 2016 2 commits
    • Tom Lane's avatar
      Update copyright for 2016 · 48c9f288
      Tom Lane authored
      On closer inspection, the reason copyright.pl was missing files is
      that it is looking for 'Copyright (c)' and they had 'Copyright (C)'.
      Fix that, and update a couple more that grepping for that revealed.
      48c9f288
    • Tom Lane's avatar
      Update copyright for 2016 · ad08bf5c
      Tom Lane authored
      Manually fix some copyright lines missed by the automated script.
      ad08bf5c
  8. 09 Oct, 2015 1 commit
    • Robert Haas's avatar
      Remove set_latch_on_sigusr1 flag. · db0f6cad
      Robert Haas authored
      This flag has proven to be a recipe for bugs, and it doesn't seem like
      it can really buy anything in terms of performance.  So let's just
      *always* set the process latch when we receive SIGUSR1 instead of
      trying to do it only when needed.
      
      Per my recent proposal on pgsql-hackers.
      db0f6cad
  9. 19 Mar, 2015 1 commit
    • Robert Haas's avatar
      Add flags argument to dsm_create. · 12968cf4
      Robert Haas authored
      Right now, there's only one flag, DSM_CREATE_NULL_IF_MAXSEGMENTS,
      which suppresses the error that would normally be thrown when the
      maximum number of segments already exists, instead returning NULL.
      It might be useful to add more flags in the future, such as one to
      ignore allocation errors, but I haven't done that here.
      12968cf4
  10. 14 Jan, 2015 1 commit
    • Andres Freund's avatar
      Add a default local latch for use in signal handlers. · 59f71a0d
      Andres Freund authored
      To do so, move InitializeLatchSupport() into the new common process
      initialization functions, and add a new global variable MyLatch.
      
      MyLatch is usable as soon InitPostmasterChild() has been called
      (i.e. very early during startup). Initially it points to a process
      local latch that exists in all processes. InitProcess/InitAuxiliaryProcess
      then replaces that local latch with PGPROC->procLatch. During shutdown
      the reverse happens.
      
      This is primarily advantageous for two reasons: For one it simplifies
      dealing with the shared process latch, especially in signal handlers,
      because instead of having to check for MyProc, MyLatch can be used
      unconditionally. For another, a later patch that makes FEs/BE
      communication use latches, now can rely on the existence of a latch,
      even before having gone through InitProcess.
      
      Discussion: 20140927191243.GD5423@alap3.anarazel.de
      59f71a0d
  11. 30 Nov, 2014 1 commit
    • Alvaro Herrera's avatar
      Move test modules from contrib to src/test/modules · 22dfd116
      Alvaro Herrera authored
      This is advance preparation for introducing even more test modules; the
      easy solution is to add them to contrib, but that's bloated enough that
      it seems a good time to think of something different.
      
      Moved modules are dummy_seclabel, test_shm_mq, test_parser and
      worker_spi.
      
      (test_decoding was also a candidate, but there was too much opposition
      to moving that one.  We can always reconsider later.)
      22dfd116
  12. 06 May, 2014 1 commit
    • Bruce Momjian's avatar
      pgindent run for 9.4 · 0a783200
      Bruce Momjian authored
      This includes removing tabs after periods in C comments, which was
      applied to back branches, so this change should not effect backpatching.
      0a783200
  13. 18 Mar, 2014 1 commit
  14. 16 Jan, 2014 1 commit
  15. 15 Jan, 2014 4 commits
  16. 14 Jan, 2014 1 commit
    • Robert Haas's avatar
      Test code for shared memory message queue facility. · 4db3744f
      Robert Haas authored
      This code is intended as a demonstration of how the dynamic shared
      memory and dynamic background worker facilities can be used to establish
      a group of coooperating processes which can coordinate their activities
      using the shared memory message queue facility.  By itself, the code
      does nothing particularly interesting: it simply allows messages to
      be passed through a loop of workers and back to the original process.
      But it's a useful unit test, in addition to its demonstration value.
      4db3744f