1. 01 Apr, 2020 8 commits
  2. 31 Mar, 2020 24 commits
  3. 30 Mar, 2020 8 commits
    • Michael Paquier's avatar
      Revert "Skip redundant anti-wraparound vacuums" · dd9ac7d5
      Michael Paquier authored
      This reverts commit 2aa6e331, that added a fast path to skip
      anti-wraparound and non-aggressive autovacuum jobs (these have no sense
      as anti-wraparound implies aggressive).  With a cluster using a high
      amount of relations with a portion of them being heavily updated, this
      could cause autovacuum to lock down, with autovacuum workers attempting
      repeatedly those jobs on the same relations for the same database, that
      just kept being skipped.  This lock down can be solved with a manual
      VACUUM FREEZE.
      
      Justin King has reported one environment where the issue happened, and
      Julien Rouhaud and I have been able to reproduce it in a second
      environment.  With a very aggressive autovacuum_freeze_max_age,
      triggering those jobs with pgbench is a matter of minutes, and hitting
      the lock down is a lot harder (my local tests failed to do that).
      
      Note that anti-wraparound and non-aggressive jobs can only be triggered
      on a subset of shared catalogs:
      - pg_auth_members
      - pg_authid
      - pg_database
      - pg_replication_origin
      - pg_shseclabel
      - pg_subscription
      - pg_tablespace
      While the lock down was possible down to v12, the root cause of those
      jobs is a much older issue, which needs more analysis.
      
      Bonus thanks to Andres Freund for the discussion.
      
      Reported-by: Justin King
      Discussion: https://postgr.es/m/CAE39h22zPLrkH17GrkDgAYL3kbjvySYD1io+rtnAUFnaJJVS4g@mail.gmail.com
      Backpatch-through: 12
      dd9ac7d5
    • Peter Geoghegan's avatar
      Refactor nbtree high key truncation. · 7c2dbc69
      Peter Geoghegan authored
      Simplify _bt_truncate(), the routine that generates truncated leaf page
      high keys.  Remove a micro-optimization that avoided a second palloc0()
      call (this was used when a heap TID was needed in the final pivot tuple,
      though only when the index happened to not be an INCLUDE index).
      
      Removing this dubious micro-optimization allows _bt_truncate() to use
      the index_truncate_tuple() indextuple.c utility routine in all cases.
      This was already the common case.
      
      This commit is a HEAD-only follow up to bugfix commit 4b42a899.
      7c2dbc69
    • Andres Freund's avatar
      Deduplicate PageIsNew() check in lazy_scan_heap(). · d4b34f60
      Andres Freund authored
      The recheck isn't needed anymore, as RelationGetBufferForTuple() now
      extends the relation with RBM_ZERO_AND_LOCK. Previously we needed to
      handle the fact that relation extension extended the relation and then
      separately acquired a lock on the page - while expecting that the page
      is empty.
      
      Reported-By: Ranier Vilela
      Discussion: https://postgr.es/m/CAEudQArA_=J0D5T258xsCY6Xtf6wiH4b=QDPDgVS+WZUN10WDw@mail.gmail.com
      d4b34f60
    • Alexander Korotkov's avatar
      Fix missing SP-GiST support in 911e7020 · 364bdd0b
      Alexander Korotkov authored
      911e7020 misses setting of amoptsprocnum for SP-GiST.  This commit fixes
      that.
      364bdd0b
    • Alexander Korotkov's avatar
      Remove rudiments of supporting procnum == 0 from 911e7020 · 851b14b0
      Alexander Korotkov authored
      Early versions of opclass options patch uses zero support procedure as opclass
      options procedure.  This commit removes rudiments of it, which were committed
      in 911e7020.  Also, it implements correct handling of amoptsprocnum == 0.
      851b14b0
    • Peter Geoghegan's avatar
      Consistently truncate non-key suffix columns. · 4b42a899
      Peter Geoghegan authored
      INCLUDE indexes failed to have their non-key attributes physically
      truncated away in certain rare cases.  This led to physically larger
      pivot tuples that contained useless non-key attribute values.  The
      impact on users should be negligible, but this is still clearly a
      regression (Postgres 11 supports INCLUDE indexes, and yet was not
      affected).
      
      The bug appeared in commit dd299df8, which introduced "true" suffix
      truncation of key attributes.
      
      Discussion: https://postgr.es/m/CAH2-Wz=E8pkV9ivRSFHtv812H5ckf8s1-yhx61_WrJbKccGcrQ@mail.gmail.com
      Backpatch: 12-, where "true" suffix truncation was introduced.
      4b42a899
    • Alexander Korotkov's avatar
      Implement operator class parameters · 911e7020
      Alexander Korotkov authored
      PostgreSQL provides set of template index access methods, where opclasses have
      much freedom in the semantics of indexing.  These index AMs are GiST, GIN,
      SP-GiST and BRIN.  There opclasses define representation of keys, operations on
      them and supported search strategies.  So, it's natural that opclasses may be
      faced some tradeoffs, which require user-side decision.  This commit implements
      opclass parameters allowing users to set some values, which tell opclass how to
      index the particular dataset.
      
      This commit doesn't introduce new storage in system catalog.  Instead it uses
      pg_attribute.attoptions, which is used for table column storage options but
      unused for index attributes.
      
      In order to evade changing signature of each opclass support function, we
      implement unified way to pass options to opclass support functions.  Options
      are set to fn_expr as the constant bytea expression.  It's possible due to the
      fact that opclass support functions are executed outside of expressions, so
      fn_expr is unused for them.
      
      This commit comes with some examples of opclass options usage.  We parametrize
      signature length in GiST.  That applies to multiple opclasses: tsvector_ops,
      gist__intbig_ops, gist_ltree_ops, gist__ltree_ops, gist_trgm_ops and
      gist_hstore_ops.  Also we parametrize maximum number of integer ranges for
      gist__int_ops.  However, the main future usage of this feature is expected
      to be json, where users would be able to specify which way to index particular
      json parts.
      
      Catversion is bumped.
      
      Discussion: https://postgr.es/m/d22c3a18-31c7-1879-fc11-4c1ce2f5e5af%40postgrespro.ru
      Author: Nikita Glukhov, revised by me
      Reviwed-by: Nikolay Shaplov, Robert Haas, Tom Lane, Tomas Vondra, Alvaro Herrera
      911e7020
    • Peter Eisentraut's avatar
      Allow using Unix-domain sockets on Windows in tests · 1d53432f
      Peter Eisentraut authored
      The test suites currently don't use Unix-domain sockets on Windows.
      This optionally allows enabling that by setting the environment
      variable PG_TEST_USE_UNIX_SOCKETS.
      
      This should currently be considered experimental.  In particular,
      pg_regress.c contains some comments that the cleanup code for
      Unix-domain sockets doesn't work correctly under Windows, which hasn't
      been an problem until now.  But it's good enough for locally
      supervised testing of the functionality.
      Reviewed-by: default avatarAndrew Dunstan <andrew.dunstan@2ndquadrant.com>
      Discussion: https://www.postgresql.org/message-id/flat/54bde68c-d134-4eb8-5bd3-8af33b72a010@2ndquadrant.com
      1d53432f