1. 15 Aug, 2017 5 commits
  2. 14 Aug, 2017 8 commits
    • Andres Freund's avatar
      Expand coverage of parallel gather merge a bit. · d2bc5015
      Andres Freund authored
      Previously paths reaching heap_compare_slots weren't covered.
      
      Author: Rushabh Lathia
      Reviewed-By: Andres Freund
      Discussion:
      	https://postgr.es/m/CAGPqQf3C+3PBujb+7m=ceWeii4-vBY=XS99LjzrpkpefvzJbFg@mail.gmail.com
      	https://postgr.es/m/27200.1502482851@sss.pgh.pa.us
      Backpatch: 10, where gather merge was introduced
      d2bc5015
    • Tom Lane's avatar
      Stamp HEAD as 11devel. · 9f14dc39
      Tom Lane authored
      Note that we no longer require any manual adjustments to shared-library
      minor version numbers, cf commit a3bce17e.  So this should be everything.
      9f14dc39
    • Tom Lane's avatar
      Final pgindent + perltidy run for v10. · 21d304df
      Tom Lane authored
      21d304df
    • Tom Lane's avatar
      Handle elog(FATAL) during ROLLBACK more robustly. · 5b6289c1
      Tom Lane authored
      Stress testing by Andreas Seltenreich disclosed longstanding problems that
      occur if a FATAL exit (e.g. due to receipt of SIGTERM) occurs while we are
      trying to execute a ROLLBACK of an already-failed transaction.  In such a
      case, xact.c is in TBLOCK_ABORT state, so that AbortOutOfAnyTransaction
      would skip AbortTransaction and go straight to CleanupTransaction.  This
      led to an assert failure in an assert-enabled build (due to the ROLLBACK's
      portal still having a cleanup hook) or without assertions, to a FATAL exit
      complaining about "cannot drop active portal".  The latter's not
      disastrous, perhaps, but it's messy enough to want to improve it.
      
      We don't really want to run all of AbortTransaction in this code path.
      The minimum required to clean up the open portal safely is to do
      AtAbort_Memory and AtAbort_Portals.  It seems like a good idea to
      do AtAbort_Memory unconditionally, to be entirely sure that we are
      starting with a safe CurrentMemoryContext.  That means that if the
      main loop in AbortOutOfAnyTransaction does nothing, we need an extra
      step at the bottom to restore CurrentMemoryContext = TopMemoryContext,
      which I chose to do by invoking AtCleanup_Memory.  This'll result in
      calling AtCleanup_Memory twice in many of the paths through this function,
      but that seems harmless and reasonably inexpensive.
      
      The original motivation for the assertion in AtCleanup_Portals was that
      we wanted to be sure that any user-defined code executed as a consequence
      of the cleanup hook runs during AbortTransaction not CleanupTransaction.
      That still seems like a valid concern, and now that we've seen one case
      of the assertion firing --- which means that exactly that would have
      happened in a production build --- let's replace the Assert with a runtime
      check.  If we see the cleanup hook still set, we'll emit a WARNING and
      just drop the hook unexecuted.
      
      This has been like this a long time, so back-patch to all supported
      branches.
      
      Discussion: https://postgr.es/m/877ey7bmun.fsf@ansel.ydns.eu
      5b6289c1
    • Peter Eisentraut's avatar
      Fix typo · 7f1bb1d7
      Peter Eisentraut authored
      Author: Masahiko Sawada <sawada.mshk@gmail.com>
      7f1bb1d7
    • Peter Eisentraut's avatar
      doc: Fix logical replication protocol doc detail · 79e5de69
      Peter Eisentraut authored
      Author: Masahiko Sawada <sawada.mshk@gmail.com>
      Reported-by: default avatarKyle Conroy <kyle@kyleconroy.com>
      Bug: #14775
      79e5de69
    • Tom Lane's avatar
      Absorb -D_USE_32BIT_TIME_T switch from Perl, if relevant. · 5a5c2fec
      Tom Lane authored
      Commit 3c163a7f's original choice to ignore all #define symbols whose
      names begin with underscore turns out to be too simplistic.  On Windows,
      some Perl installations are built with -D_USE_32BIT_TIME_T, and we must
      absorb that or we get the wrong result for sizeof(PerlInterpreter).
      
      This effectively re-reverts commit ef58b87d, which injected that symbol
      in a hacky way, making it apply to all of Postgres not just PL/Perl.
      More significantly, it did so on *all* 32-bit Windows builds, even when
      the Perl build to be used did not select this option; so that it fails
      to work properly with some newer Perl builds.
      
      By making this change, we would be introducing an ABI break in 32-bit
      Windows builds; but fortunately we have not used type time_t in any
      exported Postgres APIs in a long time.  So it should be OK, both for
      PL/Perl itself and for third-party extensions, if an extension library
      is built with a different _USE_32BIT_TIME_T setting than the core code.
      
      Patch by me, based on research by Ashutosh Sharma and Robert Haas.
      Back-patch to all supported branches, as commit 3c163a7f was.
      
      Discussion: https://postgr.es/m/CANFyU97OVQ3+Mzfmt3MhuUm5NwPU=-FtbNH5Eb7nZL9ua8=rcA@mail.gmail.com
      5a5c2fec
    • Michael Meskes's avatar
  3. 13 Aug, 2017 3 commits
    • Tom Lane's avatar
      Remove AtEOXact_CatCache(). · 004a9702
      Tom Lane authored
      The sole useful effect of this function, to check that no catcache
      entries have positive refcounts at transaction end, has really been
      obsolete since we introduced ResourceOwners in PG 8.1.  We reduced the
      checks to assertions years ago, so that the function was a complete
      no-op in production builds.  There have been previous discussions about
      removing it entirely, but consensus up to now was that it had some small
      value as a cross-check for bugs in the ResourceOwner logic.
      
      However, it now emerges that it's possible to trigger these assertions
      if you hit an assert-enabled backend with SIGTERM during a call to
      SearchCatCacheList, because that function temporarily increases the
      refcounts of entries it's intending to add to a catcache list construct.
      In a normal ERROR scenario, the extra refcounts are cleaned up by
      SearchCatCacheList's PG_CATCH block; but in a FATAL exit we do a
      transaction abort and exit without ever executing PG_CATCH handlers.
      
      There's a case to be made that this is a generic hazard and we should
      consider restructuring elog(FATAL) handling so that pending PG_CATCH
      handlers do get run.  That's pretty scary though: it could easily create
      more problems than it solves.  Preliminary stress testing by Andreas
      Seltenreich suggests that there are not many live problems of this ilk,
      so we rejected that idea.
      
      There are more-localized ways to fix the problem; the most principled
      one would be to use PG_ENSURE_ERROR_CLEANUP instead of plain PG_TRY.
      But adding cycles to SearchCatCacheList isn't very appealing.  We could
      also weaken the assertions in AtEOXact_CatCache in some more or less
      ad-hoc way, but that just makes its raison d'etre even less compelling.
      In the end, the most reasonable solution seems to be to just remove
      AtEOXact_CatCache altogether, on the grounds that it's not worth trying
      to fix it.  It hasn't found any bugs for us in many years.
      
      Per report from Jeevan Chalke.  Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/CAM2+6=VEE30YtRQCZX7_sCFsEpoUkFBV1gZazL70fqLn8rcvBA@mail.gmail.com
      004a9702
    • Alvaro Herrera's avatar
      2336f842
    • Noah Misch's avatar
  4. 12 Aug, 2017 1 commit
  5. 11 Aug, 2017 11 commits
  6. 10 Aug, 2017 5 commits
  7. 09 Aug, 2017 2 commits
    • Tom Lane's avatar
      Fix handling of container types in find_composite_type_dependencies. · 749c7c41
      Tom Lane authored
      find_composite_type_dependencies correctly found columns that are of
      the specified type, and columns that are of arrays of that type, but
      not columns that are domains or ranges over the given type, its array
      type, etc.  The most general way to handle this seems to be to assume
      that any type that is directly dependent on the specified type can be
      treated as a container type, and processed recursively (allowing us
      to handle nested cases such as ranges over domains over arrays ...).
      Since a type's array type already has such a dependency, we can drop
      the existing special case for the array type.
      
      The very similar logic in get_rels_with_domain was likewise a few
      bricks shy of a load, as it supposed that a directly dependent type
      could *only* be a sub-domain.  This is already wrong for ranges over
      domains, and it'll someday be wrong for arrays over domains.
      
      Add test cases illustrating the problems, and back-patch to all
      supported branches.
      
      Discussion: https://postgr.es/m/15268.1502309024@sss.pgh.pa.us
      749c7c41
    • Tom Lane's avatar
      Prevent passing down MAKELEVEL/MAKEFLAGS from non-GNU make to GNU make. · a76200de
      Tom Lane authored
      FreeBSD's make, for one, sets the MAKELEVEL environment variable when
      invoking commands.  In the special Makefile we provide to hand off control
      from a non-GNU make to GNU make, this causes GNU make to think it is a
      child make invocation rather than top-level.  That interferes with the hack
      added in commit dcae5fac to cause the temp-install tree to be made only by
      the top-level invocation of gmake.  Unset the variable to prevent that.
      
      Likewise unset MAKEFLAGS, which FreeBSD's make also sets, and which could
      easily confuse gmake.  There are no reports of actual trouble from that,
      but it seems better to be proactive.
      
      Back-patch to 9.5 where dcae5fac came in.
      
      Thomas Munro, hacked a bit more by me
      
      Discussion: https://postgr.es/m/CAEepm=1ueww35AXTkt1A3gyzZUqv5XCzh8RUNvJZAQAW=eOhVw@mail.gmail.com
      a76200de
  8. 08 Aug, 2017 5 commits