1. 17 Apr, 2019 9 commits
  2. 16 Apr, 2019 4 commits
  3. 15 Apr, 2019 10 commits
  4. 14 Apr, 2019 2 commits
  5. 13 Apr, 2019 4 commits
    • Noah Misch's avatar
      When Perl "kill(9, ...)" fails, try "pg_ctl kill". · 947a3501
      Noah Misch authored
      Per buildfarm member jacana, the former fails under msys Perl 5.8.8.
      Back-patch to 9.6, like the code in question.
      
      Discussion: https://postgr.es/m/GrdLgAdUK9FdyZg8VIcTDKVOkys122ZINEb3CjjoySfGj2KyPiMKTh1zqtRp0TAD7FJ27G-OBB3eplxIB5GhcQH5o8zzGZfp0MuJaXJxVxk=@yesql.se
      947a3501
    • Tom Lane's avatar
      Prevent memory leaks associated with relcache rd_partcheck structures. · 5f1433ac
      Tom Lane authored
      The original coding of generate_partition_qual() just copied the list
      of predicate expressions into the global CacheMemoryContext, making it
      effectively impossible to clean up when the owning relcache entry is
      destroyed --- the relevant code in RelationDestroyRelation() only managed
      to free the topmost List header :-(.  This resulted in a session-lifespan
      memory leak whenever a table partition's relcache entry is rebuilt.
      Fortunately, that's not normally a large data structure, and rebuilds
      shouldn't occur all that often in production situations; but this is
      still a bug worth fixing back to v10 where the code was introduced.
      
      To fix, put the cached expression tree into its own small memory context,
      as we do with other complicated substructures of relcache entries.
      Also, deal more honestly with the case that a partition has an empty
      partcheck list; while that probably isn't a case that's very interesting
      for production use, it's legal.
      
      In passing, clarify comments about how partitioning-related relcache
      data structures are managed, and add some Asserts that we're not leaking
      old copies when we overwrite these data fields.
      
      Amit Langote and Tom Lane
      
      Discussion: https://postgr.es/m/7961.1552498252@sss.pgh.pa.us
      5f1433ac
    • Noah Misch's avatar
      Consistently test for in-use shared memory. · c0985099
      Noah Misch authored
      postmaster startup scrutinizes any shared memory segment recorded in
      postmaster.pid, exiting if that segment matches the current data
      directory and has an attached process.  When the postmaster.pid file was
      missing, a starting postmaster used weaker checks.  Change to use the
      same checks in both scenarios.  This increases the chance of a startup
      failure, in lieu of data corruption, if the DBA does "kill -9 `head -n1
      postmaster.pid` && rm postmaster.pid && pg_ctl -w start".  A postmaster
      will no longer stop if shmat() of an old segment fails with EACCES.  A
      postmaster will no longer recycle segments pertaining to other data
      directories.  That's good for production, but it's bad for integration
      tests that crash a postmaster and immediately delete its data directory.
      Such a test now leaks a segment indefinitely.  No "make check-world"
      test does that.  win32_shmem.c already avoided all these problems.  In
      9.6 and later, enhance PostgresNode to facilitate testing.  Back-patch
      to 9.4 (all supported versions).
      
      Reviewed (in earlier versions) by Daniel Gustafsson and Kyotaro HORIGUCHI.
      
      Discussion: https://postgr.es/m/20190408064141.GA2016666@rfd.leadboat.com
      c0985099
    • Michael Paquier's avatar
      Revert "Switch TAP tests of pg_rewind to use a role with minimal permissions" · db8db624
      Michael Paquier authored
      This reverts commit d4e2a843, which added a new user with limited
      permissions to run the TAP tests of pg_rewind.  Buildfarm machine
      members on Windows jacana and bowerbird have been complaining about
      that, the new role not being able to run the rewind because SSPI is not
      configured to allow it.
      
      Fixing the test requires passing down directly the new user to
      pg_regress with --create-role so as SSPI can work properly.
      
      Reported-by: Andrew Dunstan
      Discussion: https://postgr.es/m/3cd43d33-f415-cc41-ade3-7230ab15b2c9@2ndQuadrant.com
      db8db624
  6. 12 Apr, 2019 6 commits
  7. 11 Apr, 2019 5 commits
    • Tom Lane's avatar
      Re-order some regression test scripts for more parallelism. · 798070ec
      Tom Lane authored
      Move the strings, numerology, insert, insert_conflict, select and
      errors tests to be parts of nearby parallel groups, instead of
      executing by themselves.  (Moving "select" required adjusting the
      constraints test, which uses a table named "tmp" as select also
      does.  There don't seem to be any other conflicts.)
      
      Move psql and stats_ext to the next parallel group, where the rules
      test also has a long runtime.  To make it safe to run stats_ext in
      parallel with rules, I adjusted the latter to only dump views/rules
      from the pg_catalog and public schemas, which was what it was doing
      anyway.  stats_ext makes some views in a transient schema, which now
      will not affect rules.
      
      Reorder serial_schedule to match parallel_schedule.
      
      Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us
      798070ec
    • Tom Lane's avatar
      Speed up sort-order-comparison tests in create_index_spgist. · 5874c705
      Tom Lane authored
      This test script verifies that KNN searches of an SP-GiST index
      produce the same sort order as a seqscan-and-sort.  The FULL JOINs
      used for that are exceedingly slow, however.  Investigation shows
      that the problem is that the initial join is on the rank() values,
      and we have a lot of duplicates due to the data set containing 1000
      duplicate points.  We're therefore going to produce 1000000 join
      rows that have to be thrown away again by the join filter.
      
      We can improve matters by using row_number() instead of rank(),
      so that the initial join keys are unique.  The catch is that
      that makes the results sensitive to the sorting of rows with
      equal distances from the reference point.  That doesn't matter
      for the actually-equal points, but as luck would have it, the
      data set also contains two distinct points that have identical
      distances to the origin.  So those two rows could legitimately
      appear in either order, causing unwanted output from the check
      queries.
      
      However, it doesn't seem like it's the job of this test to
      check whether the <-> operator correctly computes distances;
      its charter is just to verify that SP-GiST emits the values
      in distance order.  So we can dodge the indeterminacy problem
      by having the check only compare row numbers and distances
      not the actual point values.
      
      This change reduces the run time of create_index_spgist by a good
      three-quarters, on my machine, with ensuing beneficial effects on
      the runtime of create_index (thanks to interactions with CREATE
      INDEX CONCURRENTLY tests in the latter).  I see a net improvement
      of more than 2X in the runtime of their parallel test group.
      
      Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us
      5874c705
    • Tom Lane's avatar
      Split up a couple of long-running regression test scripts. · 385d396b
      Tom Lane authored
      The point of this change is to increase the potential for parallelism
      while running the core regression tests.  Most people these days are
      using parallel testing modes on multi-core machines, so we might as
      well try a bit harder to keep multiple cores busy.  Hence, a test that
      runs much longer than others in its parallel group is a candidate to
      be sub-divided.
      
      In this patch, create_index.sql and join.sql are split up.
      I haven't changed the content of the tests in any way, just
      moved them.
      
      I moved create_index.sql's SP-GiST-related tests into a new script
      create_index_spgist, and moved its btree multilevel page deletion test
      over to the existing script btree_index.  (btree_index is a more natural
      home for that test, and it's shorter than others in its parallel group,
      so this doesn't hurt total runtime of that group.)  There might be
      room for more aggressive splitting of create_index, but this is enough
      to improve matters considerably.
      
      Likewise, I moved join.sql's "exercises for the hash join code" into
      a new file join_hash.  Those exercises contributed three-quarters of
      the script's runtime.  Which might well be excessive ... but for the
      moment, I'm satisfied with shoving them into a different parallel
      group, where they can share runtime with the roughly-equally-lengthy
      gist test.
      
      (Note for anybody following along at home: there are interesting
      interactions between the runtimes of create_index and anything running
      in parallel with it, because the tests of CREATE INDEX CONCURRENTLY
      in that file will repeatedly block waiting for concurrent transactions
      to commit.  As committed in this patch, create_index and
      create_index_spgist have roughly equal runtimes, but that's mostly an
      artifact of forced synchronization of the CONCURRENTLY tests; when run
      serially, create_index is much faster.  A followup patch will reduce
      the runtime of create_index_spgist and thereby also create_index.)
      
      Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us
      385d396b
    • Tom Lane's avatar
      Move plpgsql error-trapping tests to a new module-specific test file. · 6726d8d4
      Tom Lane authored
      The test for statement timeout has a 2-second timeout, which was only
      moderately annoying when it was written, but nowadays it contributes
      a pretty significant chunk of the elapsed time needed to run the core
      regression tests on a fast machine.  We can improve this situation by
      pushing the test into a plpgsql-specific test file instead of having
      it in a core regression test.  That's a clean win when considering
      just the core tests.  Even when considering check-world or a buildfarm
      test run, we should come out ahead because the core tests get run
      more times in those sequences.
      
      Furthermore, since the plpgsql tests aren't currently parallelized,
      it seems likely that the timing problems reflected in commit f1e671a0
      (which increased that timeout from 1 sec to 2) will be much less severe
      in this context.  Hence, let's try cutting the timeout back to 1 second
      in hopes of a further win for check-world.  We can undo that if
      buildfarm experience proves it to be a bad idea.
      
      To give the new test file some modicum of intellectual coherency,
      I moved the surrounding tests related to error-trapping along with
      the statement timeout test proper.  Those other tests don't run long
      enough to have any particular bearing on test-runtime considerations.
      The tests are the same as before, except with minor adjustments to
      not depend on an externally-created table.
      
      Discussion: https://postgr.es/m/735.1554935715@sss.pgh.pa.us
      6726d8d4
    • Michael Meskes's avatar
      Fix off-by-one check that can lead to a memory overflow in ecpg. · ed16ba32
      Michael Meskes authored
      Patch by Liu Huailing <liuhuailing@cn.fujitsu.com>
      ed16ba32