1. 24 Mar, 2020 1 commit
  2. 23 Mar, 2020 10 commits
  3. 22 Mar, 2020 1 commit
  4. 21 Mar, 2020 7 commits
    • Tom Lane's avatar
      Fix up recent breakage of headerscheck and cpluspluscheck. · d0587f52
      Tom Lane authored
      headerscheck and cpluspluscheck should skip the recently-added
      cmdtaglist.h header, since (like kwlist.h and some other similarly-
      designed headers) it's not meant to be included standalone.
      
      evtcache.h was missing an #include to support its usage of Bitmapset.
      
      typecmds.h was missing an #include to support its usage of ParseState.
      
      The first two of these were evidently oversights in commit 2f966131.
      I didn't track down exactly which change broke typecmds.h, but it
      must have been some rearrangement in one of its existing inclusions,
      because it's referenced ParseState for quite a long time and there
      were not complaints from these checking programs before.
      d0587f52
    • Noah Misch's avatar
      Skip WAL for new relfilenodes, under wal_level=minimal. · cb2fd7ea
      Noah Misch authored
      Until now, only selected bulk operations (e.g. COPY) did this.  If a
      given relfilenode received both a WAL-skipping COPY and a WAL-logged
      operation (e.g. INSERT), recovery could lose tuples from the COPY.  See
      src/backend/access/transam/README section "Skipping WAL for New
      RelFileNode" for the new coding rules.  Maintainers of table access
      methods should examine that section.
      
      To maintain data durability, just before commit, we choose between an
      fsync of the relfilenode and copying its contents to WAL.  A new GUC,
      wal_skip_threshold, guides that choice.  If this change slows a workload
      that creates small, permanent relfilenodes under wal_level=minimal, try
      adjusting wal_skip_threshold.  Users setting a timeout on COMMIT may
      need to adjust that timeout, and log_min_duration_statement analysis
      will reflect time consumption moving to COMMIT from commands like COPY.
      
      Internally, this requires a reliable determination of whether
      RollbackAndReleaseCurrentSubTransaction() would unlink a relation's
      current relfilenode.  Introduce rd_firstRelfilenodeSubid.  Amend the
      specification of rd_createSubid such that the field is zero when a new
      rel has an old rd_node.  Make relcache.c retain entries for certain
      dropped relations until end of transaction.
      
      Back-patch to 9.5 (all supported versions).  This introduces a new WAL
      record type, XLOG_GIST_ASSIGN_LSN, without bumping XLOG_PAGE_MAGIC.  As
      always, update standby systems before master systems.  This changes
      sizeof(RelationData) and sizeof(IndexStmt), breaking binary
      compatibility for affected extensions.  (The most recent commit to
      affect the same class of extensions was
      089e4d405d0f3b94c74a2c6a54357a84a681754b.)
      
      Kyotaro Horiguchi, reviewed (in earlier, similar versions) by Robert
      Haas.  Heikki Linnakangas and Michael Paquier implemented earlier
      designs that materially clarified the problem.  Reviewed, in earlier
      designs, by Andrew Dunstan, Andres Freund, Alvaro Herrera, Tom Lane,
      Fujii Masao, and Simon Riggs.  Reported by Martijn van Oosterhout.
      
      Discussion: https://postgr.es/m/20150702220524.GA9392@svana.org
      cb2fd7ea
    • Noah Misch's avatar
      In log_newpage_range(), heed forkNum and page_std arguments. · d3e57285
      Noah Misch authored
      The function assumed forkNum=MAIN_FORKNUM and page_std=true, ignoring
      the actual arguments.  Existing callers passed exactly those values, so
      there's no live bug.  Back-patch to v12, where the function first
      appeared, because another fix needs this.
      
      Discussion: https://postgr.es/m/20191118045434.GA1173436@rfd.leadboat.com
      d3e57285
    • Noah Misch's avatar
      During heap rebuild, lock any TOAST index until end of transaction. · e629a01f
      Noah Misch authored
      swap_relation_files() calls toast_get_valid_index() to find and lock
      this index, just before swapping with the rebuilt TOAST index.  The
      latter function releases the lock before returning.  Potential for
      mischief is low; a concurrent session can issue ALTER INDEX ... SET
      (fillfactor = ...), which is not alarming.  Nonetheless, changing
      pg_class.relfilenode without a lock is unconventional.  Back-patch to
      9.5 (all supported versions), because another fix needs this.
      
      Discussion: https://postgr.es/m/20191226001521.GA1772687@rfd.leadboat.com
      e629a01f
    • Noah Misch's avatar
      Fix cosmetic blemishes involving rd_createSubid. · d60ef94d
      Noah Misch authored
      Remove an obsolete comment from AtEOXact_cleanup().  Restore formatting
      of a comment in struct RelationData, mangled by the pgindent run in
      commit 9af4159f.  Back-patch to 9.5 (all
      supported versions), because another fix stacks on this.
      d60ef94d
    • Amit Kapila's avatar
      Allow page lock to conflict among parallel group members. · 3ba59ccc
      Amit Kapila authored
      This is required as it is no safer for two related processes to perform
      clean up in gin indexes at a time than for unrelated processes to do the
      same.  After acquiring page locks, we can acquire relation extension lock
      but reverse never happens which means these will also not participate in
      deadlock.  So, avoid checking wait edges from this lock.
      
      Currently, the parallel mode is strictly read-only, but after this patch
      we have the infrastructure to allow parallel inserts and parallel copy.
      
      Author: Dilip Kumar, Amit Kapila
      Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko
      Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com
      3ba59ccc
    • Bruce Momjian's avatar
      docs: use alias in WHERE clause of full text search example · a6d7e9fb
      Bruce Momjian authored
      The current doc query specified an alias in the FROM clause and used in
      it the target list, but not in the WHERE clause.
      
      Reported-by: axykon@gmail.com
      
      Discussion: https://postgr.es/m/158316348159.30450.16075357948244298217@wrigleys.postgresql.org
      
      Backpatch-through: 9.5
      a6d7e9fb
  5. 20 Mar, 2020 5 commits
  6. 19 Mar, 2020 11 commits
    • Peter Geoghegan's avatar
      nbtree: Remove obsolete _bt_pgaddtup() comments. · b27e1b34
      Peter Geoghegan authored
      Remove comments that are a throw back to a time when nbtree cared about
      write-ordering dependencies.  The comments are similar to those removed
      by commit 9ee7414e, among others.
      b27e1b34
    • Jeff Davis's avatar
      Revert "Specialize MemoryContextMemAllocated()." · 2fd6a44a
      Jeff Davis authored
      This reverts commit e00912e1.
      2fd6a44a
    • Bruce Momjian's avatar
      pg_upgrade: make get_major_server_version() err msg consistent · 2247a1ea
      Bruce Momjian authored
      This patch fixes the error message in get_major_server_version() to be
      "could not parse version file", and uses the full file path name, rather
      than just the data directory path.
      
      Also, commit 4109bb5d added the cause of the failure to the  "could
      not open" error message, and improved quoting.  This patch backpatches
      the "could not open" cause to PG 12, where it was first widely used, and
      backpatches the quoting fix in that patch to all supported releases.
      
      Reported-by: Tom Lane
      
      Discussion: https://postgr.es/m/87pne2w98h.fsf@wibble.ilmari.org
      
      Author: Dagfinn Ilmari Mannsåker
      
      Backpatch-through: 9.5
      2247a1ea
    • Alexander Korotkov's avatar
    • Tom Lane's avatar
      Introduce "anycompatible" family of polymorphic types. · 24e2885e
      Tom Lane authored
      This patch adds the pseudo-types anycompatible, anycompatiblearray,
      anycompatiblenonarray, and anycompatiblerange.  They work much like
      anyelement, anyarray, anynonarray, and anyrange respectively, except
      that the actual input values need not match precisely in type.
      Instead, if we can find a common supertype (using the same rules
      as for UNION/CASE type resolution), then the parser automatically
      promotes the input values to that type.  For example,
      "myfunc(anycompatible, anycompatible)" can match a call with one
      integer and one bigint argument, with the integer automatically
      promoted to bigint.  With anyelement in the definition, the user
      would have had to cast the integer explicitly.
      
      The new types also provide a second, independent set of type variables
      for function matching; thus with "myfunc(anyelement, anyelement,
      anycompatible) returns anycompatible" the first two arguments are
      constrained to be the same type, but the third can be some other
      type, and the result has the type of the third argument.  The need
      for more than one set of type variables was foreseen back when we
      first invented the polymorphic types, but we never did anything
      about it.
      
      Pavel Stehule, revised a bit by me
      
      Discussion: https://postgr.es/m/CAFj8pRDna7VqNi8gR+Tt2Ktmz0cq5G93guc3Sbn_NVPLdXAkqA@mail.gmail.com
      24e2885e
    • Fujii Masao's avatar
      Make pg_basebackup ask the server to estimate the total backup size, by default. · fab13dc5
      Fujii Masao authored
      This commit changes pg_basebackup so that it specifies PROGRESS option in
      BASE_BACKUP replication command whether --progress is specified or not.
      This causes the server to estimate the total backup size and report it in
      pg_stat_progress_basebackup.backup_total, by default. This is reasonable
      default because the time required for the estimation would not be so large
      in most cases.
      
      Also this commit adds new option --no-estimate-size to pg_basebackup.
      This option prevents the server from the estimation, and so is useful to
      avoid such estimation time if it's too long.
      
      Author: Fujii Masao
      Reviewed-by: Magnus Hagander, Amit Langote
      Discussion: https://postgr.es/m/CABUevEyDPPSjP7KRvfTXPdqOdY5aWNkqsB5aAXs3bco5ZwtGHg@mail.gmail.com
      fab13dc5
    • Peter Eisentraut's avatar
      Prepare to support non-tables in publications · c314c147
      Peter Eisentraut authored
      This by itself doesn't change any functionality but prepares the way
      for having relations other than base tables in publications.
      
      Make arrangements for COPY handling the initial table sync.  For
      non-tables we have to use COPY (SELECT ...) instead of directly
      copying from the table, but then we have to take care to omit
      generated columns from the column list.
      
      Also, remove a hardcoded reference to relkind = 'r' and rely on the
      publisher to send only what it can actually publish, which will be
      correct even in future cross-version scenarios.
      Reviewed-by: default avatarAmit Langote <amitlangote09@gmail.com>
      Discussion: https://www.postgresql.org/message-id/flat/CA+HiwqH=Y85vRK3mOdjEkqFK+E=ST=eQiHdpj43L=_eJMOOznQ@mail.gmail.com
      c314c147
    • Fujii Masao's avatar
      Rename the recovery-related wait events. · 1d253bae
      Fujii Masao authored
      This commit renames RecoveryWalAll and RecoveryWalStream wait events to
      RecoveryWalStream and RecoveryRetrieveRetryInterval, respectively,
      in order to make the names and what they are more consistent. For example,
      previously RecoveryWalAll was reported as a wait event while the recovery
      was waiting for WAL from a stream, and which was confusing because the name
      was very different from the situation where the wait actually could happen.
      
      The names of macro variables for those wait events also are renamed
      accordingly.
      
      This commit also changes the category of RecoveryRetrieveRetryInterval to
      Timeout from Activity because the wait event is reported while waiting based
      on wal_retrieve_retry_interval.
      
      Author: Fujii Masao
      Reviewed-by: Kyotaro Horiguchi, Atsushi Torikoshi
      Discussion: https://postgr.es/m/124997ee-096a-5d09-d8da-2c7a57d0816e@oss.nttdata.com
      1d253bae
    • Amit Kapila's avatar
      Add assert to ensure that page locks don't participate in deadlock cycle. · 72e78d83
      Amit Kapila authored
      Assert that we don't acquire any other heavyweight lock while holding the
      page lock except for relation extension.  However, these locks are never
      taken in reverse order which implies that page locks will never
      participate in the deadlock cycle.
      
      Similar to relation extension, page locks are also held for a short
      duration, so imposing such a restriction won't hurt.
      
      Author: Dilip Kumar, with few changes by Amit Kapila
      Reviewed-by: Amit Kapila, Kuntal Ghosh and Sawada Masahiko
      Discussion: https://postgr.es/m/CAD21AoCmT3cFQUN4aVvzy5chw7DuzXrJCbrjTU05B+Ss=Gn1LA@mail.gmail.com
      72e78d83
    • Peter Geoghegan's avatar
      nbtree: Use raw PageAddItem() for retail inserts. · 6312c08a
      Peter Geoghegan authored
      Only internal page splits need to call _bt_pgaddtup() instead of
      PageAddItem(), and only for data items, one of which will end up at the
      first offset (or first offset after the high key offset) on the new
      right page.  This data item alone will need to be truncated in
      _bt_pgaddtup().
      
      Since there is no reason why retail inserts ever need to truncate the
      incoming item, use a raw PageAddItem() call there instead.  Even
      _bt_split() uses raw PageAddItem() calls for left page and right page
      high keys.  Clearly the _bt_pgaddtup() shim function wasn't really
      encapsulating anything.  _bt_pgaddtup() should now be thought of as a
      _bt_split() helper function.
      
      Note that the assertions from commit d1e241c2 verify that retail inserts
      never insert an item at an internal page's negative infinity offset.
      This invariant could only ever be violated as a result of a basic logic
      error in nbtinsert.c.
      6312c08a
    • Michael Paquier's avatar
      Fix comment related to concurrent index swapping in index.c · d41202f3
      Michael Paquier authored
      A comment about switching indisvalid of the new and old indexes swapped
      in REINDEX CONCURRENTLY got this backwards.
      
      Issue introduced by 5dc92b84, the original commit of REINDEX
      CONCURRENTLY.
      
      Author: Julien Rouhaud
      Discussion: https://postgr.es/m/20200318143340.GA46897@nol
      Backpatch-through: 12
      d41202f3
  7. 18 Mar, 2020 5 commits