The Wayback Machine - https://web.archive.org/web/20210930035237/https://github.com/postgres/postgres/commits/master
Skip to content
Permalink
master

Commits on Sep 29, 2021

  1. psql: Add various tests

    Add tests for psql features
    
    - AUTOCOMMIT
    - ON_ERROR_ROLLBACK
    - ECHO errors
    
    Reviewed-by: Fabien COELHO <coelho@cri.ensmp.fr>
    Discussion: https://www.postgresql.org/message-id/6954328d-96f2-77f7-735f-7ce493a40949%40enterprisedb.com
    petere committed Sep 29, 2021
  2. Fix WAL replay in presence of an incomplete record

    Physical replication always ships WAL segment files to replicas once
    they are complete.  This is a problem if one WAL record is split across
    a segment boundary and the primary server crashes before writing down
    the segment with the next portion of the WAL record: WAL writing after
    crash recovery would happily resume at the point where the broken record
    started, overwriting that record ... but any standby or backup may have
    already received a copy of that segment, and they are not rewinding.
    This causes standbys to stop following the primary after the latter
    crashes:
      LOG:  invalid contrecord length 7262 at A8/D9FFFBC8
    because the standby is still trying to read the continuation record
    (contrecord) for the original long WAL record, but it is not there and
    it will never be.  A workaround is to stop the replica, delete the WAL
    file, and restart it -- at which point a fresh copy is brought over from
    the primary.  But that's pretty labor intensive, and I bet many users
    would just give up and re-clone the standby instead.
    
    A fix for this problem was already attempted in commit 515e3d8, but
    it only addressed the case for the scenario of WAL archiving, so
    streaming replication would still be a problem (as well as other things
    such as taking a filesystem-level backup while the server is down after
    having crashed), and it had performance scalability problems too; so it
    had to be reverted.
    
    This commit fixes the problem using an approach suggested by Andres
    Freund, whereby the initial portion(s) of the split-up WAL record are
    kept, and a special type of WAL record is written where the contrecord
    was lost, so that WAL replay in the replica knows to skip the broken
    parts.  With this approach, we can continue to stream/archive segment
    files as soon as they are complete, and replay of the broken records
    will proceed across the crash point without a hitch.
    
    Because a new type of WAL record is added, users should be careful to
    upgrade standbys first, primaries later. Otherwise they risk the standby
    being unable to start if the primary happens to write such a record.
    
    A new TAP test that exercises this is added, but the portability of it
    is yet to be seen.
    
    This has been wrong since the introduction of physical replication, so
    backpatch all the way back.  In stable branches, keep the new
    XLogReaderState members at the end of the struct, to avoid an ABI
    break.
    
    Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
    Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
    Reviewed-by: Nathan Bossart <bossartn@amazon.com>
    Discussion: https://postgr.es/m/202108232252.dh7uxf6oxwcy@alvherre.pgsql
    alvherre committed Sep 29, 2021
  3. pgbench: Fix handling of socket errors during benchmark.

    Previously socket errors such as invalid socket or socket wait method failures
    during benchmark caused pgbench to exit with status 0. Instead, errors during
    the run should result in exit status 2.
    
    Back-patch to v12 where pgbench started reporting exit status.
    
    Original complaint and patch by Hayato Kuroda.
    
    Author: Yugo Nagata, Fabien COELHO
    Reviewed-by: Kyotaro Horiguchi, Fujii Masao
    Discussion: https://postgr.es/m/TYCPR01MB5870057375ACA8A73099C649F5349@TYCPR01MB5870.jpnprd01.prod.outlook.com
    MasaoFujii committed Sep 29, 2021
  4. pgbench: Correct log level of message output when socket wait method …

    …fails.
    
    The failure of socket wait method like "select()" doesn't terminate pgbench.
    So the log level of error message when that failure happens should be ERROR.
    But previously FATAL was used in that case.
    
    Back-patch to v13 where pgbench started using common logging API.
    
    Author: Yugo Nagata, Fabien COELHO
    Reviewed-by: Kyotaro Horiguchi, Fujii Masao
    Discussion: https://postgr.es/m/20210617005934.8bd37bf72efd5f1b38e6f482@sraoss.co.jp
    MasaoFujii committed Sep 29, 2021
  5. Clarify use of "statistics objects" in the code

    The code inconsistently used "statistic object" or "statistics" where
    the correct term, as discussed, is actually "statistics object".  This
    improves the state of the code to be more consistent.
    
    While on it, fix an incorrect error message introduced in a4d75c8.  This
    error should never happen, as the code states, but it would be
    misleading.
    
    Author: Justin Pryzby
    Reviewed-by: Álvaro Herrera, Michael Paquier
    Discussion: https://postgr.es/m/20210924215827.GS831@telsasoft.com
    Backpatch-through: 14
    michaelpq committed Sep 29, 2021
  6. doc: Fix some typos and markups

    Author: Ekaterina Kiryanova
    Discussion: https://postgr.es/m/8a14e78f-6991-7a6e-4711-fe376635f2ad@postgrespro.ru
    Backpatch-through: 14
    michaelpq committed Sep 29, 2021
  7. Refactor output file handling when forking syslogger under EXEC_BACKEND

    A forked logging collector in EXEC_BACKEND builds passes down file
    descriptors (or HANDLEs in WIN32) through a command for files to be
    reopened (for stderr and csvlog).  Some of its logic was duplicated, and
    this commit refactors the code with some wrapper routines for file
    reopening after forking and fd grabbing when building the command for
    the fork.
    
    While on it, this simplifies a use of "long" in the code, introduced by
    ab0ba6e to take care of a warning related to MinGW-W64 when mapping a
    intptr_t to a printed value.  "long" is 32-bit long on Windows, and
    interoperability of Win32 and Win64 ensures that handles are always
    32-bit significant, so we can just use "int" for the same result.  This
    also makes the new routines more symmetric.
    
    This change makes easier the introduction of new log destinations in the
    logging collector, and this is not the only piece of refactoring
    planned.  I have tested this change with EXEC_BACKEND on linux, macos,
    and of course MSVC (both Win32 and Win64), but not MinGW so the
    buildfarm may have something to say here.
    
    Author: Sehrope Sarkuni, Michael Paquier
    Discussion: https://postgr.es/m/CAH7T-aqswBM6JWe4pDehi1uOiufqe06DJWaU5=X7dDLyqUExHg@mail.gmail.com
    michaelpq committed Sep 29, 2021

Commits on Sep 28, 2021

  1. Fix instability in contrib/bloom TAP tests.

    It turns out that the instability complained of in commit d3c09b9
    has an embarrassingly simple explanation.  The test script waits for
    the standby to flush incoming WAL to disk, but it should wait for
    the WAL to be replayed, since we are testing for the effects of that
    to be visible.
    
    While at it, use wait_for_catchup instead of reinventing that logic,
    and adjust $Test::Builder::Level to improve future error reports.
    
    Back-patch to v12 where the necessary infrastructure came in
    (cf. aforesaid commit).  Also back-patch 7d1aa6b so that the
    test will actually get run.
    
    Discussion: https://postgr.es/m/2854602.1632852664@sss.pgh.pa.us
    tglsfdc committed Sep 28, 2021
  2. Support amcheck of sequences

    Sequences were left out of the list of relation kinds that
    verify_heapam knew how to check, though it is fairly trivial to allow
    them.  Doing that, and while at it, updating pg_amcheck to include
    sequences in relations matched by table and relation patterns.
    
    Author: Mark Dilger <mark.dilger@enterprisedb.com>
    Discussion: https://www.postgresql.org/message-id/flat/81ad4757-92c1-4aa3-7bee-f609544837e3%40enterprisedb.com
    petere committed Sep 28, 2021

Commits on Sep 27, 2021

  1. Re-enable contrib/bloom's TAP tests.

    These tests were disabled back in 2018 (commit d3c09b9) because of
    failures observed in the buildfarm.  I've not been able to reproduce
    any failure on longfin's host, though, so I'm curious whether or to
    what extent we've fixed the problem.  Let's re-enable it (in HEAD
    only) and see what blows up.
    
    Discussion: https://postgr.es/m/2769443.1632773967@sss.pgh.pa.us
    tglsfdc committed Sep 27, 2021
  2. Fix typos and grammar in code comments

    Several mistakes have piled in the code comments over the time,
    including incorrect grammar, function names and simple typos.  This
    commit takes care of a portion of these.
    
    No backpatch is done as this is only cosmetic.
    
    Author: Justin Pryzby
    Discussion: https://postgr.es/m/20210924215827.GS831@telsasoft.com
    michaelpq committed Sep 27, 2021
  3. Remove unneeded nbtree latestRemovedXid comments.

    Discussing the low level issue of nbtree VACUUM and recovery conflicts
    in btvacuumpage() now seems inappropriate.  The same issue is discussed
    in nbtxlog.h, as well as in a comment block above _bt_delitems_vacuum().
    
    The comment block made more sense when it was part of a broader
    discussion of nbtree VACUUM "pin scans".  These were removed by commit
    9f83468.
    petergeoghegan committed Sep 27, 2021

Commits on Sep 26, 2021

  1. Track LLVM 14 API changes.

    Only done on the master branch for now to fix build farm animal seawasp
    (which tests bleeeding edge PostgreSQL with bleeding edge LLVM).  We can
    back-patch a consolidated fix closer to LLVM 14's release, once its API
    has stopped moving around.
    
    Discussion: https://postgr.es/m/CA%2BhUKGL%3Dyg6qqgg6W6SAuvRQejditeoDNy-X3b9H_6Fnw8j5Wg%40mail.gmail.com
    macdice committed Sep 26, 2021
  2. Avoid unnecessary division in interval_cmp_value().

    Splitting the time field into days and microseconds is pretty
    useless when we're just going to recombine those values.
    It's unclear if anyone will notice the speedup in real-world
    cases, but a cycle shaved is a cycle earned.
    
    Discussion: https://postgr.es/m/2629129.1632675713@sss.pgh.pa.us
    tglsfdc committed Sep 26, 2021
  3. Fix typos in docs

    Author: Justin Pryzby
    Discussion: https://postgr.es/m/20210924215827.GS831@telsasoft.com
    Backpatch-through: 9.6
    michaelpq committed Sep 26, 2021

Commits on Sep 25, 2021

  1. Update obsolete nbtree deletion comments.

    _bt_delitems_delete() is no longer the high-level entry point used by
    index tuple deletion driven by index tuples whose LP_DEAD bits are set
    (now called "simple index tuple deletion").  It became a lower level
    routine that's only called by _bt_delitems_delete_check() following
    commit d168b66.
    petergeoghegan committed Sep 25, 2021
  2. vacuumlazy.c: Remove obsolete 'onecall' comment.

    Remove obsolete reference to lazy_vacuum()'s onecall argument.  The
    function argument was removed by commit 3499df0.
    
    Also remove adjoining comment block that introduces the wraparound
    failsafe concept.  Talking about the failsafe here no longer makes
    sense, since lazy_vacuum() (and related functions) are no longer the
    only place where the failsafe might be triggered.  This has been the
    case since commit c242baa taught VACUUM to consider triggering the
    failsafe mechanism during its initial heap scan.
    petergeoghegan committed Sep 25, 2021
  3. Doc: extend warnings about collation-mismatch hazards in postgres_fdw.

    Be a little more vocal about the risks of remote collations not
    matching local ones.  Actually fixing these risks seems hard,
    and I've given up on the idea that it might be back-patchable.
    So the best we can do for the back branches is add documentation.
    
    Per discussion of bug #16583 from Jiří Fejfar.
    
    Discussion: https://postgr.es/m/2438715.1632510693@sss.pgh.pa.us
    tglsfdc committed Sep 25, 2021
  4. doc: Improve description of index vacuuming with GUCs

    Index vacuums may happen multiple times depending on the number of dead
    tuples stored, as of maintenance_work_mem for a manual VACUUM.  For
    autovacuum, this is controlled by autovacuum_work_mem instead, if set.
    The documentation mentioned the former, but not the latter in the
    context of autovacuum.
    
    Reported-by: Nikolai Berkoff
    Author: Laurenz Albe, Euler Taveira
    Discussion: https://postgr.es/m/161545365522.10134.12195402324485546870@wrigleys.postgresql.org
    Backpatch-through: 9.6
    michaelpq committed Sep 25, 2021
  5. doc: Add missing markup in CREATE EVENT TRIGGER page

    Reported-by: rir
    Discussion: https://postgr.es/m/20210924183658.3syyitp3yuxjv2fp@localhost
    Backpatch-through: 9.6
    michaelpq committed Sep 25, 2021

Commits on Sep 24, 2021

  1. nbtree README: Add note about latestRemovedXid.

    Point out that index tuple deletion generally needs a latestRemovedXid
    value for the deletion operation's WAL record.  This is bound to be the
    most expensive part of the whole deletion operation now that it takes
    place up front, during original execution.
    
    This was arguably an oversight in commit 558a916, which moved the
    work required to generate these values from index deletion REDO routines
    to original execution of index deletion operations.
    petergeoghegan committed Sep 24, 2021

Commits on Sep 23, 2021

  1. Add missing $Test::Builder::Level settings

    One of these was accidentally removed by c50624c.  The others are
    added by analogy.
    
    Discussion: https://www.postgresql.org/message-id/ae1143fb-455c-c80f-ed66-78d45bd93303@enterprisedb.com
    petere committed Sep 23, 2021
  2. Add exception for unicode_east_asian_fw_table.h to headerscheck also

    Followup to a315b19
    John Naylor
    John Naylor committed Sep 23, 2021
  3. Add exception for unicode_east_asian_fw_table.h to cpluspluscheck

    unicode_east_asian_fw_table.h should not be compiled standalone, similarly
    to unicode_combining_table.h, but cpluspluscheck did not get the memo.
    
    Oversight in bab9821.
    
    Per report from Tom Lane
    John Naylor
    John Naylor committed Sep 23, 2021
  4. Split macros from visibilitymap.h into a separate header

    That allows to include just visibilitymapdefs.h from file.c, and in turn,
    remove include of postgres.h from relcache.h.
    
    Reported-by: Andres Freund
    Discussion: https://postgr.es/m/20210913232614.czafiubr435l6egi%40alap3.anarazel.de
    Author: Alexander Korotkov
    Reviewed-by: Andres Freund, Tom Lane, Alvaro Herrera
    Backpatch-through: 13
    akorotkov committed Sep 23, 2021
  5. Release memory allocated by dependency_degree

    Calculating degree of a functional dependency may allocate a lot of
    memory - we have released mot of the explicitly allocated memory, but
    e.g. detoasted varlena values were left behind. That may be an issue,
    because we consider a lot of dependencies (all combinations), and the
    detoasting may happen for each one again.
    
    Fixed by calling dependency_degree() in a dedicated context, and
    resetting it after each call. We only need the calculated dependency
    degree, so we don't need to copy anything.
    
    Backpatch to PostgreSQL 10, where extended statistics were introduced.
    
    Backpatch-through: 10
    Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com
    tvondra committed Sep 23, 2021
  6. Free memory after building each statistics object

    Until now, all extended statistics on a given relation were built in the
    same memory context, without resetting. Some of the memory was released
    explicitly, but not all of it - for example memory allocated while
    detoasting values is hard to free. This is how it worked since extended
    statistics were introduced in PostgreSQL 10, but adding support for
    extended stats on expressions made the issue somewhat worse as it
    increases the number of statistics to build.
    
    Fixed by adding a memory context which gets reset after building each
    statistics object (all the statistics kinds included in it). Resetting
    it after building each statistics kind would be even better, but it
    would require more invasive changes and copying of results, making it
    harder to backpatch.
    
    Backpatch to PostgreSQL 10, where extended statistics were introduced.
    
    Author: Justin Pryzby
    Reported-by: Justin Pryzby
    Reviewed-by: Tomas Vondra
    Backpatch-through: 10
    Discussion: https://www.postgresql.org/message-id/20210915200928.GP831%40telsasoft.com
    tvondra committed Sep 23, 2021
  7. Document issue with heapam line pointer truncation.

    Checking that an offset number isn't past the end of a heap page's line
    pointer array was just a defensive sanity check for HOT-chain traversal
    code before commit 3c3b8a4.  It's etrictly necessary now, though.  Add
    comments that reference the issue to code in heapam that needs to get it
    right.
    
    Per suggestion from Alexander Lakhin.
    
    Discussion: https://postgr.es/m/f76a292c-9170-1aef-91a0-59d9443b99a3@gmail.com
    petergeoghegan committed Sep 23, 2021

Commits on Sep 22, 2021

  1. postgres_fdw: Refactor transaction rollback code to avoid code duplic…

    …ation.
    
    In postgres_fdw, pgfdw_xact_callback() and pgfdw_subxact_callback()
    callback functions do almost the same thing to rollback remote toplevel-
    and sub-transaction. But previously their such rollback logics were
    implemented separately in each function and in different way. Which
    could decrease the readability and maintainability of the code.
    
    To fix the issue, this commit creates the common function to rollback
    remote transactions, and makes those callback functions use it. Which
    allows us to avoid unnecessary code duplication.
    
    Author: Fujii Masao
    Reviewed-by: Zhihong Yu, Bharath Rupireddy
    Discussion: https://postgr.es/m/62fbb63a-d46c-fb47-a56d-f6be1909aa44@oss.nttdata.com
    MasaoFujii committed Sep 22, 2021
  2. Make use of PG_INT64_MAX/PG_INT64_MIN

    This code was written before those symbols were introduced, but now we
    can simplify it.
    petere committed Sep 22, 2021
  3. Invalidate all partitions for a partitioned table in publication.

    Updates/Deletes on a partition were allowed even without replica identity
    after the parent table was added to a publication. This would later lead
    to an error on subscribers. The reason was that we were not invalidating
    the partition's relcache and the publication information for partitions
    was not getting rebuilt. Similarly, we were not invalidating the
    partitions' relcache after dropping a partitioned table from a publication
    which will prohibit Updates/Deletes on its partition without replica
    identity even without any publication.
    
    Reported-by: Haiying Tang
    Author: Hou Zhijie and Vignesh C
    Reviewed-by: Vignesh C and Amit Kapila
    Backpatch-through: 13
    Discussion: https://postgr.es/m/OS0PR01MB6113D77F583C922F1CEAA1C3FBD29@OS0PR01MB6113.jpnprd01.prod.outlook.com
    Amit Kapila
    Amit Kapila committed Sep 22, 2021
  4. Add parent table name in an error in reorderbuffer.c.

    This can help in troubleshooting the cause of a particular error that can
    occur during decoding.
    
    Author: Jeremy Schneider
    Reviewed-by: Amit Kapila
    Discussion: https://postgr.es/m/808ed65b-994c-915a-361c-577f088b837f@amazon.com
    Amit Kapila
    Amit Kapila committed Sep 22, 2021
  5. Fix "single value strategy" index deletion issue.

    It is not appropriate for deduplication to apply single value strategy
    when triggered by a bottom-up index deletion pass.  This wastes cycles
    because later bottom-up deletion passes will overinterpret older
    duplicate tuples that deduplication actually just skipped over "by
    design".  It also makes bottom-up deletion much less effective for low
    cardinality indexes that happen to cross a meaningless "index has single
    key value per leaf page" threshold.
    
    To fix, slightly narrow the conditions under which deduplication's
    single value strategy is considered.  We already avoided the strategy
    for a unique index, since our high level goal must just be to buy time
    for VACUUM to run (not to buy space).  We'll now also avoid it when we
    just had a bottom-up pass that reported failure.  The two cases share
    the same high level goal, and already overlapped significantly, so this
    approach is quite natural.
    
    Oversight in commit d168b66, which added bottom-up index deletion.
    
    Author: Peter Geoghegan <pg@bowt.ie>
    Discussion: https://postgr.es/m/CAH2-WznaOvM+Gyj-JQ0X=JxoMDxctDTYjiEuETdAGbF5EUc3MA@mail.gmail.com
    Backpatch: 14-, where bottom-up deletion was introduced.
    petergeoghegan committed Sep 22, 2021
Older
Morty Proxy This is a proxified and sanitized view of the page, visit original site.