1. 04 May, 2020 1 commit
  2. 03 May, 2020 2 commits
  3. 02 May, 2020 5 commits
  4. 01 May, 2020 10 commits
    • Tomas Vondra's avatar
      Simplify cost_incremental_sort a bit · 60fbb4d7
      Tomas Vondra authored
      Commit de0dc1a8 added code to cost_incremental_sort to handle varno 0.
      Explicitly removing the RelabelType is not really necessary, because the
      pull_varnos handles that just fine, which simplifies the code a bit.
      
      Author: Richard Guo
      Discussion: https://postgr.es/m/CAMbWs4_3_D2J5XxOuw68hvn0-gJsw9FXNSGcZka9aTymn9UJ8A%40mail.gmail.com
      Discussion: https://postgr.es/m/20200411214639.GK2228%40telsasoft.com
      60fbb4d7
    • Tomas Vondra's avatar
      Remove pg_xact entry from SLRU stats · 2e08d314
      Tomas Vondra authored
      The "pg_xact" entry was duplicate with "clog" and was added by mistake.
      
      Reported-by: Fujii Masao
      Discussion: https://postgr.es/m/20200119143707.gyinppnigokesjok@development
      2e08d314
    • Tom Lane's avatar
      Get rid of trailing semicolons in C macro definitions. · 0da06d9f
      Tom Lane authored
      Writing a trailing semicolon in a macro is almost never the right thing,
      because you almost always want to write a semicolon after each macro
      call instead.  (Even if there was some reason to prefer not to, pgindent
      would probably make a hash of code formatted that way; so within PG the
      rule should basically be "don't do it".)  Thus, if we have a semi inside
      the macro, the compiler sees "something;;".  Much of the time the extra
      empty statement is harmless, but it could lead to mysterious syntax
      errors at call sites.  In perhaps an overabundance of neatnik-ism, let's
      run around and get rid of the excess semicolons whereever possible.
      
      The only thing worse than a mysterious syntax error is a mysterious
      syntax error that only happens in the back branches; therefore,
      backpatch these changes where relevant, which is most of them because
      most of these mistakes are old.  (The lack of reported problems shows
      that this is largely a hypothetical issue, but still, it could bite
      us in some future patch.)
      
      John Naylor and Tom Lane
      
      Discussion: https://postgr.es/m/CACPNZCs0qWTqJ2QUSGJ07B7uvAvzMb-KbG2q+oo+J3tsWN5cqw@mail.gmail.com
      0da06d9f
    • Tom Lane's avatar
      Doc: update sections 9.17 - 9.21 for new function table layout. · d6693544
      Tom Lane authored
      With the usual quota of minor editorial changes.
      d6693544
    • Peter Geoghegan's avatar
      Clear up issue with FSM and oldest bpto.xact. · 69cf853f
      Peter Geoghegan authored
      On further reflection, code comments added by commit b0229f26 slightly
      misrepresented how we determine the oldest bpto.xact for the index.
      btvacuumpage() does not treat the bpto.xact of a page that it put in the
      FSM as a candidate to be the oldest deleted page (the delete-marked page
      that has the oldest bpto.xact XID among all pages encountered).
      
      The definition of a deleted page for the purposes of the bpto.xact
      calculation is different from the definition used by the bulk delete
      statistics.  The bulk delete statistics don't distinguish between pages
      that were deleted by the current VACUUM, pages deleted by a previous
      VACUUM operation but not yet recyclable/reusable, and pages that are
      reusable (though reusable pages are counted separately).
      
      Backpatch: 11-, just like commit b0229f26.
      69cf853f
    • Peter Geoghegan's avatar
      4e21f8b6
    • Peter Geoghegan's avatar
      Fix undercounting in VACUUM VERBOSE output. · 73a076b0
      Peter Geoghegan authored
      The logic for determining how many nbtree pages in an index are deleted
      pages sometimes undercounted pages.  Pages that were deleted by the
      current VACUUM operation (as opposed to some previous VACUUM operation
      whose deleted pages have yet to be reused) were sometimes overlooked.
      The final count is exposed to users through VACUUM VERBOSE's "%u index
      pages have been deleted" output.
      
      btvacuumpage() avoided double-counting when _bt_pagedel() deleted more
      than one page by assuming that only one page was deleted, and that the
      additional deleted pages would get picked up during a future call to
      btvacuumpage() by the same VACUUM operation.  _bt_pagedel() can
      legitimately delete pages that the btvacuumscan() scan will not visit
      again, though, so that assumption was slightly faulty.
      
      Fix the accounting by teaching _bt_pagedel() about its caller's
      requirements.  It now only reports on pages that it knows btvacuumscan()
      won't visit again (including the current btvacuumpage() page), so
      everything works out in the end.
      
      This bug has been around forever.  Only backpatch to v11, though, to
      keep _bt_pagedel() is sync on the branches that have today's bugfix
      commit b0229f26.  Note that this commit changes the signature of
      _bt_pagedel(), just like commit b0229f26.
      
      Author: Peter Geoghegan
      Reviewed-By: Masahiko Sawada
      Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com
      Backpatch: 11-
      73a076b0
    • Peter Geoghegan's avatar
      Fix bug in nbtree VACUUM "skip full scan" feature. · b0229f26
      Peter Geoghegan authored
      Commit 857f9c36 (which taught nbtree VACUUM to skip a scan of the
      index from btcleanup in situations where it doesn't seem worth it) made
      VACUUM maintain the oldest btpo.xact among all deleted pages for the
      index as a whole.  It failed to handle all the details surrounding pages
      that are deleted by the current VACUUM operation correctly (though pages
      deleted by some previous VACUUM operation were processed correctly).
      
      The most immediate problem was that the special area of the page was
      examined without a buffer pin at one point.  More fundamentally, the
      handling failed to account for the full range of _bt_pagedel()
      behaviors.  For example, _bt_pagedel() sometimes deletes internal pages
      in passing, as part of deleting an entire subtree with btvacuumpage()
      caller's page as the leaf level page.  The original leaf page passed to
      _bt_pagedel() might not be the page that it deletes first in cases where
      deletion can take place.
      
      It's unclear how disruptive this bug may have been, or what symptoms
      users might want to look out for.  The issue was spotted during
      unrelated code review.
      
      To fix, push down the logic for maintaining the oldest btpo.xact to
      _bt_pagedel().  btvacuumpage() is now responsible for pages that were
      fully deleted by a previous VACUUM operation, while _bt_pagedel() is now
      responsible for pages that were deleted by the current VACUUM operation
      (this includes half-dead pages from a previous interrupted VACUUM
      operation that become fully deleted in _bt_pagedel()).  Note that
      _bt_pagedel() should never encounter an existing deleted page.
      
      This commit theoretically breaks the ABI of a stable release by changing
      the signature of _bt_pagedel().  However, if any third party extension
      is actually affected by this, then it must already be completely broken
      (since there are numerous assumptions made in _bt_pagedel() that cannot
      be met outside of VACUUM).  It seems highly unlikely that such an
      extension actually exists, in any case.
      
      Author: Peter Geoghegan
      Reviewed-By: Masahiko Sawada
      Discussion: https://postgr.es/m/CAH2-WzkrXBcMQWAYUJMFTTvzx_r4q=pYSjDe07JnUXhe+OZnJA@mail.gmail.com
      Backpatch: 11-, where the "skip full scan" feature was introduced.
      b0229f26
    • Peter Eisentraut's avatar
    • Michael Paquier's avatar
      Improve various aspects of pg_rewind documentation · 78bad97f
      Michael Paquier authored
      The pg_rewind docs currently assert that the state of the target's
      data directory after rewind is equivalent to the source's data
      directory.  This clarifies the documentation to describe that the base
      state is further back in time and that the target's data directory will
      include the current state from the source of any copied blocks since the
      point of divergence.
      
      This commit also improves the section "How It Works":
      - Describe the update of the pg_control file.
      - Reorganize the list of files and directories ignored during the
      rewind.
      
      Author: James Coleman
      Discussion: https://postgr.es/m/CAAaqYe-sgqCos7MXF4XiY8rUPy3CEmaCY9EvfhX-DhPhPBF5_A@mail.gmail.com
      78bad97f
  5. 30 Apr, 2020 8 commits
  6. 29 Apr, 2020 4 commits
  7. 28 Apr, 2020 3 commits
  8. 27 Apr, 2020 6 commits
    • Michael Paquier's avatar
      Add more TAP coverage for archive status with crash recovery of standbys · ebf6de86
      Michael Paquier authored
      This part of the test was included originally in 4e87c483, but got
      reverted as of f9c1b8db because of timing issues in the test, where,
      after more analysis, we found that the standbys may not have recovered
      from the archives all the segments needed by the test.  This stabilizes
      the test by making sure that standbys replay up to the position returned
      by pg_switch_wal(), meaning that all segments are recovered before the
      manual checkpoint that tests WAL segment recycling and its interactions
      with archive status files.
      
      Author: Jehan-Guillaume de Rorthais
      Reviewed-by: Kyotaro Horiguchi, Michael Paquier
      Discussion: https://postgr.es/m/20200424034248.GL33034@paquier.xyz
      ebf6de86
    • Robert Haas's avatar
      Fix bogus tar-file padding logic for standby.signal. · 0278d3f7
      Robert Haas authored
      When pg_basebackup -R is used, we inject standby.signal into the
      tar file for the main tablespace. The proper thing to do is to pad
      each file injected into the tar file out to a 512-byte boundary
      by appending nulls, but here the file is of length 0 and we add
      511 zero bytes.  Since 0 is already a multiple of 512, we should
      not add any zero bytes. Do that instead.
      
      Patch by me, reviewed by Tom Lane.
      
      Discussion: http://postgr.es/m/CA+TgmobWbfReO9-XFk8urR1K4wTNwqoHx_v56t7=T8KaiEoKNw@mail.gmail.com
      0278d3f7
    • Tom Lane's avatar
      Fix full text search to handle NOT above a phrase search correctly. · e81e5741
      Tom Lane authored
      Queries such as '!(foo<->bar)' failed to find matching rows when
      implemented as a GiST or GIN index search.  That's because of
      failing to handle phrase searches as tri-valued when considering
      a query without any position information for the target tsvector.
      We can only say that the phrase operator might match, not that it
      does match; and therefore its NOT also might match.  The previous
      coding incorrectly inverted the approximate phrase result to
      decide that there was certainly no match.
      
      To fix, we need to make TS_phrase_execute return a real ternary result,
      and then bubble that up accurately in TS_execute.  As long as we have
      to do that anyway, we can simplify the baroque things TS_phrase_execute
      was doing internally to manage tri-valued searching with only a bool
      as explicit result.
      
      For now, I left the externally-visible result of TS_execute as a plain
      bool.  There do not appear to be any outside callers that need to
      distinguish a three-way result, given that they passed in a flag
      saying what to do in the absence of position data.  This might need
      to change someday, but we wouldn't want to back-patch such a change.
      
      Although tsginidx.c has its own TS_execute_ternary implementation for
      use at upper index levels, that sadly managed to get this case wrong
      as well :-(.  Fixing it is a lot easier fortunately.
      
      Per bug #16388 from Charles Offenbacher.  Back-patch to 9.6 where
      phrase search was introduced.
      
      Discussion: https://postgr.es/m/16388-98cffba38d0b7e6e@postgresql.org
      e81e5741
    • Tom Lane's avatar
      Doc: render &pi; more nicely in PDF output. · 5ac24755
      Tom Lane authored
      We need to select symbol font explicitly, or it comes out misaligned.
      
      Alexander Lakhin, Tom Lane
      
      Discussion: https://postgr.es/m/10598.1587928415@sss.pgh.pa.us
      5ac24755
    • Peter Eisentraut's avatar
      d51f704f
    • Michael Paquier's avatar
      Fix some typos · 641b76d9
      Michael Paquier authored
      Author: Justin Pryzby
      Discussion: https://postgr.es/m/20200408165653.GF2228@telsasoft.com
      641b76d9
  9. 26 Apr, 2020 1 commit