1. 19 Dec, 2019 3 commits
    • Robert Haas's avatar
      Update neglected comment. · 7cdcc747
      Robert Haas authored
      Commit d986d4e8 renamed a variable
      but neglected to update the corresponding comment.
      
      Amit Langote
      7cdcc747
    • Robert Haas's avatar
      Fix minor problems with non-exclusive backup cleanup. · 30364019
      Robert Haas authored
      The previous coding imagined that it could call before_shmem_exit()
      when a non-exclusive backup began and then remove the previously-added
      handler by calling cancel_before_shmem_exit() when that backup
      ended. However, this only works provided that nothing else in the
      system has registered a before_shmem_exit() hook in the interim,
      because cancel_before_shmem_exit() is documented to remove a callback
      only if it is the latest callback registered. It also only works
      if nothing can ERROR out between the time that sessionBackupState
      is reset and the time that cancel_before_shmem_exit(), which doesn't
      seem to be strictly true.
      
      To fix, leave the handler installed for the lifetime of the session,
      arrange to install it just once, and teach it to quietly do nothing if
      there isn't a non-exclusive backup in process.
      
      This is a bug, but for now I'm not going to back-patch, because the
      consequences are minor. It's possible to cause a spurious warning
      to be generated, but that doesn't really matter. It's also possible
      to trigger an assertion failure, but production builds shouldn't
      have assertions enabled.
      
      Patch by me, reviewed by Kyotaro Horiguchi, Michael Paquier (who
      preferred a different approach, but got outvoted), Fujii Masao,
      and Tom Lane, and with comments by various others.
      
      Discussion: http://postgr.es/m/CA+TgmobMjnyBfNhGTKQEDbqXYE3_rXWpc4CM63fhyerNCes3mA@mail.gmail.com
      30364019
    • Peter Eisentraut's avatar
      Add support for MSYS2 · e975c1a6
      Peter Eisentraut authored
      It's basically a variant of Cygwin, so use that template.
      
      Discussion: https://www.postgresql.org/message-id/flat/6b467edc-4018-521f-ab18-171f098557ca%402ndquadrant.com
      e975c1a6
  2. 18 Dec, 2019 11 commits
  3. 17 Dec, 2019 14 commits
  4. 16 Dec, 2019 6 commits
  5. 15 Dec, 2019 1 commit
  6. 14 Dec, 2019 5 commits
    • Tom Lane's avatar
      Try to stabilize results of new tuplesort regression test. · baa32ce2
      Tom Lane authored
      It appears that a concurrent autovacuum/autoanalyze run can cause
      changes in the plans expected by this test.  To prevent that, change
      the tables it uses to be temp tables --- there's no need for them
      to be permanent, and this should save a few cycles too.
      
      Discussion: https://postgr.es/m/3244.1576160824@sss.pgh.pa.us
      baa32ce2
    • Tom Lane's avatar
      Prevent overly-aggressive collapsing of joins to RTE_RESULT relations. · 6ea364e7
      Tom Lane authored
      The RTE_RESULT simplification logic added by commit 4be058fe had a
      flaw: it would collapse out a RTE_RESULT that is due to compute a
      PlaceHolderVar, and reassign the PHV to the parent join level, even if
      another input relation of the join contained a lateral reference to
      the PHV.  That can't work because the PHV would be computed too late.
      In practice it led to failures of internal sanity checks later in
      planning (either assertion failures or errors such as "failed to
      construct the join relation").
      
      To fix, add code to check for the presence of such PHVs in relevant
      portions of the query tree.  Notably, this required refactoring
      range_table_walker so that a caller could ask to walk individual RTEs
      not the whole list.  (It might be a good idea to refactor
      range_table_mutator in the same way, if only to keep those functions
      looking similar; but I didn't do so here as it wasn't necessary for
      the bug fix.)
      
      This exercise also taught me that find_dependent_phvs(), as it stood,
      could only safely be used on the entire Query, not on subtrees.
      Adjust its API to reflect that; which in passing allows it to have
      a fast path for the common case of no PHVs anywhere.
      
      Per report from Will Leinweber.  Back-patch to v12 where the bug
      was introduced.
      
      Discussion: https://postgr.es/m/CALLb-4xJMd4GZt2YCecMC95H-PafuWNKcmps4HLRx2NHNBfB4g@mail.gmail.com
      6ea364e7
    • Michael Paquier's avatar
      Fix memory leak when initializing DH parameters in backend · e0e569e1
      Michael Paquier authored
      When loading DH parameters used for the generation of ephemeral DH keys
      in the backend, the code has never bothered releasing the memory used
      for the DH information loaded from a file or from libpq's default.  This
      commit makes sure that the information is properly free()'d.
      
      Note that as SSL parameters can be reloaded, this can cause an accumulation
      of memory leaked.  As the leak is minor, no backpatch is done.
      
      Reported-by: Dmitry Uspenskiy
      Discussion: https://postgr.es/m/16160-18367e56e9a28264@postgresql.org
      e0e569e1
    • Thomas Munro's avatar
      Fix mdsyncfiletag(), take II. · 7c85be08
      Thomas Munro authored
      The previous commit failed to consider that FileGetRawDesc() might
      not return a valid fd, as discovered on the build farm.  Switch to
      using the File interface only.
      
      Back-patch to 12, like the previous commit.
      7c85be08
    • Thomas Munro's avatar
      Don't use _mdfd_getseg() in mdsyncfiletag(). · 7bb3102c
      Thomas Munro authored
      _mdfd_getseg() opens all segments up to the requested one.  That
      causes problems for mdsyncfiletag(), if mdunlinkfork() has
      already unlinked other segment files.  Open the file we want
      directly by name instead, if it's not already open.
      
      The consequence of this bug was a rare panic in the checkpointer,
      made more likely if you saturated the sync request queue so that
      the SYNC_FORGET_REQUEST messages for a given relation were more
      likely to be absorbed in separate cycles by the checkpointer.
      
      Back-patch to 12.  Defect in commit 3eb77eba.
      
      Author: Thomas Munro
      Reported-by: Justin Pryzby
      Discussion: https://postgr.es/m/20191119115759.GI30362%40telsasoft.com
      7bb3102c