1. 15 Apr, 2017 6 commits
    • Andrew Dunstan's avatar
      Make sure to run one initdb TAP test with no TZ set · 033b969e
      Andrew Dunstan authored
      That way we make sure that initdb's time zone setting code is exercised.
      This doesn't add an extra test, it just alters an existing test.
      
      Discussion: <https://postgr.es/m/5807.1492229253@sss.pgh.pa.us>
      033b969e
    • Tom Lane's avatar
      Provide a way to control SysV shmem attach address in EXEC_BACKEND builds. · a74740fb
      Tom Lane authored
      In standard non-Windows builds, there's no particular reason to care what
      address the kernel chooses to map the shared memory segment at.  However,
      when building with EXEC_BACKEND, there's a risk that the chosen address
      won't be available in all child processes.  Linux with ASLR enabled (which
      it is by default) seems particularly at risk because it puts shmem segments
      into the same area where it maps shared libraries.  We can work around
      that by specifying a mapping address that's outside the range where
      shared libraries could get mapped.  On x86_64 Linux, 0x7e0000000000
      seems to work well.
      
      This is only meant for testing/debugging purposes, so it doesn't seem
      necessary to go as far as providing a GUC (or any user-visible
      documentation, though we might change that later).  Instead, it's just
      controlled by setting an environment variable PG_SHMEM_ADDR to the
      desired attach address.
      
      Back-patch to all supported branches, since the point here is to
      remove intermittent buildfarm failures on EXEC_BACKEND animals.
      Owners of affected animals will need to add a suitable setting of
      PG_SHMEM_ADDR to their build_env configuration.
      
      Discussion: https://postgr.es/m/7036.1492231361@sss.pgh.pa.us
      a74740fb
    • Tom Lane's avatar
      Fix erroneous cross-reference in comment. · bfba563b
      Tom Lane authored
      Seems to have been introduced in commit c219d9b0.  I think there indeed
      was a "tupbasics.h" in some early drafts of that refactoring, but it
      didn't survive into the committed version.
      
      Amit Kapila
      bfba563b
    • Tom Lane's avatar
      More cleanup of manipulations of hash indexes' hasho_flag field. · 083dc95a
      Tom Lane authored
      Not much point in defining test macros for the flag bits if we
      don't use 'em.
      
      Amit Kapila
      083dc95a
    • Andrew Dunstan's avatar
      Downcase "Wincrypt.h" · 0eba6be1
      Andrew Dunstan authored
      This is consistent with how we refer to other Windows include files, and
      prevents a failure when cross-compiling on a system with case sensitive
      file names.
      0eba6be1
    • Tom Lane's avatar
      Avoid passing function pointers across process boundaries. · 32470825
      Tom Lane authored
      We'd already recognized that we can't pass function pointers across process
      boundaries for functions in loadable modules, since a shared library could
      get loaded at different addresses in different processes.  But actually the
      practice doesn't work for functions in the core backend either, if we're
      using EXEC_BACKEND.  This is the cause of recent failures on buildfarm
      member culicidae.  Switch to passing a string function name in all cases.
      
      Something like this needs to be back-patched into 9.6, but let's see
      if the buildfarm likes it first.
      
      Petr Jelinek, with a bunch of basically-cosmetic adjustments by me
      
      Discussion: https://postgr.es/m/548f9c1d-eafa-e3fa-9da8-f0cc2f654e60@2ndquadrant.com
      32470825
  2. 14 Apr, 2017 14 commits
    • Peter Eisentraut's avatar
      doc: Fix typo · 5a617ab3
      Peter Eisentraut authored
      5a617ab3
    • Tom Lane's avatar
      Use one transaction while reading postgres.bki, not one per line. · 85a07813
      Tom Lane authored
      AFAICT, the only actual benefit of closing a bootstrap transaction
      is to reclaim transient memory.  We can do that a lot more cheaply
      by just doing a MemoryContextReset on a suitable context.  This
      gets the runtime of the "bootstrap" phase of initdb down to the
      point where, at least by eyeball, it's quite negligible compared
      to the rest of the phases.  Per discussion with Andres Freund.
      
      Discussion: https://postgr.es/m/9244.1492106743@sss.pgh.pa.us
      85a07813
    • Tom Lane's avatar
      Clean up manipulations of hash indexes' hasho_flag field. · 2040bb4a
      Tom Lane authored
      Standardize on testing a hash index page's type by doing
      	(opaque->hasho_flag & LH_PAGE_TYPE) == LH_xxx_PAGE
      Various places were taking shortcuts like
      	opaque->hasho_flag & LH_BUCKET_PAGE
      which while not actually wrong, is still bad practice because
      it encourages use of
      	opaque->hasho_flag & LH_UNUSED_PAGE
      which *is* wrong (LH_UNUSED_PAGE == 0, so the above is constant false).
      hash_xlog.c's hash_mask() contained such an incorrect test.
      
      This also ensures that we mask out the additional flag bits that
      hasho_flag has accreted since 9.6.  pgstattuple's pgstat_hash_page(),
      for one, was failing to do that and was thus actively broken.
      
      Also fix assorted comments that hadn't been updated to reflect the
      extended usage of hasho_flag, and fix some macros that were testing
      just "(hasho_flag & bit)" to use the less dangerous, project-approved
      form "((hasho_flag & bit) != 0)".
      
      Coverity found the bug in hash_mask(); I noted the one in
      pgstat_hash_page() through code reading.
      2040bb4a
    • Tom Lane's avatar
      Further fix pg_trgm's extraction of trigrams from regular expressions. · 1dffabed
      Tom Lane authored
      Commit 9e43e871 turns out to have been insufficient: not only is it
      necessary to track tentative parent links while considering a set of
      arc removals, but it's necessary to track tentative flag additions
      as well.  This is because we always merge arc target states into
      arc source states; therefore, when considering a merge of the final
      state with some other, it is the other state that will acquire a new
      TSTATE_FIN bit.  If there's another arc for the same color trigram
      that would cause merging of that state with the initial state, we
      failed to recognize the problem.  The test cases for the prior commit
      evidently only exercised situations where a tentative merge with the
      initial state occurs before one with the final state.  If it goes the
      other way around, we'll happily merge the initial and final states,
      either producing a broken final graph that would never match anything,
      or triggering the Assert added by the prior commit.
      
      It's tempting to consider switching the merge direction when the merge
      involves the final state, but I lack the time to analyze that idea in
      detail.  Instead just keep track of the flag changes that would result
      from proposed merges, in the same way that the prior commit tracked
      proposed parent links.
      
      Along the way, add some more debugging support, because I'm not entirely
      confident that this is the last bug here.  And tweak matters so that
      the transformed.dot file uses small integers rather than pointer values
      to identify states; that makes it more readable if you're just eyeballing
      it rather than fooling with Graphviz.  And rename a couple of identically
      named struct fields to reduce confusion.
      
      Per report from Corey Csuhta.  Add a test case based on his example.
      (Note: this case does not trigger the bug under 9.3, apparently because
      its different measurement of costs causes it to stop merging states before
      it hits the failure.  I spent some time trying to find a variant that would
      fail in 9.3, without success; but I'm sure such cases exist.)
      
      Like the previous patch, back-patch to 9.3 where this code was added.
      
      Report: https://postgr.es/m/E2B01A4B-4530-406B-8D17-2F67CF9A16BA@csuhta.com
      1dffabed
    • Peter Eisentraut's avatar
      Report statistics in logical replication workers · 139eb967
      Peter Eisentraut authored
      Author: Stas Kelvich <s.kelvich@postgrespro.ru>
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      Reported-by: default avatarFujii Masao <masao.fujii@gmail.com>
      139eb967
    • Peter Eisentraut's avatar
      Catversion bump · 67c2def1
      Peter Eisentraut authored
      for commit 887227a1
      67c2def1
    • Peter Eisentraut's avatar
      Fix typo in comment · 6e5f9a6d
      Peter Eisentraut authored
      6e5f9a6d
    • Peter Eisentraut's avatar
      Add option to modify sync commit per subscription · 887227a1
      Peter Eisentraut authored
      This also changes default behaviour of subscription workers to
      synchronous_commit = off.
      
      Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
      887227a1
    • Peter Eisentraut's avatar
      Remove pstrdup of TextDatumGetCString · 25371a72
      Peter Eisentraut authored
      The result of TextDatumGetCString is already palloc'ed.
      25371a72
    • Peter Eisentraut's avatar
      Remove useless trailing spaces in queries in C strings · 0c22327f
      Peter Eisentraut authored
      Author: Alexander Law <exclusion@gmail.com>
      0c22327f
    • Peter Eisentraut's avatar
      Remove trailing spaces in some output · 674677c7
      Peter Eisentraut authored
      Author: Alexander Law <exclusion@gmail.com>
      674677c7
    • Peter Eisentraut's avatar
    • Peter Eisentraut's avatar
      Make header self-contained · d04eac11
      Peter Eisentraut authored
      Add necessary include files for things used in the header.  (signal.h
      needed for sig_atomic_t.)
      d04eac11
    • Peter Eisentraut's avatar
      pg_dumpall: Allow --no-role-passwords and --binary-upgrade together · ff46f2a0
      Peter Eisentraut authored
      This was introduced as part of the patch to add --no-role-passwords, but
      while it's an unusual combination, there is no actual reason to prevent
      it.
      ff46f2a0
  3. 13 Apr, 2017 17 commits
  4. 12 Apr, 2017 3 commits
    • Tom Lane's avatar
      Speed up hash_index regression test. · 4a8bc39b
      Tom Lane authored
      Commit f5ab0a14 made this test take substantially longer than it used
      to.  With a bit more care, we can get the runtime back down while
      achieving the same, or even a bit better, code coverage.
      
      Mithun Cy
      
      Discussion: https://postgr.es/m/CAD__Ouh-qaEb+rD7Uy-4g3xQYOrhPzHs-a_TrFAjiQ5azAW5+w@mail.gmail.com
      4a8bc39b
    • Tom Lane's avatar
      Avoid transferring parallel-unsafe subplans to parallel workers. · 16ebab68
      Tom Lane authored
      Commit 5e6d8d2b allowed parallel workers to execute parallel-safe
      subplans, but it transmitted the query's entire list of subplans to
      the worker(s).  Since execMain.c blindly does ExecInitNode and later
      ExecEndNode on every list element, this resulted in parallel-unsafe plan
      nodes nonetheless getting started up and shut down in parallel workers.
      That seems mostly harmless as far as core plan node types go (but
      maybe not so much for Gather?).  But it resulted in postgres_fdw
      opening and then closing extra remote connections, and it's likely
      that other non-parallel-safe FDWs or custom scan providers would have
      worse reactions.
      
      To fix, just make ExecSerializePlan replace parallel-unsafe subplans
      with NULLs in the cut-down plan tree that it transmits to workers.
      This relies on ExecInitNode and ExecEndNode to do nothing on NULL
      input, but they do anyway.  If anything else is touching the dropped
      subplans in a parallel worker, that would be a bug to be fixed.
      (This thus provides a strong guarantee that we won't try to do
      something with a parallel-unsafe subplan in a worker.)
      
      This is, I think, the last fix directly occasioned by Andreas Seltenreich's
      bug report of a few days ago.
      
      Tom Lane and Amit Kapila
      
      Discussion: https://postgr.es/m/87tw5x4vcu.fsf@credativ.de
      16ebab68
    • Peter Eisentraut's avatar
      doc: Tweak CSS · f6f9f8a2
      Peter Eisentraut authored
      Tweak CSS a bit to match latest similar changes to web site style.  Also
      move some CSS out of the HTML to the stylesheet so that the web site
      stylesheet can override it.  This should ensure that notes and such are
      back to being centered.
      f6f9f8a2