1. 24 Sep, 2020 7 commits
    • Tom Lane's avatar
      Fix handling of -d "connection string" in pg_dump/pg_restore. · a45bc8a4
      Tom Lane authored
      Parallel pg_dump failed if its -d parameter was a connection string
      containing any essential information other than host, port, or username.
      The same was true for pg_restore with --create.
      
      The reason is that these scenarios failed to preserve the connection
      string from the command line; the code felt free to replace that with
      just the database name when reconnecting from a pg_dump parallel worker
      or after creating the target database.  By chance, parallel pg_restore
      did not suffer this defect, as long as you didn't say --create.
      
      In practice it seems that the error would be obvious only if the
      connstring included essential, non-default SSL or GSS parameters.
      This may explain why it took us so long to notice.  (It also makes
      it very difficult to craft a regression test case illustrating the
      problem, since the test would fail in builds without those options.)
      
      Fix by refactoring so that ConnectDatabase always receives all the
      relevant options directly from the command line, rather than
      reconstructed values.  Inject a different database name, when necessary,
      by relying on libpq's rules for handling multiple "dbname" parameters.
      
      While here, let's get rid of the essentially duplicate _connectDB
      function, as well as some obsolete nearby cruft.
      
      Per bug #16604 from Zsolt Ero.  Back-patch to all supported branches.
      
      Discussion: https://postgr.es/m/16604-933f4b8791227b15@postgresql.org
      a45bc8a4
    • Robert Haas's avatar
      Fix two bugs in MaintainOldSnapshotTimeMapping. · 55b7e2f4
      Robert Haas authored
      The previous coding was confused about whether head_timestamp was
      intended to represent the timestamp for the newest bucket in the
      mapping or the oldest timestamp for the oldest bucket in the mapping.
      Decide that it's intended to be the oldest one, and repair
      accordingly.
      
      To do that, we need to do two things. First, when advancing to a
      new bucket, don't categorically set head_timestamp to the new
      timestamp. Do this only if we're blowing out the map completely
      because a lot of time has passed since we last maintained it. If
      we're replacing entries one by one, advance head_timestamp by
      1 minute for each; if we're filling in unused entries, don't
      advance head_timestamp at all.
      
      Second, fix the computation of how many buckets we need to advance.
      The previous formula would be correct if head_timestamp were the
      timestamp for the new bucket, but we're now making all the code
      agree that it's the timestamp for the oldest bucket, so adjust the
      formula accordingly.
      
      This is certainly a bug fix, but I don't feel good about
      back-patching it without the introspection tools added by commit
      aecf5ee2, and perhaps also some
      actual tests. Since back-patching the introspection tools might
      not attract sufficient support and since there are no automated
      tests of these fixes yet, I'm just committing this to master for
      now.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      55b7e2f4
    • Peter Eisentraut's avatar
      Standardize the printf format for st_size · c005eb00
      Peter Eisentraut authored
      Existing code used various inconsistent ways to printf struct stat's
      st_size member.  The type of that is off_t, which is in most cases a
      signed 64-bit integer, so use the long long int format for it.
      c005eb00
    • Robert Haas's avatar
      Add new 'old_snapshot' contrib module. · aecf5ee2
      Robert Haas authored
      You can use this to view the contents of the time to XID mapping
      which the server maintains when old_snapshot_threshold != -1.
      Being able to view that information may be interesting for users,
      and it's definitely useful for figuring out whether the mapping
      is being maintained correctly. It isn't, so that will need to be
      fixed in a subsequent commit.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      aecf5ee2
    • Robert Haas's avatar
      Expose oldSnapshotControl definition via new header. · f5ea92e8
      Robert Haas authored
      This makes it possible for code outside snapmgr.c to examine the
      contents of this data structure. This commit does not add any code
      which actually does so; a subsequent commit will make that change.
      
      Patch by me, reviewed by Thomas Munro, Dilip Kumar, Hamid Akhtar.
      
      Discussion: http://postgr.es/m/CA+TgmoY=aqf0zjTD+3dUWYkgMiNDegDLFjo+6ze=Wtpik+3XqA@mail.gmail.com
      f5ea92e8
    • Tom Lane's avatar
    • Tom Lane's avatar
      Improve behavior of tsearch_readline(), and remove t_readline(). · 83b61319
      Tom Lane authored
      Commit fbeb9da2, which added the tsearch_readline APIs, left
      t_readline() in place as a compatibility measure.  But that function
      has been unused and deprecated for twelve years now, so that seems
      like enough time to remove it.  Doing so, and merging t_readline's
      code into tsearch_readline, aids in making several useful
      improvements:
      
      * The hard-wired 4K limit on line length in tsearch data files is
      removed, by using a StringInfo buffer instead of a fixed-size buffer.
      
      * We can buy back the per-line palloc/pfree added by 3ea7e955
      in the common case where encoding conversion is not required.
      
      * We no longer need a separate pg_verify_mbstr call, as that
      functionality was folded into encoding conversion some time ago.
      
      (We could have done some of this stuff while keeping t_readline as a
      separate API, but there seems little point, since there's no reason
      for anyone to still be using t_readline directly.)
      
      Discussion: https://postgr.es/m/48A4FA71-524E-41B9-953A-FD04EF36E2E7@yesql.se
      83b61319
  2. 23 Sep, 2020 4 commits
  3. 22 Sep, 2020 5 commits
  4. 21 Sep, 2020 4 commits
  5. 20 Sep, 2020 2 commits
  6. 19 Sep, 2020 3 commits
  7. 18 Sep, 2020 6 commits
  8. 17 Sep, 2020 9 commits