1. 02 Mar, 2017 6 commits
  2. 01 Mar, 2017 11 commits
  3. 28 Feb, 2017 2 commits
  4. 27 Feb, 2017 8 commits
    • Tom Lane's avatar
      Allow index AMs to return either HeapTuple or IndexTuple format during IOS. · 9b88f27c
      Tom Lane authored
      Previously, only IndexTuple format was supported for the output data of
      an index-only scan.  This is fine for btree, which is just returning a
      verbatim index tuple anyway.  It's not so fine for SP-GiST, which can
      return reconstructed data that's much larger than a page.
      
      To fix, extend the index AM API so that index-only scan data can be
      returned in either HeapTuple or IndexTuple format.  There's other ways
      we could have done it, but this way avoids an API break for index AMs
      that aren't concerned with the issue, and it costs little except a couple
      more fields in IndexScanDescs.
      
      I changed both GiST and SP-GiST to use the HeapTuple method.  I'm not
      very clear on whether GiST can reconstruct data that's too large for an
      IndexTuple, but that seems possible, and it's not much of a code change to
      fix.
      
      Per a complaint from Vik Fearing.  Reviewed by Jason Li.
      
      Discussion: https://postgr.es/m/49527f79-530d-0bfe-3dad-d183596afa92@2ndquadrant.fr
      9b88f27c
    • Robert Haas's avatar
      hash: Refactor overflow page allocation. · 30df93f6
      Robert Haas authored
      As with commit b0f18cb7, the goal
      here is to move all of the related page modifications to a single
      section of code, in preparation for adding write-ahead logging.
      
      Amit Kapila, with slight changes by me.  The larger patch series
      of which this is a part has been reviewed and tested by Álvaro
      Herrera, Ashutosh Sharma, Mark Kirkwood, Jeff Janes, and Jesper
      Pedersen, all of whom should also have been credited in the
      previous commit message.
      30df93f6
    • Robert Haas's avatar
      hash: Refactor bucket squeeze code. · b0f18cb7
      Robert Haas authored
      In preparation for adding write-ahead logging to hash indexes,
      refactor _hash_freeovflpage and _hash_squeezebucket so that all
      related page modifications happen in a single section of code.  The
      previous coding assumed that it would be fine to move tuples one at a
      time, and also that the various operations involved in freeing an
      overflow page didn't necessarily all need to be done together, all
      of which is true if you don't care about write-ahead logging.
      
      Amit Kapila, with slight changes by me.
      b0f18cb7
    • Tom Lane's avatar
      Remove PL/Tcl's "module" facility. · 817f2a58
      Tom Lane authored
      PL/Tcl has long had a facility whereby Tcl code could be autoloaded from
      a database table named "pltcl_modules".  However, nobody is using it, as
      evidenced by the recent discovery that it's never been fixed to work with
      standard_conforming_strings turned on.  Moreover, it's rather shaky from
      a security standpoint, and the table design is very old and crufty (partly
      because it dates from before we had TOAST).  A final problem is that
      because the table-population scripts depend on the Tcl client library
      Pgtcl, which we removed from the core distribution in 2004, it's
      impossible to create a self-contained regression test for the feature.
      Rather than try to surmount these problems, let's just remove it.
      
      A follow-on patch will provide a way to execute user-defined
      initialization code, similar to features that exist in plperl and plv8.
      With that, it will be possible to implement this feature or similar ones
      entirely in userspace, which is where it belongs.
      
      Discussion: https://postgr.es/m/22067.1488046447@sss.pgh.pa.us
      817f2a58
    • Peter Eisentraut's avatar
      chomp PQerrorMessage() in backend uses · 2ed193c9
      Peter Eisentraut authored
      PQerrorMessage() returns an error message with a trailing newline, but
      in backend use (dblink, postgres_fdw, libpqwalreceiver), we want to have
      the error message without that for emitting via ereport().  To simplify
      that, add a function pchomp() that returns a pstrdup'ed string with the
      trailing newline characters removed.
      2ed193c9
    • Andres Freund's avatar
      Use the new "Slab" context for some allocations in reorderbuffer.h. · 9fab40ad
      Andres Freund authored
      Note that this change alone does not yet fully address the performance
      problems triggering this work, a large portion of the slowdown is
      triggered by the tuple allocator, which isn't converted to the new
      allocator.  It would be possible to do so, but using evenly sized
      objects, like both the current implementation in reorderbuffer.c and
      slab.c, wastes a fair amount of memory.  A later patch by Tomas will
      introduce a better approach.
      
      Author: Tomas Vondra
      Reviewed-By: Andres Freund
      Discussion: https://postgr.es/m/d15dff83-0b37-28ed-0809-95a5cc7292ad@2ndquadrant.com
      9fab40ad
    • Andres Freund's avatar
      Add "Slab" MemoryContext implementation for efficient equal-sized allocations. · 58b25e98
      Andres Freund authored
      The default general purpose aset.c style memory context is not a great
      choice for allocations that are all going to be evenly sized,
      especially when those objects aren't small, and have varying
      lifetimes.  There tends to be a lot of fragmentation, larger
      allocations always directly go to libc rather than have their cost
      amortized over several pallocs.
      
      These problems lead to the introduction of ad-hoc slab allocators in
      reorderbuffer.c. But it turns out that the simplistic implementation
      leads to problems when a lot of objects are allocated and freed, as
      aset.c is still the underlying implementation. Especially freeing can
      easily run into O(n^2) behavior in aset.c.
      
      While the O(n^2) behavior in aset.c can, and probably will, be
      addressed, custom allocators for this behavior are more efficient
      both in space and time.
      
      This allocator is for evenly sized allocations, and supports both
      cheap allocations and freeing, without fragmenting significantly.  It
      does so by allocating evenly sized blocks via malloc(), and carves
      them into chunks that can be used for allocations.  In order to
      release blocks to the OS as early as possible, chunks are allocated
      from the fullest block that still has free objects, increasing the
      likelihood of a block being entirely unused.
      
      A subsequent commit uses this in reorderbuffer.c, but a further
      allocator is needed to resolve the performance problems triggering
      this work.
      
      There likely are further potentialy uses of this allocator besides
      reorderbuffer.c.
      
      There's potential further optimizations of the new slab.c, in
      particular the array of freelists could be replaced by a more
      intelligent structure - but for now this looks more than good enough.
      
      Author: Tomas Vondra, editorialized by Andres Freund
      Reviewed-By: Andres Freund, Petr Jelinek, Robert Haas, Jim Nasby
      Discussion: https://postgr.es/m/d15dff83-0b37-28ed-0809-95a5cc7292ad@2ndquadrant.com
      58b25e98
    • Andres Freund's avatar
      Make useful infrastructure from aset.c generally available. · bfd12ccc
      Andres Freund authored
      An upcoming patch introduces a new type of memory context. To avoid
      duplicating debugging infrastructure within aset.c, move useful pieces
      to memdebug.[ch].
      
      While touching aset.c, fix printf format code in AllocFree* debug
      macros.
      
      Author: Tomas Vondra
      Reviewed-By: Andres Freund
      Discussion: https://postgr.es/m/b3b2245c-b37a-e1e5-ebc4-857c914bc747@2ndquadrant.com
      bfd12ccc
  5. 26 Feb, 2017 5 commits
  6. 25 Feb, 2017 4 commits
    • Tom Lane's avatar
      Put back #include <windows.h> in dirmod.c. · 285ca261
      Tom Lane authored
      I removed this in commit 9e3755ec, reasoning that the win32.h
      port-specific header file included by c.h would have provided it.
      However, that's only true on native win32 builds, not Cygwin builds.
      
      It may be that some of the other <windows.h> inclusions also need
      to be put back on the same grounds; but this is the only one that
      is clearly meant to be included #ifdef __CYGWIN__, so maybe this is
      the extent of the problem.  Awaiting further buildfarm results.
      285ca261
    • Tom Lane's avatar
      Remove some configure header-file checks that we weren't really using. · 2bd7f857
      Tom Lane authored
      We had some AC_CHECK_HEADER tests that were really wastes of cycles,
      because the code proceeded to #include those headers unconditionally
      anyway, in all or a large majority of cases.  The lack of complaints
      shows that those headers are available on every platform of interest,
      so we might as well let configure run a bit faster by not probing
      those headers at all.
      
      I suspect that some of the tests I left alone are equally useless, but
      since all the existing #includes of the remaining headers are properly
      guarded, I didn't touch them.
      2bd7f857
    • Tom Lane's avatar
      Remove useless duplicate inclusions of system header files. · 9e3755ec
      Tom Lane authored
      c.h #includes a number of core libc header files, such as <stdio.h>.
      There's no point in re-including these after having read postgres.h,
      postgres_fe.h, or c.h; so remove code that did so.
      
      While at it, also fix some places that were ignoring our standard pattern
      of "include postgres[_fe].h, then system header files, then other Postgres
      header files".  While there's not any great magic in doing it that way
      rather than system headers last, it's silly to have just a few files
      deviating from the general pattern.  (But I didn't attempt to enforce this
      globally, only in files I was touching anyway.)
      
      I'd be the first to say that this is mostly compulsive neatnik-ism,
      but over time it might save enough compile cycles to be useful.
      9e3755ec
    • Bruce Momjian's avatar
      pg_upgrade docs: clarify instructions on standby extensions · 5639cedd
      Bruce Momjian authored
      Previously the pg_upgrade standby upgrade instructions said not to
      execute pgcrypto.sql, but it should have referenced the extension
      command "CREATE EXTENSION pgcrypto".  This patch makes that doc change.
      
      Reported-by: a private bug report
      
      Backpatch-through: 9.4, where standby instructions were added
      5639cedd
  7. 24 Feb, 2017 4 commits