1. 05 Feb, 2020 1 commit
  2. 04 Feb, 2020 3 commits
    • Thomas Munro's avatar
      Handle lack of DSM slots in parallel btree build, take 2. · d9fe702a
      Thomas Munro authored
      Commit 74618e77 added a new check intended to fix a bug, but put
      it in the wrong place so that parallel btree build was always
      disabled.  Do the check after we've actually tried to create
      a DSM segment.  Back-patch to 11, like the earlier commit.
      
      Reviewed-by: Peter Geoghegan
      Discussion: https://postgr.es/m/CAH2-WzmDABkJzrNnvf%2BOULK-_A_j9gkYg_Dz-H62jzNv4eKQTw%40mail.gmail.com
      d9fe702a
    • Tom Lane's avatar
      Fix handling of "Subplans Removed" field in EXPLAIN output. · 7d91b604
      Tom Lane authored
      Commit 499be013 added this field in a rather poorly-thought-through
      manner, with the result being that rather than being a field of the
      Append or MergeAppend plan node as intended (and as it seems to be,
      in text format), it was actually an element of the "Plans" subgroup.
      At least in JSON format, that's flat out invalid syntax, because
      "Plans" is an array not an object.
      
      While it's not hard to move the generation of the field so that it
      appears where it's supposed to, this does result in a visible change
      in field order in text format, in cases where a Append or MergeAppend
      plan node has any InitPlans attached.  That's slightly annoying to
      do in stable branches; but the alternative of continuing to emit
      broken non-text formats seems worse.
      
      Also, since the set of fields emitted is not supposed to be
      data-dependent in non-text formats, make sure that "Subplans Removed"
      appears in Append and MergeAppend nodes even when it's zero, in those
      formats.  (The previous coding made it look like it could appear in
      some other node types such as BitmapAnd, but we don't actually support
      runtime pruning there, so don't emit it in those cases.)
      
      Per bug #16171 from Mahadevan Ramachandran.  Fix by Daniel Gustafsson
      and Tom Lane, reviewed by Hamid Akhtar.  Back-patch to v11 where this
      code came in.
      
      Discussion: https://postgr.es/m/16171-b72259ab75505fa2@postgresql.org
      7d91b604
    • Michael Paquier's avatar
      Fix fuzzy error handling in pg_basebackup when opening gzFile · 177be9ed
      Michael Paquier authored
      First, this code did not bother checking for a failure when calling
      dup().  Then, per zlib, gzerror() returns NULL for a NULL input, which
      can happen if passing down to gzdopen() an invalid file descriptor or if
      there was an allocation failure.
      
      No back-patch is done as this would unlikely be a problem in the field.
      
      Per Coverity.
      
      Reported-by: Tom Lane
      177be9ed
  3. 03 Feb, 2020 2 commits
  4. 02 Feb, 2020 1 commit
    • Tom Lane's avatar
      Fix assorted error-cleanup bugs in SSL min/max protocol version code. · 6148e2b9
      Tom Lane authored
      The error exits added to initialize_SSL() failed to clean up the
      partially-built SSL_context, and some of them also leaked the
      result of SSLerrmessage().  Make them match other error-handling
      cases in that function.
      
      The error exits added to connectOptions2() failed to set conn->status
      like every other error exit in that function.
      
      In passing, make the SSL_get_peer_certificate() error exit look more
      like all the other calls of SSLerrmessage().
      
      Oversights in commit ff8ca5fa.  Coverity whined about leakage of the
      SSLerrmessage() results; I noted the rest in manual code review.
      6148e2b9
  5. 01 Feb, 2020 3 commits
  6. 31 Jan, 2020 8 commits
    • Tom Lane's avatar
      Fix not-quite-right string comparison in parse_jsonb_index_flags(). · 870ad6a5
      Tom Lane authored
      This code would accept "strinX", where X is any 1-byte character,
      as meaning "string".  Clearly it wasn't meant to do that.
      
      No back-patch, since this doesn't affect correct queries and
      there's some tiny chance we'd break somebody's incorrect query
      in a minor release.
      
      Report and patch by Dominik Czarnota.
      
      Discussion: https://postgr.es/m/CABEVAa1dU0mDCAfaT8WF2adVXTDsLVJy_izotg6ze_hh-cn8qQ@mail.gmail.com
      870ad6a5
    • Tom Lane's avatar
      Fix CheckAttributeType's handling of collations for ranges. · 74b35eb4
      Tom Lane authored
      Commit fc769589 changed CheckAttributeType to recurse into ranges,
      but made it pass down the wrong collation (always InvalidOid, since
      ranges as such have no collation).  This would result in guaranteed
      failure when considering a range type whose subtype is collatable.
      
      Embarrassingly, we lack any regression tests that would expose such
      a problem (but fortunately, somebody noticed before we shipped this
      bug in any release).
      
      Fix it to pass down the range's subtype collation property instead,
      and add some regression test cases to exercise collatable-subtype
      ranges a bit more.  Back-patch to all supported branches, as the
      previous patch was.
      
      Report and patch by Julien Rouhaud, test cases tweaked by me
      
      Discussion: https://postgr.es/m/CAOBaU_aBWqNweiGUFX0guzBKkcfJ8mnnyyGC_KBQmO12Mj5f_A@mail.gmail.com
      74b35eb4
    • Tom Lane's avatar
      Fix parallel pg_dump/pg_restore for failure to create worker processes. · 2425f8f7
      Tom Lane authored
      If we failed to fork a worker process, or create a communication pipe
      for one, WaitForTerminatingWorkers would suffer an assertion failure
      if assert-enabled, otherwise crash or go into an infinite loop.  This
      was a consequence of not accounting for the startup condition where
      we've not yet forked all the workers.
      
      The original bug was that ParallelBackupStart would set workerStatus to
      WRKR_IDLE before it had successfully forked a worker.  I made things
      worse in commit b7b8cc0c by not understanding the undocumented fact
      that the WRKR_TERMINATED state was also meant to represent the case
      where a worker hadn't been started yet: I changed enum T_WorkerStatus
      so that *all* the worker slots were initially in WRKR_IDLE state.  But
      this wasn't any more broken in practice, since even one slot in the
      wrong state would keep WaitForTerminatingWorkers from terminating.
      
      In v10 and later, introduce an explicit T_WorkerStatus value for
      worker-not-started, in hopes of preventing future oversights of the
      same ilk.  Before that, just document that WRKR_TERMINATED is supposed
      to cover that case (partly because it wasn't actively broken, and
      partly because the enum is exposed outside parallel.c in those branches,
      so there's microscopically more risk involved in changing it).
      In all branches, introduce a WORKER_IS_RUNNING status test macro
      to hide which T_WorkerStatus values mean that, and be more careful
      not to access ParallelSlot fields till we're sure they're valid.
      
      Per report from Vignesh C, though this is my patch not his.
      Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/CALDaNm1Luv-E3sarR+-unz-BjchquHHyfP+YC+2FS2pt_J+wxg@mail.gmail.com
      2425f8f7
    • Peter Eisentraut's avatar
      Allow building without default socket directory · a9cff89f
      Peter Eisentraut authored
      We have code paths for Unix socket support and no Unix socket support.
      Now add a third variant: Unix socket support but do not use a Unix
      socket by default in the client or the server, only if you explicitly
      specify one.  This will be useful when we enable Unix socket support
      on Windows.
      
      To implement this, tweak things so that setting DEFAULT_PGSOCKET_DIR
      to "" has the desired effect.  This mostly already worked like that;
      only a few places needed to be adjusted.  Notably, the reference to
      DEFAULT_PGSOCKET_DIR in UNIXSOCK_PATH() could be removed because all
      callers already resolve an empty socket directory setting with a
      default if appropriate.
      Reviewed-by: default avatarTom Lane <tgl@sss.pgh.pa.us>
      Discussion: https://www.postgresql.org/message-id/75f72249-8ae6-322a-63df-4fe03eeccb9f@2ndquadrant.com
      a9cff89f
    • Peter Eisentraut's avatar
      Sprinkle some const decorations · 7c23bfd2
      Peter Eisentraut authored
      This might help clarify the API a bit.
      7c23bfd2
    • Michael Paquier's avatar
      Fix typo in recently-added TAP test for replication slots · 7ca8c970
      Michael Paquier authored
      Oversight in commit b0afdcad.
      7ca8c970
    • Thomas Munro's avatar
      Report time spent in posix_fallocate() as a wait event. · ef02fb15
      Thomas Munro authored
      When allocating DSM segments with posix_fallocate() on Linux (see commit
      899bd785), report this activity as a wait event exactly as we would if
      we were using file-backed DSM rather than shm_open()-backed DSM.
      
      Author: Thomas Munro
      Discussion: https://postgr.es/m/CA%2BhUKGKCSh4GARZrJrQZwqs5SYp0xDMRr9Bvb%2BHQzJKvRgL6ZA%40mail.gmail.com
      ef02fb15
    • Thomas Munro's avatar
      Adjust DSM and DSA slot usage constants. · d061ea21
      Thomas Munro authored
      When running a lot of large parallel queries concurrently, or a plan with
      a lot of separate Gather nodes, it is possible to run out of DSM slots.
      There are better solutions to these problems requiring architectural
      redesign work, but for now, let's adjust the constants so that it's more
      difficult to hit the limit.
      
      1.  Previously, a DSA area would create up to four segments at each size
      before doubling the size.  After this commit, it will create only two at
      each size, so it ramps up faster and therefore needs fewer slots.
      
      2.  Previously, the total limit on DSM slots allowed for 2 per connection.
      Switch to 5 per connection.
      
      Also remove an obsolete nearby comment.
      
      Author: Thomas Munro
      Reviewed-by: Robert Haas, Andres Freund
      Discussion: https://postre.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com
      d061ea21
  7. 30 Jan, 2020 8 commits
  8. 29 Jan, 2020 7 commits
  9. 28 Jan, 2020 7 commits