1. 06 Apr, 2020 2 commits
  2. 05 Apr, 2020 4 commits
  3. 04 Apr, 2020 8 commits
    • Noah Misch's avatar
      Add perl2host call missing from a new test file. · 70de4e95
      Noah Misch authored
      Oversight in today's commit c6b92041.
      Per buildfarm member jacana.
      
      Discussion: http://postgr.es/m/20200404223212.GC3442685@rfd.leadboat.com
      70de4e95
    • Tom Lane's avatar
      Remove bogus Assert, add some regression test cases showing why. · 07871d40
      Tom Lane authored
      Commit 77ec5aff added an assertion to enforce_generic_type_consistency
      that boils down to "if the function result is polymorphic, there must be
      at least one polymorphic argument".  This should be true for user-created
      functions, but there are built-in functions for which it's not true, as
      pointed out by Jaime Casanova.  Hence, go back to the old behavior of
      leaving the return type alone.  There's only a limited amount of stuff
      you can do with such a function result, but it does work to some extent;
      add some regression test cases to ensure we don't break that again.
      
      Discussion: https://postgr.es/m/CAJGNTeMbhtsCUZgJJ8h8XxAJbK7U2ipsX8wkHRtZRz-NieT8RA@mail.gmail.com
      07871d40
    • Noah Misch's avatar
      Skip WAL for new relfilenodes, under wal_level=minimal. · c6b92041
      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.
      
      Bump XLOG_PAGE_MAGIC, since this introduces XLOG_GIST_ASSIGN_LSN.
      Future servers accept older WAL, so this bump is discretionary.
      
      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
      c6b92041
    • Peter Eisentraut's avatar
      552fcebf
    • Amit Kapila's avatar
      Add infrastructure to track WAL usage. · df3b1814
      Amit Kapila authored
      This allows gathering the WAL generation statistics for each statement
      execution.  The three statistics that we collect are the number of WAL
      records, the number of full page writes and the amount of WAL bytes
      generated.
      
      This helps the users who have write-intensive workload to see the impact
      of I/O due to WAL.  This further enables us to see approximately what
      percentage of overall WAL is due to full page writes.
      
      In the future, we can extend this functionality to allow us to compute the
      the exact amount of WAL data due to full page writes.
      
      This patch in itself is just an infrastructure to compute WAL usage data.
      The upcoming patches will expose this data via explain, auto_explain,
      pg_stat_statements and verbose (auto)vacuum output.
      
      Author: Kirill Bychik, Julien Rouhaud
      Reviewed-by: Dilip Kumar, Fujii Masao and Amit Kapila
      Discussion: https://postgr.es/m/CAB-hujrP8ZfUkvL5OYETipQwA=e3n7oqHFU=4ZLxWS_Cza3kQQ@mail.gmail.com
      df3b1814
    • Jeff Davis's avatar
      Include chunk overhead in hash table entry size estimate. · 0588ee63
      Jeff Davis authored
      Don't try to be precise about it, just use a constant 16 bytes of
      chunk overhead. Being smarter would require knowing the memory context
      where the chunk will be allocated, which is not known by all callers.
      
      Discussion: https://postgr.es/m/20200325220936.il3ni2fj2j2b45y5@alap3.anarazel.de
      0588ee63
    • Robert Haas's avatar
      Fix resource management bug with replication=database. · 3e0d80fd
      Robert Haas authored
      Commit 0d8c9c12 allowed BASE_BACKUP to
      acquire a ResourceOwner without a transaction so that the backup
      manifest functionality could use a BufFile, but it overlooked the fact
      that when a walsender is used with replication=database, it might have
      a transaction in progress, because in that mode, SQL and replication
      commands can be mixed.  Try to fix things up so that the two cleanup
      mechanisms don't conflict.
      
      Per buildfarm member serinus, which triggered the problem when
      CREATE_REPLICATION_SLOT failed from inside a transaction.  It passed
      on the subsequent run, so evidently the failure doesn't happen every
      time.
      3e0d80fd
    • Robert Haas's avatar
      Be more careful about time_t vs. pg_time_t in basebackup.c. · db1531ca
      Robert Haas authored
      lapwing is complaining that about a call to pg_gmtime, saying that
      it "expected 'const pg_time_t *' but argument is of type 'time_t *'".
      I at first thought that the problem had someting to do with const,
      but Thomas Munro suggested that it might be just because time_t
      and pg_time_t are different identifers. lapwing is i686 rather than
      x86_64, and pg_time_t is always int64, so that seems like a good
      guess.
      
      There is other code that just casts time_t to pg_time_t without
      any conversion function, so try that approach here.
      
      Introduced in commit 0d8c9c12.
      db1531ca
  4. 03 Apr, 2020 19 commits
  5. 02 Apr, 2020 7 commits
    • Tom Lane's avatar
      Improve stability fix for partition_aggregate test. · 7cb0a423
      Tom Lane authored
      Instead of disabling autovacuum on these test tables, adjust the
      partition boundaries so that the child partitions are not all the
      same size.  That should cause the planner to use a predictable
      ordering of the per-partition scan nodes even in cases where
      autovacuum causes the rowcount estimates to be off a bit.
      Moreover, this also lets these tests show that the planner does
      properly order the tables in descending size order, something
      that wasn't being proven before.
      
      The pagg_tab1 and pagg_tab2 partitions are still all the same
      size, but that should be fine, because those tables are so small
      that (1) autovacuum won't fire on them, and (2) even if it did,
      it couldn't change the reltuples value --- with only one page,
      it can't see just part of the relation.
      
      Discussion: https://postgr.es/m/24467.1585838693@sss.pgh.pa.us
      7cb0a423
    • Bruce Momjian's avatar
      doc: remove unnecessary INNER keyword · 8da1538b
      Bruce Momjian authored
      A join that was added in commit 9b2009c4 that did not use the INNER
      keyword but the existing query used it.  It was cleaner to remove the
      existing INNER keyword.
      
      Reported-by: Peter Eisentraut
      
      Discussion: https://postgr.es/m/a1ffbfda-59d2-5732-e5fb-3df8582b6434@2ndquadrant.com
      
      Backpatch-through: 9.5
      8da1538b
    • Bruce Momjian's avatar
      doc: remove comma, related to commit 92d31085 · c713dc2f
      Bruce Momjian authored
      Reported-by: Peter Eisentraut
      
      Discussion: https://postgr.es/m/750b8832-d123-7f9b-931e-43ce8321b2d7@2ndquadrant.com
      
      Backpatch-through: 9.5
      c713dc2f
    • Tom Lane's avatar
      Improve user control over truncation of logged bind-parameter values. · 0b34e7d3
      Tom Lane authored
      This patch replaces the boolean GUC log_parameters_on_error introduced
      by commit ba79cb5d with an integer log_parameter_max_length_on_error,
      adding the ability to specify how many bytes to trim each logged
      parameter value to.  (The previous coding hard-wired that choice at
      64 bytes.)
      
      In addition, add a new parameter log_parameter_max_length that provides
      similar control over truncation of query parameters that are logged in
      response to statement-logging options, as opposed to errors.  Previous
      releases always logged such parameters in full, possibly causing log
      bloat.
      
      For backwards compatibility with prior releases,
      log_parameter_max_length defaults to -1 (log in full), while
      log_parameter_max_length_on_error defaults to 0 (no logging).
      
      Per discussion, log_parameter_max_length is SUSET since the DBA should
      control routine logging behavior, but log_parameter_max_length_on_error
      is USERSET because it also affects errcontext data sent back to the
      client.
      
      Alexey Bashtanov, editorialized a little by me
      
      Discussion: https://postgr.es/m/b10493cc-a399-a03a-67c7-068f2791ee50@imap.cc
      0b34e7d3
    • Tomas Vondra's avatar
    • David Rowley's avatar
      Attempt to stabilize partitionwise_aggregate test · cefb82d4
      David Rowley authored
      In b07642db, we added code to trigger autovacuums based on the number of
      INSERTs into a table. This seems to have cause some destabilization of
      the regression tests. Likely this is due to an autovacuum triggering
      mid-test and (per theory from Tom Lane) one of the test's queries causes
      autovacuum to skip some number of pages, resulting in the reltuples
      estimate changing.
      
      The failure that this is attempting to fix is around the order of subnodes
      in an Append. Since the planner orders these according to the subnode
      cost, then it's possible that a small change in the reltuples value changes
      the subnode's cost enough that it swaps position with one of its fellow
      subnodes.
      
      The failure here only seems to occur on slower buildfarm machines. In this
      case, lousyjack, which seems have taken over 8 minutes to run just
      the partitionwise_aggregate test. Such a slow run would increase the
      chances that the autovacuum launcher would trigger a vacuum mid-test.
      Faster machines run this test in sub second time, so have a much smaller
      window for an autovacuum to trigger.
      
      Here we fix this by disabling autovacuum on all tables created in the test.
      
      Additionally, this reverts the change made in the
      partitionwise_aggregate test in 2dc16efe.
      
      Discussion: https://postgr.es/m/22297.1585797192@sss.pgh.pa.us
      cefb82d4
    • Peter Eisentraut's avatar
      Add SQL functions for Unicode normalization · 2991ac5f
      Peter Eisentraut authored
      This adds SQL expressions NORMALIZE() and IS NORMALIZED to convert and
      check Unicode normal forms, per SQL standard.
      
      To support fast IS NORMALIZED tests, we pull in a new data file
      DerivedNormalizationProps.txt from Unicode and build a lookup table
      from that, using techniques similar to ones already used for other
      Unicode data.  make update-unicode will keep it up to date.  We only
      build and use these tables for the NFC and NFKC forms, because they
      are too big for NFD and NFKD and the improvement is not significant
      enough there.
      Reviewed-by: default avatarDaniel Verite <daniel@manitou-mail.org>
      Reviewed-by: default avatarAndreas Karlsson <andreas@proxel.se>
      Discussion: https://www.postgresql.org/message-id/flat/c1909f27-c269-2ed9-12f8-3ab72c8caf7a@2ndquadrant.com
      2991ac5f